Browse Source

Supply more detailed exception details.

So we can display better errors in a designer.
pull/2307/head
Steven Kirk 7 years ago
parent
commit
c8363ddeb7
  1. 12
      src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs
  2. 8
      src/Avalonia.Remote.Protocol/DesignMessages.cs

12
src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs

@ -8,6 +8,7 @@ using Avalonia.Remote.Protocol;
using Avalonia.Remote.Protocol.Designer;
using Avalonia.Remote.Protocol.Viewport;
using Avalonia.Threading;
using Portable.Xaml;
namespace Avalonia.DesignerSupport.Remote
{
@ -204,9 +205,18 @@ namespace Avalonia.DesignerSupport.Remote
}
catch (Exception e)
{
var xamlException = e as XamlException;
s_transport.Send(new UpdateXamlResultMessage
{
Error = e.ToString()
Error = e.ToString(),
Exception = new ExceptionDetails
{
ExceptionType = e.GetType().FullName,
Message = e.Message.ToString(),
LineNumber = xamlException?.LineNumber,
LinePosition = xamlException?.LinePosition,
}
});
}
}

8
src/Avalonia.Remote.Protocol/DesignMessages.cs

@ -15,6 +15,7 @@ namespace Avalonia.Remote.Protocol.Designer
{
public string Error { get; set; }
public string Handle { get; set; }
public ExceptionDetails Exception { get; set; }
}
[AvaloniaRemoteMessageGuid("854887CF-2694-4EB6-B499-7461B6FB96C7")]
@ -23,4 +24,11 @@ namespace Avalonia.Remote.Protocol.Designer
public string SessionId { get; set; }
}
public class ExceptionDetails
{
public string ExceptionType { get; set; }
public string Message { get; set; }
public int? LineNumber { get; set; }
public int? LinePosition { get; set; }
}
}

Loading…
Cancel
Save