The most recent version is 5.5.
I'm trying to use ncrunch in Unity3D.
In version 4.16, an error log appeared, but from 5.5 onwards, the error log does not appear and it stops like that. Is there a way to check the error log?
The NCrunch engine process was unexpectedly terminated. Re-enable the engine to continue
External image
Build/Test Issues
The NCrunch engine process was unexpectedly terminated. Re-enable the engine to continue
Started by luiz4our on 3,158 views
I don't know why, but errors are starting to appear,
This error appears...
An error occurred while analyzing this project after it was built: System.BadImageFormatException: Unable to load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. You can not. Reference assemblies should not be loaded and run. Reference assemblies can only be loaded in a reflection-only loader context. (HRESULT where exception occurred: 0x80131058)
File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> System.BadImageFormatException: File or assembly 'file:///C:\Program Files\Unity\Hub\Editor\2022.3 Could not load '.18f1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\Facades\netstandard.dll' or one of its dependencies. Reference assemblies should not be loaded and run. Reference assemblies can only be loaded in a reflection-only loader context. (HRESULT where exception occurred: 0x80131058)
File name: 'file:///C:\Program Files\Unity\Hub\Editor\2022.3.18f1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\Facades\netstandard.dll' ---> System.BadImageFormatException : Unable to load reference assembly for execution.
Location: System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
Location: System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
Location: System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
Location: System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
Location: System.Reflection.Assembly.LoadFrom(String assemblyFile)
Location: nCrunch.Common.NCrunchAssembly.LoadFrom(String assemblyFile)
Location: nCrunch.Common.CustomAssemblyResolver.resolveAssemblyFrom(IEnumerable`1 possibleAssemblyPaths, ParsedAssemblyName parsedAssemblyName)
Location: nCrunch.Common.CustomAssemblyResolver.ResolveAssembly(ParsedAssemblyName parsedAssemblyName)
Location: nCrunch.Common.CustomAssemblyResolver.AssemblyResolve(Object sender, ResolveEventArgs args)
Location: System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
Location: System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
Location: System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
Location: System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
Location: System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
Location: System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit)
Location: nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor..ctor(ReflectedAssembly assembly, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, DynamicProxy[] dynamicProxies)
Location: nCrunch.Module.NUnit3.Integration.NUnit3FrameworkRuntimeEnvironment.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
Location: nCrunch.TestExecution.TestFinder. . ()
Location: nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
Location: nCrunch.TestExecution.TestFinder. . ()
Location: nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
Location: nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, DescribedTestFrameworkDiscoverer[] describedDiscoverers, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
Location: nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(DescribedTestFrameworkDiscoverer[] applicableFrameworks, ComponentUniqueName testComponentUniqueName, PerfTracker perfTracker, TaskLogId taskLogId)
(Korean -> English Translated)
This error appears...
An error occurred while analyzing this project after it was built: System.BadImageFormatException: Unable to load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. You can not. Reference assemblies should not be loaded and run. Reference assemblies can only be loaded in a reflection-only loader context. (HRESULT where exception occurred: 0x80131058)
File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> System.BadImageFormatException: File or assembly 'file:///C:\Program Files\Unity\Hub\Editor\2022.3 Could not load '.18f1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\Facades\netstandard.dll' or one of its dependencies. Reference assemblies should not be loaded and run. Reference assemblies can only be loaded in a reflection-only loader context. (HRESULT where exception occurred: 0x80131058)
File name: 'file:///C:\Program Files\Unity\Hub\Editor\2022.3.18f1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\Facades\netstandard.dll' ---> System.BadImageFormatException : Unable to load reference assembly for execution.
Location: System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
Location: System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
Location: System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
Location: System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
Location: System.Reflection.Assembly.LoadFrom(String assemblyFile)
Location: nCrunch.Common.NCrunchAssembly.LoadFrom(String assemblyFile)
Location: nCrunch.Common.CustomAssemblyResolver.resolveAssemblyFrom(IEnumerable`1 possibleAssemblyPaths, ParsedAssemblyName parsedAssemblyName)
Location: nCrunch.Common.CustomAssemblyResolver.ResolveAssembly(ParsedAssemblyName parsedAssemblyName)
Location: nCrunch.Common.CustomAssemblyResolver.AssemblyResolve(Object sender, ResolveEventArgs args)
Location: System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
Location: System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
Location: System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
Location: System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
Location: System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
Location: System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit)
Location: nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor..ctor(ReflectedAssembly assembly, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, DynamicProxy[] dynamicProxies)
Location: nCrunch.Module.NUnit3.Integration.NUnit3FrameworkRuntimeEnvironment.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
Location: nCrunch.TestExecution.TestFinder. . ()
Location: nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
Location: nCrunch.TestExecution.TestFinder. . ()
Location: nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
Location: nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, DescribedTestFrameworkDiscoverer[] describedDiscoverers, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
Location: nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(DescribedTestFrameworkDiscoverer[] applicableFrameworks, ComponentUniqueName testComponentUniqueName, PerfTracker perfTracker, TaskLogId taskLogId)
(Korean -> English Translated)
Remco NCrunch Developer
#17238
11 Apr 2024 00:01 UTC
Hi, thanks for sharing this issue.
Has this project ever worked for you on any version of NCrunch?
It looks like unity is doing something interesting with its handling of framework reference assemblies - it seems to have its own reference assemblies packaged, which is somewhat unconventional. We haven't done any testing of NCrunch over Unity, so I'm not sure how effective our compatibility is in this area.
The exception itself looks to be triggered by an assembly-level attribute declared in your test project. It's possible that removing these attribute declarations while under NCrunch may get you past this problem. I'd suggest placing a compiler conditional around them, like so:
#if NCrunch
.... attribute declarations / Assembly.cs
#endif
Has this project ever worked for you on any version of NCrunch?
It looks like unity is doing something interesting with its handling of framework reference assemblies - it seems to have its own reference assemblies packaged, which is somewhat unconventional. We haven't done any testing of NCrunch over Unity, so I'm not sure how effective our compatibility is in this area.
The exception itself looks to be triggered by an assembly-level attribute declared in your test project. It's possible that removing these attribute declarations while under NCrunch may get you past this problem. I'd suggest placing a compiler conditional around them, like so:
#if NCrunch
.... attribute declarations / Assembly.cs
#endif
In Unity 2018 version, I used it according to the method in this repository. https://github.com/networm/NCrunchAdapterForUnity
Following this method, ncrunch worked normally with unity.
The ncrunch version at this time was 4.16.
But Unity was upgraded to version 2019 and does not work this way, so we are trying to figure out the cause.
Following this method, ncrunch worked normally with unity.
The ncrunch version at this time was 4.16.
But Unity was upgraded to version 2019 and does not work this way, so we are trying to figure out the cause.
Edited 15 Apr 2024 09:17 UTC
Thank you for answer.
However, I am not familiar with C# projects and NCrunch options.
#if NCrunch
.... attribute declarations / Assembly.cs
#endif
▲ I'm not sure where to implement this method. Can you help me?
However, I am not familiar with C# projects and NCrunch options.
#if NCrunch
.... attribute declarations / Assembly.cs
#endif
▲ I'm not sure where to implement this method. Can you help me?
Remco NCrunch Developer
#17247
15 Apr 2024 09:23 UTC
I've done some deeper looking into Unity and how it works. It seems that Unity projects don't fit within the same general structure of VS solutions. The build system isn't the same and they use their own libraries as a foundation for the code. As you've identified, they also have their own customised version of NUnit.
To have them work under NCrunch, we would need to take a top-to-bottom approach that would require quite a bit of extensive integration, designing a lot of NCrunch around how they handle things. Probably not impossible, but also not something we would be able to handle in the pursuit of resolving a support issue. Basically, it's a whole different platform, and we don't support it right now.
There may be ways to make your tests run under NCrunch by setting up shared code between a normal NUnit test project and a unity test project, perhaps with cross compiling, shared projects, or a lot of MSBuild and compiler conditionals. Unfortunately, I can't be of more help here. If you'd like to see support extended to this platform, I recommend submitting a feature request with uservoice. If enough people are looking to use NCrunch on this platform we may be able to justify introducing support for it in future.
To have them work under NCrunch, we would need to take a top-to-bottom approach that would require quite a bit of extensive integration, designing a lot of NCrunch around how they handle things. Probably not impossible, but also not something we would be able to handle in the pursuit of resolving a support issue. Basically, it's a whole different platform, and we don't support it right now.
There may be ways to make your tests run under NCrunch by setting up shared code between a normal NUnit test project and a unity test project, perhaps with cross compiling, shared projects, or a lot of MSBuild and compiler conditionals. Unfortunately, I can't be of more help here. If you'd like to see support extended to this platform, I recommend submitting a feature request with uservoice. If enough people are looking to use NCrunch on this platform we may be able to justify introducing support for it in future.
Edited 15 Apr 2024 09:24 UTC
Thank you for your reply.
Post a reply
Log in to reply.