Closed AliveDevil closed 2 years ago
After further analysis:
currentMixinAttribute.ConstructorArguments[0]
is of type CodeAnalysis.TypedConstant
^1, cast to INamedTypeSymbol
is successful.
updatedImplementationSymbol
is assigned null
, due to compilation.GetTypeByMetadataName
. ^2
typeParameterMappings
is length 0.
Assigning null (updatedImplementationSymbol)
to implementationSymbol
results in NullRef in foreach^3.
Found a clue here: https://github.com/LokiMidgard/PartialMixins/blob/b835668306da09acc0a553a24593241a17e3403c/PartialMixins/PartialMixin.cs#L238-L243
This^1 needs to either call GetFullQualifiedName(implementationSymbol, true)
or GetName requires different logic.
Currently logic results in creating a type name of name (ns).Fully.Qualified.TypeName
, which resolves to something like Some.Namespace.Some.Namespace.Type
.
Thanks fro the analysis, It will propably be some days before I can look at this. But if you want feel free to create a Pull Request.
VS 2022 (17.3.1)
. I got the same error, but the compiler instead complained about #13. Digging around in the generated code, I found this:
Error_mixins.cs
#error System.NullReferenceException: Object reference not set to an instance of an object.
#error at PartialMixins.PartialMixin.ExecuteInternal(GeneratorExecutionContext context)
#error at PartialMixins.PartialMixin.Execute(GeneratorExecutionContext context)
#error
Did you guys find a solution?
No, I stopped trying to get mixin code at all in C#.
Thank you @AliveDevil for your analysis.
It helped.
Getting a Error_mixins.cs for this project^1 with a NullReference.
dotnet build output: