The problem was that the Bogus assembly did not exist - however this xmlns was not actually used in XAML and so the file still compiled OK in Visual Studio. (If it had been in use I believe VS would have flagged an error.) Because of that, it slips through to obfuscation later on.
Apparently when ConfuserEx finds the nonsense reference to Bogus it tries to load bogus.dll which it cannot find. This leads to a crash:
[ERROR] Failed to resolve an assembly, check if all dependencies are present in the correct version.
Exception: dnlib.DotNet.AssemblyResolveException: Could not resolve assembly: Bogus
at dnlib.DotNet.Extensions.ResolveThrow(IAssemblyResolver self, String asmFullName, ModuleDef sourceModule)
at Confuser.Renamer.BAML.BAMLAnalyzer.PopulateReferences(BamlDocument document)
at Confuser.Renamer.BAML.BAMLAnalyzer.Analyze(ModuleDefMD module, String bamlName, Byte[] data)
at Confuser.Renamer.Analyzers.WPFAnalyzer.AnalyzeResources(ConfuserContext context, INameService service, ModuleDefMD module)
at Confuser.Renamer.Analyzers.WPFAnalyzer.Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def)
at Confuser.Renamer.AnalyzePhase.Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, IDnlibDef def, Boolean runAnalyzer)
at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionParameters parameters)
at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action`1 func, Func`1 targets, ConfuserContext context)
at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context)
at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token)
Although the crash itself might be considered a bug, the root problem is bad XAML. So ideally it would be nice if ConfuserEx could handle this. But if not, at least this post may be a useful debugging signpost for others.
I had a C# DLL with a WPF XAML file that had a line like the following:
The problem was that the
Bogus
assembly did not exist - however this xmlns was not actually used in XAML and so the file still compiled OK in Visual Studio. (If it had been in use I believe VS would have flagged an error.) Because of that, it slips through to obfuscation later on.Apparently when ConfuserEx finds the nonsense reference to
Bogus
it tries to loadbogus.dll
which it cannot find. This leads to a crash:Although the crash itself might be considered a bug, the root problem is bad XAML. So ideally it would be nice if ConfuserEx could handle this. But if not, at least this post may be a useful debugging signpost for others.