Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

AnalysisTask ERROR
rlarno
#1 Posted : Tuesday, April 23, 2013 1:45:29 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/27/2011(UTC)
Posts: 27
Location: Belgium

Thanks: 6 times
Was thanked: 5 time(s) in 5 post(s)
Hi Remco,

after enabling NCrunch on the Newtonsoft.Json.Net40.sln from https://github.com/JamesNK/Newtonsoft.Json
I get this error message:

[15:39:06.7193-AnalysisTask-40] ERROR (Analysis): A failure occurred while analysing the assembly [SnapshotComponent: Newtonsoft.Json.Tests.Net40, 1, 35118415]: System.InvalidProgramException: Common Language Runtime detected an invalid program.
at Newtonsoft.Json.JsonConverterAttribute..ctor(Type converterType)
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Boolean inherit)
at NUnit.Core.Reflect.GetAttributes(ICustomAttributeProvider member, Boolean inherit)
at NUnit.Core.Reflect.HasAttribute(ICustomAttributeProvider member, String attrName, Boolean inherit)
at NUnit.Core.Builders.SetUpFixtureBuilder.CanBuildFrom(Type type)
at NUnit.Core.Extensibility.SuiteBuilderCollection.CanBuildFrom(Type type)
at NUnit.Core.TestFixtureBuilder.CanBuildFrom(Type type)
at NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly, String ns)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
at nCrunch.TestExecution.Frameworks.NUnit.NUnitDynamicTestFinder.FindFrameworkTestsUsingRuntimeInvoke(TestPackage package, ILogger logger, List`1 tests)
at nCrunch.TestExecution.Frameworks.NUnit.NUnitTestFramework.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, String assemblyFilePath, String[] referencedAssemblyFilePaths)
at nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, String assemblyFilePath, String[] referencedAssemblyFilePaths, TestFrameworkDescription[] frameworks)
at nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(TestFrameworkDescription[] applicableFrameworks)
Remco
#2 Posted : Tuesday, April 23, 2013 10:49:09 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi,

Thanks for sharing this issue. It looks to be a clash between NCrunch's performance analysis instrumentation and a particular IL arrangement or CLR security feature that applies to this specific situation.

To work around this issue, set the analyse line execution times setting to FALSE.

I'll see what I can do about addressing this issue properly in the next maintenance release. It's quite complex, so I'm afraid there isn't much more information I can share at this stage. Thanks for providing the sample code, as this makes analysing the issue so much easier!


Cheers,

Remco
Remco
#3 Posted : Thursday, July 4, 2013 5:00:40 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
I've done some more digging into what is happening here ...

The project this exception is being thrown on is making use of AllowPartiallyTrustedCallersAttribute, which seems to trigger the CLR to impose additional restrictions on the nature of code that can be executed from .NET 4.0 onwards. These restrictions are extremely broad and I haven't yet found a way to work around them without disabling performance instrumentation. I would expect that the cases in which people would need to make use of this attribute within the NCrunch test environment are extremely limited, so a viable alternative to disabling performance analysis could be to simply switch off the attribute for NCrunch builds as such:

#if !NCRUNCH
[assembly: AllowPartiallyTrustedCallers]
#endif

A fix is being included in the next maintenance release that will detect the presence of this attribute and will automatically turn off performance analysis while showing a meaningful warning to describe what is happening.
1 user thanked Remco for this useful post.
rlarno on 7/4/2013(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.035 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download