2 using System.ComponentModel;
3 using System.Diagnostics;
7 namespace Tizen.NUI.Xaml
9 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
10 [EditorBrowsable(EditorBrowsableState.Never)]
11 public class XamlParseException : Exception
13 readonly string _unformattedMessage;
15 static private StringBuilder GetStackInfo()
17 StringBuilder ret = new StringBuilder("\nStack:\n");
19 StackTrace st = new StackTrace();
21 for (int i = 2; i < st.FrameCount; i++)
23 StackFrame sf = st.GetFrame(i);
24 ret.AppendFormat("File:{0}, Method:{1}, Line:{2}\n", sf.GetFileName(), sf.GetMethod().Name, sf.GetFileLineNumber());
30 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
31 [EditorBrowsable(EditorBrowsableState.Never)]
32 public XamlParseException(string message, IXmlLineInfo xmlInfo, Exception innerException = null) : base(FormatMessage(message + GetStackInfo(), xmlInfo), innerException)
34 _unformattedMessage = message;
38 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
39 [EditorBrowsable(EditorBrowsableState.Never)]
40 public IXmlLineInfo XmlInfo { get; private set; }
42 internal string UnformattedMessage
44 get { return _unformattedMessage ?? Message; }
47 static string FormatMessage(string message, IXmlLineInfo xmlinfo)
49 if (xmlinfo == null || !xmlinfo.HasLineInfo())
51 return string.Format("Position {0}:{1}. {2}", xmlinfo.LineNumber, xmlinfo.LinePosition, message);