-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows 7, .NET 6.0.2xx: dotnet test always crashes with AccessViolationException in RuntimeAssembly.InternalLoad on my machine #3543
Comments
Same crash: Project<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
...
<ItemGroup>
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="nunit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
</ItemGroup>
</Project>
ExceptionFatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Reflection.RuntimeAssembly.InternalLoad(System.Runtime.CompilerServices.ObjectHandleOnStack, System.Runtime.CompilerServices.ObjectHandleOnStack, System.Runtime.CompilerServices.StackCrawlMarkHandle, Boolean, System.Runtime.CompilerServices.ObjectHandleOnStack, System.Runtime.CompilerSe
rvices.ObjectHandleOnStack)
at System.Reflection.RuntimeAssembly.InternalLoad(System.Reflection.AssemblyName, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, Boolean, System.Runtime.Loader.AssemblyLoadContext)
at System.Reflection.Assembly.Load(System.Reflection.AssemblyName)
at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginCache.CurrentDomainAssemblyResolve(System.Object, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventArgs)
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.AssemblyResolverEvent(System.Object, System.Object)
at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(System.Reflection.AssemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(System.Reflection.AssemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr, System.Reflection.AssemblyName)
at System.Reflection.RuntimeModule.GetTypes(System.Reflection.RuntimeModule)
at System.Reflection.Assembly.GetTypes()
at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginDiscoverer.GetTestExtensionsFromAssembly[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral
, PublicKeyToken=7cec85d7bea7798e]](System.Reflection.Assembly, System.Collections.Generic.Dictionary`2<System.String,System.__Canon>)
at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginDiscoverer.GetTestExtensionsFromFiles[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, P
ublicKeyToken=7cec85d7bea7798e]](System.String[], System.Collections.Generic.Dictionary`2<System.String,System.__Canon>)
at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginDiscoverer.GetTestExtensionsInformation[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.String>)
at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginCache.GetTestExtensions[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=
7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.String>)
at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginCache.DiscoverTestExtensions[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyT
oken=7cec85d7bea7798e]](System.String)
at Microsoft.VisualStudio.TestPlatform.Common.Hosting.TestRuntimeExtensionManager.Create(Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.IMessageLogger)
at Microsoft.VisualStudio.TestPlatform.Common.Hosting.TestRuntimeProviderManager.get_Instance()
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestEngine..ctor()
at Microsoft.VisualStudio.TestPlatform.Client.TestPlatform..ctor()
at Microsoft.VisualStudio.TestPlatform.Client.TestPlatformFactory.GetTestPlatform()
at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager..ctor()
at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.get_Instance()
at Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.RunTestsArgumentProcessor+<>c.<get_Executor>b__6_0()
at System.Lazy`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ViaFactory(System.Threading.LazyThreadSafetyMode)
at System.Lazy`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ExecutionAndPublication(System.LazyHelper, Boolean)
at System.Lazy`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].CreateValue()
at System.Lazy`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].get_Value()
at Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.ArgumentProcessorFactory+<>c__DisplayClass20_0.<WrapLazyProcessorToInitializeOnInstantiation>b__0()
at System.Lazy`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].CreateValue()
at System.Lazy`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].get_Value()
at Microsoft.VisualStudio.TestPlatform.CommandLine.Executor.GetArgumentProcessors(System.String[], System.Collections.Generic.List`1<Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.IArgumentProcessor> ByRef)
at Microsoft.VisualStudio.TestPlatform.CommandLine.Executor.Execute(System.String[])
at Microsoft.VisualStudio.TestPlatform.CommandLine.Program.Main(System.String[])
|
I see this is not new. nunit/dotnet-test-nunit#115 |
The problem in my case seems to be related to using tests in a Windows 7 environment. Downgraded to .net 6.0.103 SDK and it worked. You can use the strategy in the specific test project as : {
"sdk": {
"version": "6.0.103"
}
}
|
Also the same is reported here, also mentioning Windows 7: |
Error still happening with SDK 6.0.202 |
I am trying to get some system on which to repro. |
Still happening on 6.0.203. Downgrading to 6.0.103 as suggested in dotnet/sdk#24124 (comment) works around it. |
I ran a simple xUnit test project on Windows 7 x64, with .NET SDK 6.0.102, and the logs included an error about When I changed to .NET SDK 6.0.200, the logs also included the same error, but the difference is that it was a terminating error, that stopped the execution. Could this be related to a DLL loading process? Logs for test project running on .NET SDK 6.0.102 (error shown in lines 53 to 81):
Logs for test project running on .NET SDK 6.0.200 (error shown in lines 57 to 69):
|
I upgraded to .NET SDK 6.0.402 and the problem was solved. |
Works for me as well with .NET SDK 6.0.402. Closing. |
Randomly seeing an AccessViolationException when discovering tests, seems like Assembly.LoadFrom is throwing an AccessViolation?
|
@KirillOsenkov did this start happening after upgrade of SDK or any other significant event? Are you using preview SDK or stable? Which version? |
I have no further info unfortunately, this is in CloudTest with no easy access to machines. We changed some timings around and it stopped happening :| |
Asked about it here: |
I forgot to follow up in case anyone else runs into this: This was a bug in msdia140.dll for reading .pdb files. vstest.console.exe was calling IntelliTrace.Profiler.dll which was calling covrun64.dll which was calling dia to read the portable pdb. If a portable pdb contains > 64000 methods, it would crash. The bug is fixed in Visual Studio 17.11 (and maybe even 17.10). As a workaround, switch that test assembly that is exhibiting the crash to |
MS internal bug is DevDiv 1938843 |
|
Description
I cannot run
dotnet test
for any NUnit project on my machine (have not tried other test frameworks). It crashes with the exception below, even for a trivial project (attached). However, it runs successfully viavstest.console.exe
, so let me know if this is the wrong project for the bug report.Steps to reproduce
C# project like this:
with a trivial test file:
Run
dotnet test
.Expected behavior
The test runs successfully via
dotnet test
Actual behavior
Diagnostic logs
dotnet test --diag:diag.txt
: diag.txtEnvironment
Windows 7 x64
Microsoft (R) Test Execution Command Line Tool Version 17.1.0
.NET SDK (reflecting any global.json): Version: 6.0.201 Commit: ef40e6aa06
The text was updated successfully, but these errors were encountered: