Cannot debug single theory in isolation - visual-studio-2017

Is there a way to debug an individual theory in Visual Studio 2017? This worked in 2015. Now, in 2017, starts the debugger and kicks off all test cases in the theory.
I just updated the latest release of 2017 (15.9.7). Not sure if it worked beforehand.
I can choose an individual test, but when I click debug, they are all executed.
This works in Visual Studio 2015 (14.0.25431.01 Update 3). The issue persists in Visual Studio 2019 preview 1.1.
Shortened code sample:
namespace MyNameSpace
{
public class PayloadTest : BaseTest
{
[InlineData("AllergyDataChanged")]
[InlineData("ImplantableDeviceDataChanged")]
public void test1(string source, Type entityIdType = null)
{
TestSubscriber(source, entityIdType);
}

Go to: Tools > Options > Test > General > Uncheck "Discover tests in real time from source files"
This appears to be an issue with Visual Studio 2017+.
Source of quote is a response a received on Github

Related

How to activate the error waves in visual studio code?

I recently started using Visual Studio Code for C++ (installed extensions: C++ and Code Runner), and sometimes those red error waves under the code show even though everything is correct, and then the only "quick fix"-option was to deactivate them. I was annoyed by the waves so I deactivated them - and now I do not know how to reactivate them (well, most of the time they actually were helpful)! I found nothing in the settings, even after resetting everything they did not come back.
Could you give me a hint how to activate them again?
To disable or enable wavy/squiggly underline in visual studio code, go to file\preferences
and change some settings
To disable:
{
"workbench.colorCustomizations": {
"editorError.foreground": "#00000000",
"editorWarning.foreground": "#00000000",
"editorInfo.foreground": "#00000000"
}
}
to enable: (this color is a suggestion):
{
"workbench.colorCustomizations": {
"editorError.foreground": "#ff000088",
"editorWarning.foreground": "#ffe60033",
"editorInfo.foreground": "#00ff0088"
}
}

Building Visual Studio 2010 C++ project with a system that has only Visual Studio 2017 installed

We're currently upgrading our systems and want to use that opportunity to upgrade from VS 2010 to VS 2017.
Before switching over, we're running some tests with our existing projects (C++ and C#). Compiling and debugging C# projects worked - as expected - without a hitch.
We've got one pretty big C++ solution that we'd also like to continue developing in VS 2017, but for now we'd like to neither upgrade the platform toolset or sdk version.
Just installing VS 2017 and compiling the solution results in the error:
The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".
While googling i've found the following question: How to install Visual Studio Build Tools 2010 on Visual Studio 2015 Community?
Which is similar to the problem we're facing. I tried installing the Headers and Tools from the Windows 7 SDK. I also installed the C++ Compiler Update, but now get the following errors (for every project):
Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. in C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets on line 297
Required file "" is missing. in C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets on line 153
The element mentioned in above error has the following text:
<!-- Rest of the sources -->
<CL Condition="'%(ClCompile.PrecompiledHeader)' != 'Create' and '%(ClCompile.ExcludedFromBuild)'!='true'"
BuildingInIDE ="$(BuildingInsideVisualStudio)"
Sources ="#(ClCompile)"
AdditionalIncludeDirectories ="%(ClCompile.AdditionalIncludeDirectories)"
AdditionalOptions ="%(ClCompile.AdditionalOptions)"
AdditionalUsingDirectories ="%(ClCompile.AdditionalUsingDirectories)"
AssemblerListingLocation ="%(ClCompile.AssemblerListingLocation)"
AssemblerOutput ="%(ClCompile.AssemblerOutput)"
BasicRuntimeChecks ="%(ClCompile.BasicRuntimeChecks)"
BrowseInformation ="%(ClCompile.BrowseInformation)"
BrowseInformationFile ="%(ClCompile.BrowseInformationFile)"
BufferSecurityCheck ="%(ClCompile.BufferSecurityCheck)"
CallingConvention ="%(ClCompile.CallingConvention)"
CompileAsManaged ="%(ClCompile.CompileAsManaged)"
CompileAs ="%(ClCompile.CompileAs)"
DebugInformationFormat ="%(ClCompile.DebugInformationFormat)"
DisableLanguageExtensions ="%(ClCompile.DisableLanguageExtensions)"
DisableSpecificWarnings ="%(ClCompile.DisableSpecificWarnings)"
EnableEnhancedInstructionSet ="%(ClCompile.EnableEnhancedInstructionSet)"
EnableFiberSafeOptimizations ="%(ClCompile.EnableFiberSafeOptimizations)"
EnablePREfast ="%(ClCompile.EnablePREfast)"
ErrorReporting ="%(ClCompile.ErrorReporting)"
ExceptionHandling ="%(ClCompile.ExceptionHandling)"
ExcludedInputPaths ="$(ExcludePath)"
ExpandAttributedSource ="%(ClCompile.ExpandAttributedSource)"
FavorSizeOrSpeed ="%(ClCompile.FavorSizeOrSpeed)"
FloatingPointExceptions ="%(ClCompile.FloatingPointExceptions)"
FloatingPointModel ="%(ClCompile.FloatingPointModel)"
ForceConformanceInForLoopScope ="%(ClCompile.ForceConformanceInForLoopScope)"
ForcedIncludeFiles ="%(ClCompile.ForcedIncludeFiles)"
ForcedUsingFiles ="%(ClCompile.ForcedUsingFiles)"
FunctionLevelLinking ="%(ClCompile.FunctionLevelLinking)"
GenerateXMLDocumentationFiles ="%(ClCompile.GenerateXMLDocumentationFiles)"
IgnoreStandardIncludePath ="%(ClCompile.IgnoreStandardIncludePath)"
InlineFunctionExpansion ="%(ClCompile.InlineFunctionExpansion)"
IntrinsicFunctions ="%(ClCompile.IntrinsicFunctions)"
MinimalRebuild ="%(ClCompile.MinimalRebuild)"
MultiProcessorCompilation ="%(ClCompile.MultiProcessorCompilation)"
ObjectFileName ="%(ClCompile.ObjectFileName)"
OmitDefaultLibName ="%(ClCompile.OmitDefaultLibName)"
OmitFramePointers ="%(ClCompile.OmitFramePointers)"
OpenMPSupport ="%(ClCompile.OpenMPSupport)"
Optimization ="%(ClCompile.Optimization)"
PrecompiledHeader ="%(ClCompile.PrecompiledHeader)"
PrecompiledHeaderFile ="%(ClCompile.PrecompiledHeaderFile)"
PrecompiledHeaderOutputFile ="%(ClCompile.PrecompiledHeaderOutputFile)"
PreprocessKeepComments ="%(ClCompile.PreprocessKeepComments)"
PreprocessorDefinitions ="%(ClCompile.PreprocessorDefinitions)"
PreprocessSuppressLineNumbers ="%(ClCompile.PreprocessSuppressLineNumbers)"
PreprocessToFile ="%(ClCompile.PreprocessToFile)"
ProcessorNumber ="%(ClCompile.ProcessorNumber)"
ProgramDataBaseFileName ="%(ClCompile.ProgramDataBaseFileName)"
RuntimeLibrary ="%(ClCompile.RuntimeLibrary)"
RuntimeTypeInfo ="%(ClCompile.RuntimeTypeInfo)"
ShowIncludes ="%(ClCompile.ShowIncludes)"
SmallerTypeCheck ="%(ClCompile.SmallerTypeCheck)"
StringPooling ="%(ClCompile.StringPooling)"
StructMemberAlignment ="%(ClCompile.StructMemberAlignment)"
SuppressStartupBanner ="%(ClCompile.SuppressStartupBanner)"
TreatSpecificWarningsAsErrors ="%(ClCompile.TreatSpecificWarningsAsErrors)"
TreatWarningAsError ="%(ClCompile.TreatWarningAsError)"
TreatWChar_tAsBuiltInType ="%(ClCompile.TreatWChar_tAsBuiltInType)"
UndefineAllPreprocessorDefinitions ="%(ClCompile.UndefineAllPreprocessorDefinitions)"
UndefinePreprocessorDefinitions ="%(ClCompile.UndefinePreprocessorDefinitions)"
UseFullPaths ="%(ClCompile.UseFullPaths)"
UseUnicodeForAssemblerListing ="%(ClCompile.UseUnicodeForAssemblerListing)"
WarningLevel ="%(ClCompile.WarningLevel)"
WholeProgramOptimization ="%(ClCompile.WholeProgramOptimization)"
XMLDocumentationFileName ="%(ClCompile.XMLDocumentationFileName)"
CreateHotpatchableImage ="%(CLCompile.CreateHotpatchableImage)"
TrackerLogDirectory ="%(ClCompile.TrackerLogDirectory)"
TLogReadFiles ="#(CLTLogReadFiles)"
TLogWriteFiles ="#(CLTLogWriteFiles)"
ToolExe ="$(CLToolExe)"
ToolPath ="$(CLToolPath)"
TrackFileAccess ="$(TrackFileAccess)"
MinimalRebuildFromTracking ="%(ClCompile.MinimalRebuildFromTracking)"
ToolArchitecture ="$(CLToolArchitecture)"
TrackerFrameworkPath ="$(CLTrackerFrameworkPath)"
TrackerSdkPath ="$(CLTrackerSdkPath)"
TrackedInputFilesToIgnore ="#(ClNoDependencies)"
AcceptableNonZeroExitCodes ="%(ClCompile.AcceptableNonZeroExitCodes)"
YieldDuringToolExecution ="$(ClYieldDuringToolExecution)"
>
Looking for ways to solve the warning, that the WindowsSDKDir couldn't befound led me to this question
Chaning the Platform Toolset to "Windows7.1SDK" gets rid of the "Could not find WindowsSDKDir variable from the registry." error, but the "Required file "" is missing." error remains.
Installing Visual Studio 2010 C++ Express does solve the problem (at least for compiling and running the solution in Release).
Is there a way to work with VS 2017 and without upgrading our projects without needing to install VS 2010?
It is apparently not possible. You've got to either install Visual Studio 2010 or upgrade the toolset to Visual Studio 2017 as outlined in this blogpost - and comments.

Facing Test Case not found on Visual Studio 2017 [version 15.8.1]

I am facing "test method not found" on visual studio 2017 - Version 15.8.1, When i am trying to run or debug the code from visual studio.
Issue: [Test project {Project Name} does not reference any .NET NuGet adapter. Test discovery or execution might not work for this project. It is recommended to reference NuGet test adapters in each test project in the solution. ]
Note: I am able to solve the above error on visual studio 2017 versions 15.7.* using below link.
Please note this is not duplicate of - "Visual Studio 17: Facing Test Case not found issue in Visual Studio 17" or any other question already in stack overflow.
If you have the same version. It can be reproduced using this code.
[TestClass]
public class ATest : ATestBase
{
[TestInitialize]
public override void TestInitialize()
{
if (Playback.IsInitialized == false)
Playback.Initialize();
}
[TestCleanup]
public override void TestCleanup()
{
if (Playback.IsInitialized == true)
Playback.Cleanup();
base.TestCleanup();
}
[TestMethod, TestCategory("SmokeTest")]
[DeploymentItem(#"DataSource\Documents\some.pdf")]
public void SmokeFlow()
{
string name = "test";
}
}
Starting Visual studio 2017 version 15.8 and on wards. A new option is added under tools -> options -> test as shown in screenshot. Uncheck the option and restart your visual studio. This solves the issue.

ConfigurationManager issue in VS 2017

The following code, when run in Visual Studio 2015 and earlier, results in a message box being shown with the expected value "12345".
string executablePath = Application.ExecutablePath;
executablePath = Path.GetFileNameWithoutExtension(executablePath);
executablePath = executablePath + ".vshost.exe";
if (!File.Exists(executablePath))
throw new FileNotFoundException(executablePath);
Configuration cfg = ConfigurationManager.OpenExeConfiguration(executablePath);
cfg.AppSettings.Settings.Add("Testing", "12345");
cfg.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection(cfg.AppSettings.SectionInformation.Name);
string testing = ConfigurationManager.AppSettings["Testing"];
MessageBox.Show(testing);
When I run the same code in Visual Studio 2017 the message box displays a blank value.
Is this a bug in Visual Studio 2017 or does the code require modification?
UPDATE (specific cause):
So the main cause, along with the accepted answer, was that I had opened the solution in VS 2015 which generated the *.vshost.exe related files. Later I opened the solution in VS 2017 and, of course, the *.vshost.exe files aren't cleaned automatically so were still there.
UPDATE 2 (for those who want to be able to use similar code in both):
string executablePath = Application.ExecutablePath;
executablePath = Path.GetFileNameWithoutExtension(executablePath);
executablePath = executablePath + ".vshost.exe";
// Check if the *.vshost.exe exists
if (File.Exists(executablePath))
{
try
{
// If deleting throws an exception then the stub is being run by *.vshost.exe while
// debugging which means this is NOT Visual Studio 2017 (*.vshost.exe is no longer used in VS 2017)
File.Delete(executablePath);
// If it deletes then use the regular app path since VS2017 is using that now.
executablePath = Application.ExecutablePath;
}
catch (Exception)
{
executablePath = Application.ExecutablePath;
}
}
else
executablePath = Application.ExecutablePath;
Configuration cfg = ConfigurationManager.OpenExeConfiguration(executablePath);
cfg.AppSettings.Settings.Add("Testing", "12345");
cfg.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection(cfg.AppSettings.SectionInformation.Name);
string testing = ConfigurationManager.AppSettings["Testing"];
MessageBox.Show(testing);
The debugger hosting process has been removed in VS2017, so when you run your application the path you give to the OpenExeConfiguration method is incorrect.
Instead, pass Application.ExecutablePath to that method and it should work. The same should work in VS 2015 if you turn off the hosting process (Project properties -> Debug -> Enable the Visual Studio hosting process).
It's odd that you were using the hosting process path in the first place, as that would only ever work while running in the debugger from within Visual Studio.

VS2015.3/PTVS Python Tools no longer working?

strong textI reinstalled VS 2015 Update 3 (from Web install) w/Python Tools, but Python Tools don't seem to work anymore. From ActivityLog.xml, the error is:
<record>494</record>
<time>2016/07/04 15:59:16.031</time>
<type>Error</type>
<source>VisualStudio</source>
<description>LegacySitePackage failed for package [Python Tools
Package]Source:
&apos;Microsoft.VisualStudio.Composition&apos;
Description: Expected 1 export(s) with contract name
"Microsoft.PythonTools.Interpreter.IInterpreterOptionsService"
but found 0 after applying applicable constraints.
#x000D;
Microsoft.VisualStudio.Composition.CompositionFailedException:
Expected 1 export(s) with contract name
"Microsoft.PythonTools.Interpreter.IInterpreterOptionsService"
but found 0 after applying applicable constraints.
Microsoft.VisualStudio.Composition.ExportProvider.GetExports
(ImportDefinition importDefinition)
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExports
[T,TMetadataView](String contractName, ImportCardinality
cardinality)
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExport
[T,TMetadataView] (String contractName)
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T]
(String contractName)
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T]
()
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue
[T] ()
at
Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService
[T] ()
at
Microsoft.PythonTools.PythonToolsService..ctor(IServiceContainer
container)
at
Microsoft.PythonTools.PythonToolsPackage.Initialize()
at
Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.
Interop.IVs Package.SetSite(IServiceProvider sp)</description>
<guid>{6DBD7C1E-1F1B-496D-AC7C-C55DAE66C783}</guid>
<hr>80131500</hr> <errorinfo></errorinfo>
I de-installed/re-installed VS 2015 Python support (directly from PTVS 2.2.4 VS 2015.msi). Same error.
What to do? The Machine (Win 10) has Python 2.7/x64 in PATH.
There seems to be a real problem for other too. See here:
Visual Studio Python Environments window does not display
Interestingly, I have two similar dev machines (Win10/x64), both installed recently, both have VS 2013Pro + VS2015 Community installed. On one box, everything works fine, on the other: see above.
Had the same issue.
Visual Studio 2015 Update 3, PTVS 2.2.4
Resolved it by:
Closing VS
Clearing the content of C:\Users\YOUR_USERNAME\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache folder. * notice the YOUR_USERNAME and replace it with your actual username to get the local path.
Relaunching VS.
Hope this helps
Delete the contents from the following folders:
C:\Users{user}\AppData\Local\Microsoft\VisualStudio
C:\Users{user}\AppData\Local\Microsoft\VSCommon
and run Visual Studio 2015 again:
[x64] C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
[x86] C:\Program Files\Microsoft Visual Studio 14.0\Common7\IDE
It seems like they fixed these issues in PTVS 2.2.5: github.com/Microsoft/PTVS/issues/1411 and github.com/Microsoft/PTVS/issues/1415
Control Panel/Uninstall change
Select VS2015, click change
Once the dialog builds, select modify, then select Python tools.
Done.