web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Unable to run unit tests

(3) ShareShare
ReportReport
Posted on by 133
Good morning all,
 
I've got a strange issue when I try to run my unit tests. All of a sudden I cannot run any unit test anymore, with the following error:
 
Message: 
Exception has been thrown by the target of an invocation.

  Stack Trace: 
RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
AOS.StartupInternal(String[] Arguments)
AOS.Startup()
?A0x3812d720.GetAosConfig()
Config.InitInternal()
Config.InitOnce(Boolean isOfflineMode)
InProcExecutor.Execute()
SysTestExecutor.RunXppTests(IEnumerable`1 tests)
When I try to run the test in debug mode I see the following additional information:
 
Application Insights Telemetry: {"name":"AppExceptions","time":"2025-07-09T08:58:50.4957821Z","iKey":"14a2b8d7-b617-458a-80fd-34ad7e0be2fb","tags":{"ai.cloud.roleInstance":"EQMFINOPS-1904","ai.internal.sdkVersion":"dotnet:2.22.0-997"},"data":{"baseType":"ExceptionData","baseData":{"ver":2,"exceptions":[{"id":26176662,"outerId":0,"typeName":"System.Reflection.TargetInvocationException","message":"Exception has been thrown by the target of an invocation.","hasFullStack":true,"parsedStack":[{"level":0,"method":"System.RuntimeMethodHandle.InvokeMethod","assembly":"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","line":0},{"level":1,"method":"System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal","assembly":"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","line":0},{"level":2,"method":"System.Reflection.RuntimeMethodInfo.Invoke","assembly":"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","line":0},{"level":3,"method":"Microsoft.Dynamics.AX.AOS.StartupInternal","assembly":"aoskernel, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":0},{"level":4,"method":"Microsoft.Dynamics.AX.AOS.Startup","assembly":"aoskernel, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":0},{"level":5,"method":"Microsoft.Dynamics.AX.AosConfig.?A0x3812d720.GetAosConfig","assembly":"Microsoft.Dynamics.AX.AosConfig, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":0},{"level":6,"method":"Microsoft.Dynamics.AX.AosConfig.Config.InitInternal","assembly":"Microsoft.Dynamics.AX.AosConfig, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":0},{"level":7,"method":"Microsoft.Dynamics.AX.AosConfig.Config.InitOnce","assembly":"Microsoft.Dynamics.AX.AosConfig, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":0},{"level":8,"method":"Microsoft.Dynamics.TestTools.TestAdapter.Execution.InProcExecutor.Execute","assembly":"Microsoft.Dynamics.TestTools.17.0.TestAdapter, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":0}]},{"id":15674740,"outerId":26176662,"typeName":"System.TypeInitializationException","message":"The type initializer for 'PerTypeValues`1' threw an exception.","hasFullStack":true,"parsedStack":[{"level":0,"method":"System.Reflection.Internal.MemoryBlock.GetUtf8NullTerminatedLength","assembly":"System.Reflection.Metadata, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","line":0},{"level":1,"method":"System.Reflection.Metadata.MetadataReader.ReadMetadataHeader","assembly":"System.Reflection.Metadata, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","line":0},{"level":2,"method":"System.Reflection.Metadata.MetadataReader..ctor","assembly":"System.Reflection.Metadata, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","line":0},{"level":3,"method":"System.Reflection.Metadata.PEReaderExtensions.GetMetadataReader","assembly":"System.Reflection.Metadata, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","line":0},{"level":4,"method":"Microsoft.Dynamics.Ax.Xpp.IndexedOnDemandXppTypeLoader2.ProcessAssemblyMetadata","assembly":"Microsoft.Dynamics.AX.Xpp.Support, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":0},{"level":5,"method":"Microsoft.Dynamics.Ax.Xpp.IndexedOnDemandXppTypeLoader2.InitializeTypesAsync","assembly":"Microsoft.Dynamics.AX.Xpp.Support, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":0},{"level":6,"method":"Microsoft.Dynamics.Ax.Xpp.TypeLoading.XppTypeLoader2.Initialize","assembly":"Microsoft.Dynamics.AX.Xpp.Support, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":0},{"level":7,"method":"Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.Start","assembly":"Microsoft.Dynamics.AX.Xpp.Support, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":0}]},{"id":21044963,"outerId":15674740,"typeName":"System.IO.FileLoadException","message":"Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)","hasFullStack":true,"parsedStack":[{"level":0,"method":"System.SpanHelpers+PerTypeValues`1.MeasureArrayAdjustment","assembly":"System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51","line":0},{"level":1,"method":"System.SpanHelpers+PerTypeValues`1..cctor","assembly":"System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51","line":0}]},{"id":58712211,"outerId":21044963,"typeName":"System.IO.FileLoadException","message":"Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)","hasFullStack":true,"parsedStack":[{"level":0,"method":"System.Reflection.RuntimeAssembly._nLoad","assembly":"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","line":0},{"level":1,"method":"System.Reflection.RuntimeAssembly.InternalLoadAssemblyName","assembly":"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","line":0},{"level":2,"method":"System.Reflection.Assembly.Load","assembly":"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","line":0},{"level":3,"method":"Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginCache.CurrentDomainAssemblyResolve","assembly":"Microsoft.VisualStudio.TestPlatform.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","fileName":"/_/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs","line":514},{"level":4,"method":"System.AppDomain.OnAssemblyResolveEvent","assembly":"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","line":0}]}],"properties":{"ProcessID":"14956","OSVersion":"10.0.20348.0","DynamicsAssemblyVersion":"7.0.7606.56","ActivityId":"2bd0e4e8-e9a8-0000-af04-dc2ba8e9db01","EntryAssemblyVersion":"17.1400.25.20301","EntryAssemblyName":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\Common7\\IDE\\Extensions\\TestPlatform\\testhost.exe","VsUserHash":"cd4758d680554d9dd26318d1d7263dd7942cbabe68bf2cb1b6cdf98ce0a45648","ProcessName":"testhost","IsFirstPartyVSUser":"False","IsLocalAdministrator":"True","DevALMTelemetryAssemblyVersion":"7.0.30029.0"}}}}
 
What stands out to me in that call stack is the error "Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1", making me think this problem might be related to some kind of compatibility issue with one or more packages. My current suspicion is that this problem might be related to the Visual Studio version I am running (7.14.8) as I recently updated it. Anyone seen this issue before, and could point me in the right direction of how I can fix it?
 
 
Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at
    Isn't it UDE? If so, it's a known problem; quite a few people complained about it in the inside forum. Unfortunately, Microsoft didn't react there. I don't know whether anyone created a support ticket about it; I didn't (my work for clients is on CHEs, not UDE).
  • FV@E Profile Picture
    133 on at
    I assume with UDE you mean the new unified developer experience? No this is on a Onebox virtual machine.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans