dotnet / roslyn-sdk

Roslyn-SDK templates and Syntax Visualizer
MIT License
498 stars 254 forks source link

"Analyzer with Code Fix (.NET Standard)" and generalized questions about template updates #1131

Closed CaringDev closed 7 months ago

CaringDev commented 7 months ago

While trying out this tutorial I stumbled upon the inability to run the unit tests of the "Analyzer with Code Fix (.NET Standard)" template, due to the test project targeting out-of-support (not installed) netcoreapp3.1 Is there guidance of how to submit updates / fixes to templates (couldn't find anything in CONTRIBUTING) regarding

I'd be happy to help but do want to make as effective as possible use of your and my time :-)

related: #633

sharwell commented 7 months ago

What are the specific errors you saw when attempting to run tests?

sharwell commented 7 months ago

It tends to take a long time for template updates to make their way to the project, but I went ahead and started the process with #1132.

CaringDev commented 7 months ago

Thanks for the kick-off 🚀

Regarding the errors: in VS it builds without issues but fails to run the tests, the message is in the status bar and easy to miss: image The said output looks like:

========== Starting test discovery ==========
Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Testhost process for source(s) 'C:\Dev\MakeConst\MakeConst.Test\bin\Debug\netcoreapp3.1\MakeConst.Test.dll' exited with error: You must install or update .NET to run this application.
App: C:\Users\raphaelschweizer\.nuget\packages\microsoft.testplatform.testhost\15.9.0\lib\netstandard1.5\testhost.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '3.1.0' (x64)
.NET location: C:\Program Files\dotnet\
The following frameworks were found:
  6.0.25 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  7.0.14 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  8.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Learn more:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=win-x64&os=win10
. Please check the diagnostic logs for more information.
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.ThrowOnTestHostExited(IEnumerable`1 sources, Boolean testHostExited) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs:line 520
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, String runSettings) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs:line 294
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.InitializeDiscovery(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler, Boolean skipDefaultAdapters) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs:line 149
========== Test discovery aborted: 0 Tests found in 30.6 ms ==========`

With dotnet test:

Test run for C:\Dev\MakeConst\MakeConst.Test\bin\Debug\netcoreapp3.1\MakeConst.Test.dll (.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Testhost process for source(s) 'C:\Dev\MakeConst\MakeConst.Test\bin\Debug\netcoreapp3.1\MakeConst.Test.dll' exited with error: You must install or update .NET to run this application.
App: C:\Users\raphaelschweizer\.nuget\packages\microsoft.testplatform.testhost\15.9.0\lib\netstandard1.5\testhost.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '3.1.0' (x64)
.NET location: C:\Program Files\dotnet\
The following frameworks were found:
  6.0.25 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  7.0.14 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  8.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Learn more:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=win-x64&os=win10
. Please check the diagnostic logs for more information.

Test Run Aborted.
CaringDev commented 7 months ago

Could you also comment on my questions? I think it would be worthwhile to know how volunteers can / should (if at all) contribute to high-quality, up-to-date templates 🏅