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

Add stack trace to remote protocol ExceptionDetails #16857

Closed
codecat opened this issue Aug 29, 2024 · 5 comments
Closed

Add stack trace to remote protocol ExceptionDetails #16857

codecat opened this issue Aug 29, 2024 · 5 comments

Comments

@codecat
Copy link

codecat commented Aug 29, 2024

Is your feature request related to a problem? Please describe.

We currently don't get any stack trace in the Avalonia designer, meaning that problems are extremely hard to track down. For example, when the designer shows "Invalid markup" (see screenshot):

image

And the Avalonia Diagnostics output shows this:

23:00:59.004 [Information] 34320 Connection initialized
23:00:59.773 [Error] 34320 UpdateXamlResult error
System.Xaml.XamlException: Value cannot be null. (Parameter 'control')

It's practically impossible to know what really happened here without a stack trace.

Describe the solution you'd like

If we serialize the stack trace, we can display it in places where it matters.

I believe this commit should do the trick: codecat@607f31f

Then, we can make a change in AvaloniaVS to display the stack trace:

https://github.com/AvaloniaUI/AvaloniaVS/blob/3c210142a90d4a99f682c4df30ad8f6f03baca6f/AvaloniaVS.Shared/Services/PreviewerProcess.cs#L465

(I'm unsure how/if this would display in the Error List tab in AvaloniaVS, but that's probably an issue for that specific repository 😅)

As per contribution guidelines, I am opening an issue first, but I can have a PR ready to go. I assume it also needs some tests?

Describe alternatives you've considered

No response

Additional context

No response

@codecat
Copy link
Author

codecat commented Sep 30, 2024

Following up on this. Do you want a PR with the proposed solution?

@kekekeks
Copy link
Member

kekekeks commented Oct 1, 2024

s_transport.Send(new UpdateXamlResultMessage
{
Error = e.ToString(),
Exception = new ExceptionDetails(e),
});
seems to include the full exception details in Error field.

@kekekeks
Copy link
Member

kekekeks commented Oct 1, 2024

ExceptionDetails object was supposed to be there to indicate a particular line number and line position, not to swallow all the info.

@codecat
Copy link
Author

codecat commented Oct 1, 2024

I see, I must've missed that! In that case, the required change would just be in AvaloniaVS, here:

https://github.com/AvaloniaUI/AvaloniaVS/blob/3c210142a90d4a99f682c4df30ad8f6f03baca6f/AvaloniaVS.Shared/Services/PreviewerProcess.cs#L452-L468

update.Error is only used if update.Exception is null. Okay - I will make a PR there. 😊

@codecat codecat closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2024
@timunie
Copy link
Contributor

timunie commented Oct 1, 2024

Thx for your contribution @codecat 👍. This is indeed a very useful info.

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