Facing error in initialising Go Test Explorer in VS Code - go

As of last month, I am now facing an issue in VS Code where the go tests in my Go project do not show up in Test Explorer.
NOTE - I am able to run the tests directly from Codelens in the file, but as far as the Test explorer UI is concerned it cannot configure my tests.
This was previosly working in VS Code quite well with out any issues.
The Output from the Go module indicates the following error the first time I try opening the Test Explorer.
Failed to resolve tests: TypeError: Cannot read property 'groups' of null
Test Explorer view showing that tests are not found in workspace

Related

Visual Studio 2022 Test Explorer doesn't show any tests with a File/New "Test" project

Using the latest VS...
I created a brand new project with this template...
Everything compiles fine, but the default test that is created doesn't show up in Test Explorer. I hit the green "play all" button and the output window shows 1 test found, but "No tests found to run.".
Is this a known issue? Or what do I need to do to make Test Explorer show all my tests?
I can right-click/Run the test with no issues. But nothing shows in Test Explorer...
The filters were set to show failed tests only. Once I fixed that, the test appeared.

Invalid or unspecified target for shortcut in Setup Project

Pretty much every time I go to build the setup project in my solution, I get the following error: "Invalid or unspecified target for shortcut". MSDN provides the following useless help. When I go to the dialog to (re-)select the target for the shortcut:
My primary output (for my main application) is not present, even though it is definitely listed in the File System view:
The setup project was deleted and completely re-created, and checked in. When it was checked back out, I got the exact same error.
I assume that whatever reason is causing the item to not show up in the "select target" dialog, is the same reason that the build is failing in the first place. What gives?
I just solved this by changing my build mode from Debug to Release.
Primary Output for ... (Release x86) - It is looking for a release build of x86.
If you look at your Errors List you should see the error listed. Right click on it and choose the Properties Window.
Find the "Target" property and simply set it to the correct value.
This goes for the Icon problem as well.
In my case, I was building and packaging a Net.Core project using a Publish Profile.
The publish was failing with no visible error during the Msi build.
I ran the publish profile manually and saw the error that I had 2 copies of appsettings.json being installed at the same location.
I excluded one of the files and both the Publish and Package completed successfully and the shortcuts became valid again.

debugging windows service gives No symbols have been loaded message

I have a Windows service and I have written Debugger.Attach() in the Onstart method of the service.
When I start the service I get a popup which asks to select the debugger instance.
When I select and press ok, the visual studio comes into focus but shows me "No symbols have been loaded" message.
I followed two steps
1.from here http://geekswithblogs.net/dbutscher/archive/2007/06/26/113472.aspx
While debugging in Visual Studio, click on Debug > Windows > Modules. The IDE will dock a Modules window, showing all the modules that have been loaded for your project.
Look for your project's DLL, and check the Symbol Status for it.
If it says Symbols Loaded, then you're golden. If it says something like Cannot find or open the PDB file, right-click on your module, select Load Symbols, and browse to the path of your PDB.
2 goto Debug-> options and settings ->
under the debugging node -> general ...uncheck "just my code" checkbox
and it worked...
I most commonly see this issue when the build of my project that is running doesn't exactly match the build currently loaded in VS. For example, I build my VS project, then I make some (any) change to a file in the project and save without rebuilding. Then if I run the executable/service/DLL the previously built version will run and since it doesn't match the version I have in VS (thanks to my code change), it won't properly attach.
The specific issue in this case is that the VS debugging PDB file does not match the source code making debugging impossible.
This may not be your issue, but I have seen the "no symbols..." error countless times and it is usually a case of the code being executed not matching the code in VS.

Cannot find any coverage data (ASP.NET MVC2)

I am having some issues with getting Code Coverage working with an out-of-the-box ASP.NET MVC2 Web App
VS2010 Ultimate, File > New Project > ASP.NET MVC 2 Web Application > Yes, Create unit test project with Visual Studio Unit Test. I then Rebuild All, Run All Unit Tests, Go to Code Coverage and get the following message:
Cannot find any coverage data (.coverage or .coveragexml) files. Check test run details for possible errors.
All the unit tests passed. (And I haven't touched a line of code yet)
I did find the following on the web:
http://www.vbforums.com/showthread.php?t=615377
which says to do the following:
Test -> Edit Test Settings -> Local
In the test settings dialog, click
"Data and Diagnostics" Ensure "Code
Coverage" are checked, and
double-click on it Check of the dll's
you want code coverage enabled for.
But, when I go to Test > Edit Test Seetings, all I see is the grayed out menu item stating "No Test Settings Available".
Any ideas?
Edit: slowly gaining traction. See: How to create the vsmdi/testrunconfig file when importing a Visual Studio test project?
I have had this same problem occur when I added a test project from another source (ie added to, but not created in the current solution). When doing this, local.testsettings, Solution.vsmdi, and TraceAndTestImpact.testsettings are NOT created inside your solution.
This fix is really quite simple, though. Simply right click on your solution and click Add -> New item. A new window will appear. On the left-hand side under General and Performance should be Test Settings. This should let you add a .testsettings file that you can now edit.
More information can be found here:
http://msdn.microsoft.com/en-us/library/ee256991%28v=vs.100%29.aspx

VS2008: Unit Testing with Code Coverage doesn't work with /CLR

I'm trying to set up unit testing with code coverage in VS2008, for a C++/CLI DLL which is compiled with /clr (not /clr:safe or /clr:pure - it has to be /clr because it uses MFC).
The unit tests work perfectly but the coverage information only works if I compile with /clr:safe or /clr:pure. For /clr the Code Coverage Results window shows the following message:
Empty results generated: none of the
instrumented binary was used. Look at
test run details for any
instrumentation problems.
I've also tried "going offroad" but when I load the coverage file into VS, it also contains empty results.
Annoyingly I can't find anywhere that specifically says whether Code Coverage works with /CLR, so I just had to try it myself.
If it should work, can anyone see what I'm doing wrong here?
[File]->[New]->[Project]
Select Class Library, enter MyProj as the project name, click OK
Right-click on MyProj project, select [Properties]
Select [Configuration Properties]->[General]
Ensure "Common Language Runtime support" is set to /CLR
Add this code to Class1:
public:
static int calc() { return 69; }
Build solution
[Test]->[New Test]->[Unit Test], click OK, click Create
Add this code to TestMethod1:
Assert::AreEqual(MyProj::Class1::calc(), 69);
Right-click on TestProject1 project, select [References]
Click "Add New Reference"
Select MyProj in the "Projects" tab, click OK, click OK again
[Test]->[Edit Test Run Configuration]->[Local Test Run]
Select [Code Coverage]
Check MyProj.dll, click Apply, click Close
[Test]->[Run]->[All Tests in Solution]
The Test Results window shows TestMethod1 has passed.
The Code Coverage Results window shows the following message:
Empty results generated: none of the
instrumented binary was used. Look at
test run details for any
instrumentation problems.
Right-click on MyProj project, select [Properties]
Select [Configuration Properties]->[General]
Change "Common Language Runtime support" to /CLR:SAFE or /CLR:PURE, click OK
Build solution
[Test]->[Run]->[All Tests In Solution]
The Test Results window shows TestMethod1 has passed.
The Code Coverage Results window now shows correct coverage information.
Based on http://msdn.microsoft.com/en-us/library/ms182534.aspx
1-project must be in debug
2.-in the project properties you must select x 86 platform.
3 Unregister the project being tested in the GAC.
Yeh, I think it all has to be in CLR:Safe project to work. I don't fully understand why, but I'm in the same boat as you.

Resources