ArchUnitNET icon indicating copy to clipboard operation
ArchUnitNET copied to clipboard

GetMethodMembers doesn't return correct names for generic methods

Open jlukawska opened this issue 6 months ago • 0 comments

When I try to find out if there are calls from the assembly code to the specific generic method, it doesn't work properly.

GetMethodMembers() method finds the method like: System.Threading.Tasks.Task`1<System.Int32> LinqToDB.LinqExtensions::UpdateAsync(LinqToDB.Linq.IUpdatable`1<T>,System.Threading.CancellationToken)<T>

and the calls in the architecture are expected to be like: System.Threading.Tasks.Task`1<System.Int32> LinqToDB.LinqExtensions::UpdateAsync(LinqToDB.Linq.IUpdatable`1<!!0>,System.Threading.CancellationToken)<!!0>

In the result, the method call is not found, even if the call exists.

See attached project. I've found two workarounds for this: one with use hardcoded full expected method name and one by using regular expression which is marked as deprecated.

ArchUnitNetGenericTypes.zip - there are 3 tests there and all should pass, but as you see, only the ones with mentioned workarounds pass and the one with GetMethodMembers fail.

jlukawska avatar Aug 03 '25 10:08 jlukawska