Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throwing "Failed to execute weaver" exception on 1 (out of 19) VB project #119

Open
BRR-LASERS opened this issue Aug 23, 2023 · 1 comment

Comments

@BRR-LASERS
Copy link

The project that is failing is the one where I implement the Attribute(s) that inherit from MethodBoundaryAspect.
All of the projects are VB, Framework 4.8.
When I do a rebuild solution (Visual Studio 2022), I get this exception:

Error: Fody: An unhandled exception occurred:
Exception:
Failed to execute weaver E:\LASERS\SOLARIS\Dev\SOLARIS\packages\MethodBoundaryAspect.Fody.2.0.149\build..\weaver\MethodBoundaryAspect.Fody.dll
Type:
System.Exception
StackTrace:
at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 222
at InnerWeaver.Execute() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 112
Source:
FodyIsolated
TargetSite:
Void ExecuteWeavers()
Object reference not set to an instance of an object.
Type:
System.NullReferenceException
StackTrace:
at MethodBoundaryAspect.Fody.ModuleWeaver.IsMethodBoundaryAspect(TypeDefinition attributeTypeDefinition)
at MethodBoundaryAspect.Fody.ModuleWeaver.IsMethodBoundaryAspect(CustomAttribute customAttribute)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at MethodBoundaryAspect.Fody.ModuleWeaver.WeaveType(ModuleDefinition module, TypeDefinition type, Collection1 assemblyMethodBoundaryAspects)
at MethodBoundaryAspect.Fody.ModuleWeaver.WeaveTypeAndNestedTypes(ModuleDefinition module, TypeDefinition type, Collection`1 assemblyMethodBoundaryAspects)
at MethodBoundaryAspect.Fody.ModuleWeaver.Execute(ModuleDefinition module)
at MethodBoundaryAspect.Fody.ModuleWeaver.Execute()
at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 186
Source:
MethodBoundaryAspect.Fody
TargetSite:
Boolean IsMethodBoundaryAspect(Mono.Cecil.TypeDefinition)

I immediately do a build and the project succeeds. I also have MethodTimer installed in that same project and it seems to be fine.
I have insured that the FodyWeavers.xml has the proper entries and that the (old style) project file has the vb references.

What am I missing?

@BRR-LASERS
Copy link
Author

After refactoring and moving the Attribute definitions to their own project AND giving that project an empty FodyWeavers.xml for that project AND correcting some obvious issues in the old format VBPROJ file for the one that's failing, now I'm getting the following:

Error: Fody: An unhandled exception occurred:
Exception:
Failed to execute weaver E:\LASERS\SOLARIS\Dev\SOLARIS\packages\MethodBoundaryAspect.Fody.2.0.149\build..\weaver\MethodBoundaryAspect.Fody.dll
Type:
System.Exception
StackTrace:
at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 222
at InnerWeaver.Execute() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 112
Source:
FodyIsolated
TargetSite:
Void ExecuteWeavers()
Unable to find variable reference for storage.
Type:
System.InvalidOperationException
StackTrace:
at MethodBoundaryAspect.Fody.CecilExtensions.GetLocalStoredByInstruction(Instruction i, Collection1 locals) at MethodBoundaryAspect.Fody.AsyncMethodWeaver.WeaveOnException(IList1 allAspects, Instruction instructionCallStart, Instruction instructionCallEnd, Instruction instructionAfterCall, IPersistable returnValue)
at MethodBoundaryAspect.Fody.MethodWeaver.Weave()
at MethodBoundaryAspect.Fody.ModuleWeaver.WeaveMethod(ModuleDefinition module, MethodDefinition method, List1 aspectInfos, MethodInfoCompileTimeWeaver methodInfoCompileTimeWeaver) at MethodBoundaryAspect.Fody.ModuleWeaver.WeaveType(ModuleDefinition module, TypeDefinition type, Collection1 assemblyMethodBoundaryAspects)
at MethodBoundaryAspect.Fody.ModuleWeaver.WeaveTypeAndNestedTypes(ModuleDefinition module, TypeDefinition type, Collection1 assemblyMethodBoundaryAspects) at MethodBoundaryAspect.Fody.ModuleWeaver.Execute(ModuleDefinition module) at MethodBoundaryAspect.Fody.ModuleWeaver.Execute() at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 186 Source: MethodBoundaryAspect.Fody TargetSite: Mono.Cecil.Cil.VariableDefinition GetLocalStoredByInstruction(Mono.Cecil.Cil.Instruction, Mono.Collections.Generic.Collection1[Mono.Cecil.Cil.VariableDefinition])

Same line numbers, but the message now says:
Unable to find variable reference for storage.

I'm kind of at wits end....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant