The type resolution fails with generic types properties used in XAML.
For example:
class MyGenericClass<T>
{
T Value { get; set; }
}
class MyDerivedClass : MyGenericClass<int>
{
}
And used in XAML:
<MyDerivedClass Value="15" />
Resolution of attribute Value will fail because the BAML analyzer tries to guess the returned type of the property Value using the Basic type of it's declaring class which is MyGenericClass'1 (it does not contain the generic argument type).
Here is the exception details:
Failed to resolve a type, check if all dependencies are of correct version.
Exception: dnlib.DotNet.TypeResolveException: Can't resolve a null pointer
at dnlib.DotNet.Extensions.ResolveTypeDefThrow(ITypeDefOrRef tdr) in d:\Open Source Projects\ConfuserEx\dnlib\src\DotNet\ICodedToken.cs:line 500
at Confuser.Renamer.BAML.BAMLAnalyzer.AnalyzeAttributeReference(TypeDef declType, AttributeInfoRecord rec) in d:\Open Source Projects\ConfuserEx\Confuser.Renamer\BAML\BAMLAnalyzer.cs:line 513
at Confuser.Renamer.BAML.BAMLAnalyzer.PopulateReferences(BamlDocument document) in d:\Open Source Projects\ConfuserEx\Confuser.Renamer\BAML\BAMLAnalyzer.cs:line 149
at Confuser.Renamer.BAML.BAMLAnalyzer.Analyze(ModuleDefMD module, String bamlName, Byte[] data) in d:\Open Source Projects\ConfuserEx\Confuser.Renamer\BAML\BAMLAnalyzer.cs:line 79
at Confuser.Renamer.Analyzers.WPFAnalyzer.AnalyzeResources(ConfuserContext context, INameService service, ModuleDefMD module) in d:\Open Source Projects\ConfuserEx\Confuser.Renamer\Analyzers\WPFAnalyzer.cs:line 234
at Confuser.Renamer.Analyzers.WPFAnalyzer.Analyze(ConfuserContext context, INameService service, IDnlibDef def) in d:\Open Source Projects\ConfuserEx\Confuser.Renamer\Analyzers\WPFAnalyzer.cs:line 33
at Confuser.Renamer.AnalyzePhase.Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, IDnlibDef def, Boolean runAnalyzer) in d:\Open Source Projects\ConfuserEx\Confuser.Renamer\AnalyzePhase.cs:line 77
at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionParameters parameters) in d:\Open Source Projects\ConfuserEx\Confuser.Renamer\AnalyzePhase.cs:line 54
at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action`1 func, Func`1 targets, ConfuserContext context) in d:\Open Source Projects\ConfuserEx\Confuser.Core\ProtectionPipeline.cs:line 141
at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context) in d:\Open Source Projects\ConfuserEx\Confuser.Core\ConfuserEngine.cs:line 206
at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) in d:\Open Source Projects\ConfuserEx\Confuser.Core\ConfuserEngine.cs:line 160
The type resolution fails with generic types properties used in XAML.
For example:
And used in XAML:
Resolution of attribute
Value
will fail because the BAML analyzer tries to guess the returned type of the property Value using the Basic type of it's declaring class which isMyGenericClass'1
(it does not contain the generic argument type).Here is the exception details: