Rank: Member
Groups: Registered
Joined: 4/3/2014(UTC) Posts: 10 Location: United States of America
Thanks: 3 times Was thanked: 2 time(s) in 2 post(s)
|
NCrunch is reporting an analysis failure with a NPE in the constructor of an attribute. Below is the stack trace. Because of this no tests are run. Do attributes need to be handled differently? There is no error in the attribute itself. The project builds and I have used the attribute successfully. Stack TraceCode:
An error occurred while analysing this project after it was built: System.NullReferenceException: Object reference not set to an instance of an object.
at eSante.DataGenerator.Core.Identities.IdentityAttribute..ctor(Type identityType) in D:\FoxSystems\Arms2\TestData\eSante.DataGenerator\eSante.DataGenerator.Core\eSante.DataGenerator.Core\Identities\IdentityAttribute.cs:line 16
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.Module.NUnit.Integration.NUnitDynamicTestFinder.FindFrameworkTestsUsingRuntimeInvoke(TestPackage package, ILogger logger, List`1 tests, Factory testNameFactory)
at nCrunch.Module.NUnit.Integration.NUnitTestFramework.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName)
at nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, TestFrameworkDescription[] frameworks, ComponentUniqueName testComponentUniqueName)
at nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(TestFrameworkDescription[] applicableFrameworks, ComponentUniqueName testComponentUniqueName)
Class causing issuesCode:
public class IdentityAttribute : Attribute
{
public IdentityAttribute( Type identityType )
{
var identity = (Identity)(Assembly.GetExecutingAssembly().CreateInstance( identityType.FullName ));
this.Identifier = identity.Identifier; // Line 16, error here
this.Name = identity.Name;
this.Description = identity.Description;
}
public string Identifier { get; private set; }
public string Name { get; private set; }
public string Description { get; private set; }
}
|