-
Notifications
You must be signed in to change notification settings - Fork 285
Open
Labels
Area: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Issues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)
Description
This is a bug dating back to the oldest stable MSTest version on nuget.org. The two features never worked correctly together.
Run with dotnet test -- RunConfiguration.DisableAppDomain=true
:
-
All versions: The test assembly is loaded twice in the same app domain. Once from bin and once from deployment directory
-
Up to 3.10.5: The test fails with InvalidCastException:
Example (10s 862ms): Error Message: Test method TestProject44.Test1.Example threw exception: System.InvalidCastException: [A]ExampleDataType cannot be cast to [B]ExampleDataType. Type A originates from 'TestProject44, Version=1.0.0.0, Culture=neutral, Pub licKeyToken=null' in the context 'LoadFrom' at location 'C:\Users\ygerges\source\repos\TestProject44\TestProject44\TestResults\Deploy_ygerges 2025-10-14 11_24_27\ Out\TestProject44.dll'. Type B originates from 'TestProject44, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\Use rs\ygerges\source\repos\TestProject44\TestProject44\bin\Debug\net48\TestProject44.dll'. Stack Trace: at TestProject44.Test1.ExampleDataTypeTypeConverter.ConvertTo(ITypeDescriptorContext context, CultureInfo culture, Object value, Type destinationType) in C:\U sers\ygerges\source\repos\TestProject44\TestProject44\Test1.cs:line 33 at TestProject44.Test1.Example() in C:\Users\ygerges\source\repos\TestProject44\TestProject44\Test1.cs:line 17
-
3.11.0 and 4.0.0: the test passes, even if the assembly is still loaded twice. That might get broken as it was before again when Fix deployment regression #6718 is merged.
Metadata
Metadata
Assignees
Labels
Area: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Issues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)