Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot attach to WPF self-contained single file app #378

Open
okipol88 opened this issue Oct 24, 2022 · 8 comments
Open

Cannot attach to WPF self-contained single file app #378

okipol88 opened this issue Oct 24, 2022 · 8 comments

Comments

@okipol88
Copy link

Hello,

I have WPF self contained app. When I publish it and try to attach with snoop it fails.
I have created an example repository. Attaching from Visual Studio works in VS 2022 17.4 Preview 4.
Do you plan to add support for this soon?

You can find an example repository here: https://github.com/okipol88/WpfSelfContained
Publish configuration:
WpfSelcContained

@batzen batzen self-assigned this Oct 24, 2022
@batzen batzen added this to the 5.0 milestone Oct 24, 2022
@batzen batzen added the bug label Oct 24, 2022
@batzen
Copy link
Collaborator

batzen commented Oct 24, 2022

Can reproduce this and will fix it after my vacation.
Thanks for reporting.

@batzen
Copy link
Collaborator

batzen commented Nov 4, 2022

So, after some investigation this is not caused by self-contained, but by single-file combined with self-contained instead.

I will need some more time to find a solution for this as the dlls required to inject Snoop are not loaded as modules.

@batzen batzen changed the title Cannot attach to WPF self contained app Cannot attach to WPF self-contained single file app Nov 7, 2022
@batzen
Copy link
Collaborator

batzen commented Nov 7, 2022

I tried and investigated a lot, but it seems impossible, as of now, to attach to a single file self-contained app.
Even Visual Studio, at least on my machine, can't debug such an app.

I won't give up. But for now, will set my priorities on other problems till i might have a bright moment on how to solve this issue.

@batzen batzen removed this from the 5.0 milestone Nov 7, 2022
@okipol88
Copy link
Author

okipol88 commented Nov 9, 2022

@batzen I did encounter some issues with singlefilehost and attaching to release with PDB files ... etc
It is working in 17.4.0 Preview 4.0 ... Maybe you could check it out?

More info:

dotnet/runtime#76601

@okipol88
Copy link
Author

okipol88 commented Dec 14, 2022

Hey,

I just tested it while trying to leave a response here:

VS debugger break

It works :O.
Can you check on your side? I am wondering if this is a Windows/.NET security fix that carried it over or what.
My colleague also checked it on his laptop which suffered the same problem and as of now its gone.

If it works we could close this issue.

UPDATE:
Yeah so probably I got some dll copy pasted over or something.
Re-compiled and double checked. Snoop still cannot inject and "debug".

Issue still valid.

@batzen
Copy link
Collaborator

batzen commented May 13, 2023

NGen is for .NET Framework (.NET 4.5 etc.) and not for .NET (Core).
That's totally unrelated to this issue ;-)

@batzen
Copy link
Collaborator

batzen commented May 13, 2023

Single-file self-contained does not mean native.
AOT would be native.
But as WPF is not AOT friendly I never tried Snoop for that case. But I guess Snoop won't work for AOT compiled apps.

@Prodigio
Copy link

Prodigio commented Dec 7, 2023

Based on dotnet/wpf#8488 WPF should be trimmable now. I've read that they also implemented native AOT for WPF with .NET 8, if I recall correctly. But can't find the issue on GItHub right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants