NickStrupat / NameOf

Provides strongly typed access to a compile-time string representing the name of a variable, field, property, method, event, enum, or type.
MIT License
20 stars 7 forks source link

Exception during weaving #1

Closed MovGP0 closed 9 years ago

MovGP0 commented 9 years ago

I get the following exception during a build in NameOf.Fody version 0.7.0:

Error   20  Fody: An unhandled exception occurred:
Exception:
Object reference not set to an instance of an object.
StackTrace:
   at NameOf.Fody.ModuleWeaver.<IsUsed>b__9(MethodDefinition x) in c:\Users\Nick\Documents\Visual Studio 2013\Projects\NameOf\NameOf.Fody\ModuleWeaver.cs:line 46
   at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at NameOf.Fody.ModuleWeaver.IsUsed(MethodDefinition methodDefinition) in c:\Users\Nick\Documents\Visual Studio 2013\Projects\NameOf\NameOf.Fody\ModuleWeaver.cs:line 46
   at NameOf.Fody.ModuleWeaver.<Execute>b__3(MethodDefinition x) in c:\Users\Nick\Documents\Visual Studio 2013\Projects\NameOf\NameOf.Fody\ModuleWeaver.cs:line 40
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at NameOf.Fody.ModuleWeaver.Execute() in c:\Users\Nick\Documents\Visual Studio 2013\Projects\NameOf\NameOf.Fody\ModuleWeaver.cs:line 40
   at lambda_method(Closure , Object )
   at InnerWeaver.ExecuteWeavers() in c:\ConsoleBuildAgent\work\ed448661dbb30d2e\FodyIsolated\InnerWeaver.cs:line 135
   at InnerWeaver.Execute() in c:\ConsoleBuildAgent\work\ed448661dbb30d2e\FodyIsolated\InnerWeaver.cs:line 53
Source:
NameOf.Fody
TargetSite:
System.Collections.Generic.IEnumerable`1[Mono.Cecil.Cil.Instruction] <IsUsed>b__9(Mono.Cecil.MethodDefinition)
    CN

currently, I am only using the Name.Of<InstanceClass>(x => x.Field); syntax

NickStrupat commented 9 years ago

Thanks for your help! I didn't catch that one in the unit tests.

NickStrupat commented 9 years ago

I forgot to tell you that I updated the NuGet package with the latest code including your work.

MovGP0 commented 9 years ago

Np. Thank you!