lucaslorentz/minicover

Instrumenting assembly error

Alexkwang opened this issue · 2 comments

when run Instrumenting assembly there has throw following error.

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at MiniCover.Instrumentation.CustomAssemblyResolver.SearchDirectory(AssemblyNameReference name, IEnumerable1 directories, ReaderParameters parameters) at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters) at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name) at Mono.Cecil.MetadataResolver.Resolve(TypeReference type) at Mono.Cecil.Mixin.CheckedResolve(TypeReference self) at Mono.Cecil.MetadataBuilder.GetConstantType(TypeReference constant_type, Object constant) at Mono.Cecil.MetadataBuilder.AddConstant(IConstantProvider owner, TypeReference type) at Mono.Cecil.MetadataBuilder.AddParameter(UInt16 sequence, ParameterDefinition parameter, ParamTable table) at Mono.Cecil.MetadataBuilder.AddParameters(MethodDefinition method) at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method) at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type) at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type) at Mono.Cecil.MetadataBuilder.AddTypes() at Mono.Cecil.MetadataBuilder.BuildTypes() at Mono.Cecil.MetadataBuilder.BuildModule() at Mono.Cecil.MetadataBuilder.BuildMetadata() at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _) at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func3 read)
at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable1 stream, WriterParameters parameters) at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable1 stream, WriterParameters parameters)
at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
at MiniCover.Instrumentation.Instrumenter.InstrumentAssemblyIfNecessary(String assemblyFile)
at MiniCover.Instrumentation.Instrumenter.VisitAssemblyGroup(IEnumerable`1 assemblyFiles)
at MiniCover.Instrumentation.Instrumenter.Execute()
at MiniCover.Program.<>c__DisplayClass0_1.

b__4()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at MiniCover.Program.Main(String[] args)

update,
if we define method and it is a parameter type is enum and set a default value, we can reproduce this error.
public List demo_Search(demoQueryCriteria query, demoEnum? demoE = demoEnum.demo1)

Thanks @Alexkwang
I will try to reproduce and fix it