Hi all,
I'm trying to build a project that references a portable class library.
Gallio.Model.ModelException: An exception occurred while invoking a test driver. ---> System.NotSupportedException: Unsupported type: System.Attribute
at Gallio.Common.Reflection.Impl.CecilReflectionPolicy.<>c__DisplayClass62.<MakeType>b__61()
at Gallio.Common.KeyedMemoizer`2.Memoize(TKey key, Func`1 populator)
at Gallio.Common.Reflection.Impl.CecilReflectionPolicy.MakeType(TypeReference typeHandle)
at Gallio.Common.Reflection.Impl.CecilReflectionPolicy.GetTypeBaseType(StaticDeclaredTypeWrapper type)
at Gallio.Common.Reflection.Impl.StaticDeclaredTypeWrapper.<get_BaseType>b__3()
at Gallio.Common.Memoizer`1.Memoize(Func`1 populator)
at Gallio.Common.Reflection.Impl.StaticDeclaredTypeWrapper.get_BaseType()
at Gallio.Common.Reflection.Impl.StaticDeclaredTypeWrapper.get_BaseTypeInternal()
at Gallio.Common.Reflection.Impl.StaticTypeWrapper.get_BaseType()
at Gallio.Common.Reflection.ReflectionUtils.IsDerivedFrom(ITypeInfo type, String qualifiedTypeName)
at Gallio.Common.Reflection.Impl.StaticCodeElementWrapper.<GetAttributeInfos>d__1.MoveNext()
at Gallio.Common.Reflection.AttributeUtils.<ResolveAttributes>d__c.MoveNext()
at Gallio.Common.Reflection.AttributeUtils.GetAttribute(ICodeElementInfo element, Type attributeType, Boolean inherit)
at Gallio.Common.Reflection.AttributeUtils.GetAttribute[T](ICodeElementInfo element, Boolean inherit)
at Gallio.Model.ModelUtils.PopulateMetadataFromAssembly(IAssemblyInfo assembly, PropertyBag metadataMap)
at Gallio.XunitAdapter.Model.XunitTestExplorer.CreateAssemblyTest(IAssemblyInfo assembly)
at Gallio.XunitAdapter.Model.XunitTestExplorer.GetAssemblyTest(IAssemblyInfo assembly, Test parentTest, Version frameworkVersion, Boolean populateRecursively)
at Gallio.XunitAdapter.Model.XunitTestExplorer.ExploreImpl(IReflectionPolicy reflectionPolicy, ICodeElementInfo codeElement)
at Gallio.Model.Helpers.TestExplorer.Explore(IReflectionPolicy reflectionPolicy, ICodeElementInfo codeElement)
at Gallio.Model.Helpers.SimpleTestDriver.GenerateTestModel(IReflectionPolicy reflectionPolicy, IEnumerable`1 codeElements, IMessageSink messageSink)
at Gallio.Model.Helpers.SimpleTestDriver.DescribeImpl(IReflectionPolicy reflectionPolicy, IList`1 codeElements, TestExplorationOptions testExplorationOptions, IMessageSink messageSink, IProgressMonitor progressMonitor)
at Gallio.Model.BaseTestDriver.Describe(IReflectionPolicy reflectionPolicy, IList`1 codeElements, TestExplorationOptions testExplorationOptions, IMessageSink messageSink, IProgressMonitor progressMonitor)
at Gallio.Model.DefaultTestFrameworkManager.FilteredTestDriver.<>c__DisplayClass17.<DescribeImpl>b__15(ITestDriver driver, IList`1 items, Int32 driverCount)
at Gallio.Model.DefaultTestFrameworkManager.FilteredTestDriver.ForEachDriver[T](MultiMap`2 testFrameworkPartitions, Func`4 func)
--- End of inner exception stack trace ---
at Gallio.Model.DefaultTestFrameworkManager.FilteredTestDriver.ForEachDriver[T](MultiMap`2 testFrameworkPartitions, Func`4 func)
at Gallio.Model.DefaultTestFrameworkManager.FilteredTestDriver.DescribeImpl(IReflectionPolicy reflectionPolicy, IList`1 codeElements, TestExplorationOptions testExplorationOptions, IMessageSink messageSink, IProgressMonitor progressMonitor)
at Gallio.Model.BaseTestDriver.Describe(IReflectionPolicy reflectionPolicy, IList`1 codeElements, TestExplorationOptions testExplorationOptions, IMessageSink messageSink, IProgressMonitor progressMonitor)
at nCrunch.TestExecution.Frameworks.Gallio.GallioWrapper.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths)
at nCrunch.TestExecution.Frameworks.Gallio.GallioTestFramework.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths)
at nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, TestFrameworkDescription[] frameworks)
at nCrunch.Compiler.StaticManipulation.BuiltAssembly.DiscoverTests(TestFrameworkDescription[] applicableTestFrameworks)
at nCrunch.Compiler.RemoteBuildRunner.#=qqZ$biBs7mvGRD42no0zcEfaWi4v$NuLBVy7NcKpqVcU=(ComponentBuildParameters #=q8_ZGEckiLbRsUjNXvAaKOg==, FilePath #=qkb_tmWgu4KtzCWen$hSPsMPrQ1mkbV0Q2nGsXkZrK6s=, BuildOutput #=qnXDAQpnfqAeJl0p31Gcd1w==, DirectoryPath[] #=qSofaDjiwWEBgv$s22DxHPsKSbp4hruna3jReeOLGOyg=, FilePath[] #=qfLDmMJzWXbDJK4KiH6tg6MwNo8hcfZSKZe0YwSutOdtYLr7gvxG6$V$9q044oc1x)
at nCrunch.Compiler.RemoteBuildRunner.Build(ComponentBuildParameters parameters)
If the referenced project is NOT a portable class library, but otherwise exactly the same, it works fine.
Any thoughts on how to solve this?
Regards,
Erwin
Build/Test Issues
NCrunch having issues building a project referencing a Portable Class Library
Started by Erwin on 5,741 views
Remco NCrunch Developer
#6559
22 Oct 2014 09:40 UTC
Hi Erwin,
Thanks for sharing this issue.
NCrunch relies on Gallio for its Xunit v1 integration. Gallio is quite old now and it predates the introduction of the PCL libraries - so it isn't really surprising that it is unable to make sense of metadata inside these libraries.
However, something that doesn't make sense to me is why this is happening for you in a project that is referencing the PCL project, rather than the PCL project itself. The failure is being caused by code intended to find tests within the output assembly, at a point where it attempts to parse assembly-level attributes inside the test project. Technically, this should have nothing to do with the PCL library at all - as an Xunit v1 test project by nature cannot be PCL. The only conclusion I can draw is that somehow NCrunch is trying to discover tests within the PCL assembly itself - which basically shouldn't happen.
Is there any chance you can construct and submit a sample solution that demonstrates this problem using the (- BROKEN LINK -)contact form[/url]? I've tried to reproduce this issue using a similar structure to what you've described and so far haven't been able to.
Cheers,
Remco
Thanks for sharing this issue.
NCrunch relies on Gallio for its Xunit v1 integration. Gallio is quite old now and it predates the introduction of the PCL libraries - so it isn't really surprising that it is unable to make sense of metadata inside these libraries.
However, something that doesn't make sense to me is why this is happening for you in a project that is referencing the PCL project, rather than the PCL project itself. The failure is being caused by code intended to find tests within the output assembly, at a point where it attempts to parse assembly-level attributes inside the test project. Technically, this should have nothing to do with the PCL library at all - as an Xunit v1 test project by nature cannot be PCL. The only conclusion I can draw is that somehow NCrunch is trying to discover tests within the PCL assembly itself - which basically shouldn't happen.
Is there any chance you can construct and submit a sample solution that demonstrates this problem using the (- BROKEN LINK -)contact form[/url]? I've tried to reproduce this issue using a similar structure to what you've described and so far haven't been able to.
Cheers,
Remco
Hi Remco,
Thank you for your reply.
I got the issue while working on an open source testing framework called Chill. This commit still has the issue:
https://github.com/Erwinvandervalk/Chill/commit/b4ceddac0bef870b359cc25c7d05a141bc9f55e7
The project that's failing in NCrunch is Chill.Examples.Tests. In the latest 'development' branch, I've 'solved' the issue by referencing a non PCL version of Chill, but i'd like to avoid that if possible.
If you need more info or a more separate repro, I'd love to hear it.
best regards,
Erwin
Thank you for your reply.
I got the issue while working on an open source testing framework called Chill. This commit still has the issue:
https://github.com/Erwinvandervalk/Chill/commit/b4ceddac0bef870b359cc25c7d05a141bc9f55e7
The project that's failing in NCrunch is Chill.Examples.Tests. In the latest 'development' branch, I've 'solved' the issue by referencing a non PCL version of Chill, but i'd like to avoid that if possible.
If you need more info or a more separate repro, I'd love to hear it.
best regards,
Erwin
Remco NCrunch Developer
#6561
22 Oct 2014 10:48 UTC
Thanks Erwin. I'm having some trouble getting this commit to build on my machine. Is there any chance you could send through a simpler example?
Hi Remco,
Just submitted a repro on the contact form. I've found out where the issues lie...
I'm using an assembly level attribute from the PCL assembly, which causes the build to fail. If you use the attribute on class level it 'only' doesn't see the tests.
best regards,
Erwin
Just submitted a repro on the contact form. I've found out where the issues lie...
I'm using an assembly level attribute from the PCL assembly, which causes the build to fail. If you use the attribute on class level it 'only' doesn't see the tests.
best regards,
Erwin
Remco NCrunch Developer
#6563
22 Oct 2014 20:58 UTC
Great stuff - that makes perfect sense! I'm not sure if I have an easy path to fix this right now .. if you need the assembly level attribute to be applied outside of NCrunch but still want NCrunch to work, you can simply disable it with an override. For example:
#if !NCRUNCH
[assembly: MyAttributeValue("abc")]
#endif
#if !NCRUNCH
[assembly: MyAttributeValue("abc")]
#endif
Post a reply
Log in to reply.