oleg-shilo / wixsharp

Framework for building a complete MSI or WiX source code by using script files written with C# syntax.
MIT License
1.12k stars 175 forks source link

Snoop support #1605

Closed Barrent closed 1 month ago

Barrent commented 3 months ago

Hi,

Is there any way to attach Snoop to an installer created with wixsharp? If I run an installer as is, launch snoop and open list of processes via snoop UI to attach, there is no installer listed.

oleg-shilo commented 3 months ago

If you are running WPF UI with your msi then yes you can attach Snoop. If WinForms, then of course no.

The trick is to find the right process to attach to. MSI does not make it easy. It runs every custom action as a separate process. And your debuger (Snoop) also needs to be elevated.

Have a look at this article for details: https://github.com/oleg-shilo/wixsharp/wiki/Tips'n'Tricks#debugging

I cannot be sure but you might be even better off just debugging your UI instead of snooping.

Barrent commented 3 months ago

Yes, that's definitely a wpf view. I'm able to hit breakpoints in c# code with visual studio, but Debug -> Windows -> Live Visual Tree remains empty.

oleg-shilo commented 3 months ago

It means that VS WPF visualizer cannot handle/reconstruct a visual tree for WPF runtime hosted in MSI process, or because it is hosted in the WinForm. May be because the process is elevated, or maybe because it's parent is a system service (msi service).

You may still try to attach snoop because you know for sure which process is hosting your WPF runtime. But the chances are that it will have the same difficulties as VS debugger. :(