Open workgroupengineering opened 6 months ago
Likely, Cecil one is expected.
Sre is a mix of Type.AssemblyQualifiedName (for generics) and FullName for the main type name itself.
Also, anything that compatible with .NET TypeNameParser is a bonus: https://github.com/dotnet/runtime/issues/97566
Looks like it's an expected behavior for Type.FullName to return assembly qualified names for generics. For some reason. https://learn.microsoft.com/en-us/dotnet/api/system.type.assemblyqualifiedname?view=net-8.0
For your tests, you might want to use these extensions probably: https://github.com/kekekeks/XamlX/blob/941dafce490ffd21178f4493a7f0425e9d478e60/src/XamlX/TypeSystem/TypeSystem.cs#L341-L351
Unless our GetFullName extension is missing generics (which it might do).
What do you think if I normalized the Sre FullName like in Cecil instead of using an extension method?
I don't know if it will break anything. It would require double checking any FullName usage. Also, it's still not clear which variant is more standard.
Also, it's still not clear which variant is more standard.
there is no spec: https://github.com/dotnet/runtime/issues/97566#issuecomment-1921766972
in the future, more systems are likely to depend on TypeNameParser's behavior. @adamsitnik may able to clarify some confusion. cecil should probably switch to TNP for net9-and-above
cecil should probably switch to TNP for net9-and-above
The new TypeName
API is part of System.Reflection.Metadata
package, which supports older monikers too:
Looks like it's an expected behavior for Type.FullName to return assembly qualified names for generics
Yes, but only for the generic arguments.
> typeof(List<int>).FullName
"System.Collections.Generic.List`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]"
> typeof(List<int>).AssemblyQualifiedName
"System.Collections.Generic.List`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"
While devlop test for #112, i found inconsistency when i get FullName of GenericType.
Sre
Cecil
Which of both is the expected behavior?