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

How to debug/get more info about Sequence contains no matching element error? #112

Open
marceln opened this issue Mar 2, 2023 · 2 comments

Comments

@marceln
Copy link

marceln commented Mar 2, 2023

How could I get more info about which method/class is causing this exception:

Error		Fody: An unhandled exception occurred:
Exception:
Failed to execute weaver MethodBoundaryAspect.Fody.2.0.148\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 113
Source:
FodyIsolated
TargetSite:
Void ExecuteWeavers()
Sequence contains no matching element
Type:
System.InvalidOperationException
StackTrace:
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at MethodBoundaryAspect.Fody.InstructionBlockChainCreator.CreateMethodExecutionArgsInstance(NamedInstructionBlockChain argumentsArrayChain, TypeReference anyAspectTypeDefinition, MethodDefinition method, MethodInfoCompileTimeWeaver methodInfoCompileTimeWeaver)
   at MethodBoundaryAspect.Fody.MethodWeaver.WeaveMethodExecutionArgs(NamedInstructionBlockChain arguments)
   at MethodBoundaryAspect.Fody.MethodWeaver.Weave()
   at MethodBoundaryAspect.Fody.ModuleWeaver.WeaveMethod(ModuleDefinition module, MethodDefinition method, List`1 aspectInfos, MethodInfoCompileTimeWeaver methodInfoCompileTimeWeaver)
   at MethodBoundaryAspect.Fody.ModuleWeaver.WeaveType(ModuleDefinition module, TypeDefinition type, Collection`1 assemblyMethodBoundaryAspects)
   at MethodBoundaryAspect.Fody.ModuleWeaver.WeaveTypeAndNestedTypes(ModuleDefinition module, TypeDefinition type, Collection`1 assemblyMethodBoundaryAspects)
   at MethodBoundaryAspect.Fody.ModuleWeaver.Execute(ModuleDefinition module)
   at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 186
Source:
System.Core
TargetSite:
TSource Single[TSource](System.Collections.Generic.IEnumerable`1[TSource], System.Func`2[TSource,System.Boolean])	
@Ralf1108
Copy link
Collaborator

Ralf1108 commented Mar 2, 2023

On which scope did you apply the attribute ? Assembly, class or method?
Try to reduce the methods which are weaved by applying the attribute only on class level and then at method level one by one.

It would be good if you can narrow it down and show the C# Code which triggers this exception.

@Ralf1108
Copy link
Collaborator

Ralf1108 commented Mar 2, 2023

According to the stack trace in class "InstructionBlockChainCreator" there are on 2 "Single()" calls so it seems that somehow the "OnEntry" method in your aspect has an unexpected signature.

Can you also post your aspect class here? (method bodies are not important only the method headers)

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

2 participants