Browse Source
Merge pull request #3945 from AvaloniaUI/fixes/unwrap-designer-exception
Unwrap TargetInvocationExceptionin remote protocol.
pull/3948/head
danwalmsley
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
25 additions and
9 deletions
-
src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs
-
src/Avalonia.Remote.Protocol/DesignMessages.cs
|
|
|
@ -234,18 +234,10 @@ namespace Avalonia.DesignerSupport.Remote |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
var xmlException = e as XmlException; |
|
|
|
|
|
|
|
s_transport.Send(new UpdateXamlResultMessage |
|
|
|
{ |
|
|
|
Error = e.ToString(), |
|
|
|
Exception = new ExceptionDetails |
|
|
|
{ |
|
|
|
ExceptionType = e.GetType().FullName, |
|
|
|
Message = e.Message.ToString(), |
|
|
|
LineNumber = xmlException?.LineNumber, |
|
|
|
LinePosition = xmlException?.LinePosition, |
|
|
|
} |
|
|
|
Exception = new ExceptionDetails(e), |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,4 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.Reflection; |
|
|
|
using System.Runtime.ExceptionServices; |
|
|
|
using System.Xml; |
|
|
|
|
|
|
|
namespace Avalonia.Remote.Protocol.Designer |
|
|
|
{ |
|
|
|
@ -26,6 +29,27 @@ namespace Avalonia.Remote.Protocol.Designer |
|
|
|
|
|
|
|
public class ExceptionDetails |
|
|
|
{ |
|
|
|
public ExceptionDetails() |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
public ExceptionDetails(Exception e) |
|
|
|
{ |
|
|
|
if (e is TargetInvocationException) |
|
|
|
{ |
|
|
|
e = e.InnerException; |
|
|
|
} |
|
|
|
|
|
|
|
ExceptionType = e.GetType().Name; |
|
|
|
Message = e.Message; |
|
|
|
|
|
|
|
if (e is XmlException xml) |
|
|
|
{ |
|
|
|
LineNumber = xml.LineNumber; |
|
|
|
LinePosition = xml.LinePosition; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public string ExceptionType { get; set; } |
|
|
|
public string Message { get; set; } |
|
|
|
public int? LineNumber { get; set; } |
|
|
|
|