-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
28 lines (28 loc) · 936 Bytes
/
Program.cs
File metadata and controls
28 lines (28 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
try
{
// Load(stream) / Load(xmlReader) / LoadBaml(...)
var root = System.Windows.Markup.XamlReader.Load(yourXmlReaderOrStream);
}
catch (System.Windows.Markup.XamlParseException xpe)
{
Console.WriteLine($"XamlParseException: {xpe.Message}");
Console.WriteLine($"Line: {xpe.LineNumber}, Pos: {xpe.LinePosition}");
Console.WriteLine($"BaseUri: {xpe.BaseUri}");
Exception inner = xpe.InnerException ?? xpe;
int depth = 0;
while (inner != null)
{
Console.WriteLine(new string('-', 40));
Console.WriteLine($"[{depth}] {inner.GetType().FullName}: {inner.Message}");
Console.WriteLine(inner.StackTrace);
inner = inner.InnerException;
depth++;
}
throw; // 未处理的异常
}
catch (Exception ex)
{
Console.WriteLine($"Other Exception: {ex.GetType().FullName}: {ex.Message}");
Console.WriteLine(ex.StackTrace);
throw;
}