MrAdvice icon indicating copy to clipboard operation
MrAdvice copied to clipboard

Runs twice on WPF projects

Open picrap opened this issue 7 years ago • 6 comments

On WPF projects, Mr. Advice is invoked twice. Is it good or not? Something to do with MarkupCompilePass1/MarkupCompilePass2?

picrap avatar Nov 21 '16 16:11 picrap

Interesting. I'm gonna follow this to see what you find out :). Seems like this could be related to XAML compilation? I wonder if you can specify attributes in XAML (not counting the partial class parts, just kinda curious if there's something for it since nothing comes to mind). I suspect it will be fine to run Mr. Advice once after it's all done, but not sure if there's a better post-build target to integrate with

TheXenocide avatar Nov 21 '16 17:11 TheXenocide

It may be not soon, because I have other priorities, which are moving to .NET Standard and then adding some "advice-reflection" (gathering dependencies of a method, dependencies being methods and fields).

picrap avatar Nov 21 '16 18:11 picrap

Runs twice and sometimes crashes once:

Internal error: System.IO.FileNotFoundException: Could not load file or assembly 'MrAdvice, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c0e7e6eab6f293d8' or one of its dependencies.
File name: 'MrAdvice, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c0e7e6eab6f293d8'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at ArxOne.MrAdvice.MrAdviceStitcher.Process(AssemblyStitcherContext context)

picrap avatar Dec 02 '16 13:12 picrap

Does it crash after the build has been cleaned? It might be that it doesn't copy dependencies until the second build? I think the first pass is probably to build the BAML resources from XAML which I don't think requires dependencies to be copied right away

TheXenocide avatar Dec 05 '16 17:12 TheXenocide

It used to crash sometimes, I've been working on it and did not see the bug lately. But this is a blurry fix 🤕

picrap avatar Dec 06 '16 09:12 picrap

WPF is weird :slightly_frowning_face:

TheXenocide avatar Dec 06 '16 16:12 TheXenocide