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

"Sequence contains no matching element" when building the Architecture #280

Open
Optano-Dev opened this issue Aug 2, 2024 · 0 comments
Open

Comments

@Optano-Dev
Copy link

Problem Description
In AddMethodDependencies.HandleIterator(), the first found instruction with new object op code is an ArgumentNullException. The TypeDefinition of the declaring type does not have a method named "MoveNext", which causes an InvalidOperationException since First() does not find a matching method definition.

Possible Cause
Usage of JetBrains.Annotations.NotNullAttribute in the method associated with the method body.

Possible Fix (?)
Find the first instruction with new object op code which at the same time is not an exception.

Stack Trace

System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at ArchUnitNET.Loader.LoadTasks.AddMethodDependencies.HandleIterator(MethodDefinition& methodDefinition, MethodBody& methodBody, List`1 bodyTypes, ICollection`1 visitedMethodReferences)
   at ArchUnitNET.Loader.LoadTasks.AddMethodDependencies.CreateMethodBodyDependencies(MethodDefinition methodDefinition, MethodMember methodMember)+MoveNext()
   at System.Linq.Enumerable.ConcatIterator`1.MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
   at ArchUnitNET.Loader.LoadTasks.AddMethodDependencies.<>c.<Execute>b__4_3(ValueTuple`2 tuple)
   at ArchUnitNET.Domain.Extensions.EnumerableExtensions.ForEach[T](IEnumerable`1 source, Action`1[] actions)
   at ArchUnitNET.Loader.LoadTasks.AddMethodDependencies.Execute()
   at ArchUnitNET.Loader.LoadTaskRegistry.<ExecuteTasks>b__1_1(Type taskKey)
   at ArchUnitNET.Domain.Extensions.EnumerableExtensions.ForEach[T](IEnumerable`1 source, Action`1[] actions)
   at ArchUnitNET.Loader.LoadTaskRegistry.ExecuteTasks(List`1 taskOrder)
   at ArchUnitNET.Loader.ArchBuilder.UpdateTypeDefinitions()
   at ArchUnitNET.Loader.ArchBuilder.Build()
   at ArchUnitNET.Loader.ArchLoader.Build()

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