Comments (10)
Hi @tomaustin700,
I've tried to reproduce this issue today using your sample solution and was not able.
I used try-convert built from commit 8d2600c.
Could you verify if the issue is still happening or was it fixed in the meantime?
from try-convert.
@cartermp OK, I've removed the change to ProjectRootElementExtensions.cs from the pull request. Please review and let me know if you want anything changed.
from try-convert.
Initial look at this suggests that it is an MSTest issue. The version of MSTest being used fails to load on .NET Core but succeeds on framework
from try-convert.
Hi @jmarolf, thanks for investigating. Is this something that needs to be raised with the MSTest team?
Thanks
from try-convert.
Hi @dotnokato
I have pulled master and rebuilt and I seem to be getting a slightly different exception now.
System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at Microsoft.VisualStudio.TestWindow.Controller.TestContainerConfigurationQueryByContext.<GetTestContainerConfigurationsInternalAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestWindow.Controller.TestContainerConfigurationQuery.<GetTestContainerConfigurationsAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestWindow.Controller.TestRunConfiguration.<UpdateAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestWindow.Controller.RunOperation.<RunTestsAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestWindow.Controller.Operation.<<Execute>b__41_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestWindow.Extensibility.ILoggerExtensions.<CallWithCatchAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
How are you running try convert? I am using the -w
argument on the solution directory - I'm not sure if that makes any difference.
Thanks.
from try-convert.
Hi @tomaustin700
Yes, I am using -w
argument on the solution directory.
And I was able to reproduce the issue looking at it again. try-convert finishes successfully, but the output project is not a test project. An attempt to run tests from this output project result with the exception as shown by you in Output > Tests window.
After some debugging I found that this project is identified as ProjectStyle.WindowsDesktop instead of ProjectStyle.MSTest in GetProjectStyle() method in MSBuildWorkspace class.
As a result output project is missing PackageReference to Microsoft.NET.Test.Sdk.
from try-convert.
Yeah, this is a bug. The code currently assumes that it's a desktop app since it has these references https://github.com/tomaustin700/TestConvertIssue/blob/f5a7e30e2bc466171daef63cc0904282d7950058/PatientLedger.PatientLedgerTests/Ledger.PatientLedgerTests.csproj#L70-L75
The correct thing to do would be to adjust this routine to default to test if it has the test references regardless of if it has windows references.
try-convert/src/MSBuild.Abstractions/MSBuildWorkspace.cs
Lines 199 to 215 in 2641e96
Probably a pretty simple fix. We look at references and make some assumptions since that's about the best that can be done in conversion tooling, so I suppose a targeted adjustment here is enough.
@tomaustin700 @dotnokato would either of you be interested in submitting a PR? More than happy to review. Also thanks to both of you for investigating this.
from try-convert.
Hi @cartermp
Thanks for confirmation on what the result should be if there are test references in project file.
I am happy to work on a PR for that.
One additional question:
What should be the correct Project Sdk for such MSTest projects?
Current logic in https://github.com/dotnet/try-convert/blob/9ab68fac00e042daaede4e4486b2390755c4842e/src/MSBuild.Conversion.Project/ProjectRootElementExtensions.cs#L29-31 will set is as <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
It seems to me that it should rather be <Project Sdk="Microsoft.NET.Sdk">
from try-convert.
@dotnokato In this case I think the logic you're pointing out here is correct (could be wrong...). The thinking when I wrote that code was that those references will not work correctly for .NET Core-based tests unless the WindowsDesktop SDK is also set. However, the code in MSBuildWorkspace doesn't correctly handle this, so it ends up causing a problem.
from try-convert.
Thanks for resolving this @dotnokato.
from try-convert.
Related Issues (20)
- Try convert: displays multiple instances , without being able to pick one HOT 6
- There appear to be some build issues on recent sdks
- Documentation should point out that --ignore-failed-sources could be required HOT 1
- try-convert fails when "Multiple installs of MSBuild" HOT 7
- Release .NET 6 version to NuGet
- Immediate crash on startup (System.Threading.Tasks.Dataflow, Version=6.0.0.0) HOT 3
- Conversion to net6.0: The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF
- Not Recognizing UWP as Supported Output Type
- try-convert crashes with "Could not load file or assembly 'System.Runtime" HOT 8
- Upgrade removes custom Import statements
- still trying to find netcore 5 not 6 issue
- can not seem to be able to fix this error HOT 4
- "Multiple installs of MSBuild detected please select one" HOT 1
- try-convert crashes with 'Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0 HOT 2
- Crash with System.Runtime not found HOT 3
- What is correct input of Multiple installs of MSBuild detected please select one HOT 6
- try-convert 0.9.4.32202 crashes with: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Could not find or load a specific file. (0x80131621) HOT 7
- try-convert can be smart, add condition when encountering a dll with a different name
- Can't use the tool with Supported .NET versions
- Why does the program not warn that .net 5 is needed when starting?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from try-convert.