@nativescript/windows 0.1.0-alpha.30 → 0.1.0-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/framework/__PROJECT_NAME__/CrashDiagnostics.cs +249 -249
- package/framework/libs/arm64/nativescript.dll +0 -0
- package/framework/libs/devtools/arm64/nativescript.dll +0 -0
- package/framework/libs/devtools/x64/nativescript.dll +0 -0
- package/framework/libs/x64/nativescript.dll +0 -0
- package/package.json +19 -19
|
@@ -1,249 +1,249 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using System.IO;
|
|
3
|
-
using System.Text;
|
|
4
|
-
using System.Text.RegularExpressions;
|
|
5
|
-
using System.Threading.Tasks;
|
|
6
|
-
using Windows.ApplicationModel.Core;
|
|
7
|
-
using Windows.ApplicationModel.DataTransfer;
|
|
8
|
-
using Windows.Storage;
|
|
9
|
-
using Windows.System;
|
|
10
|
-
using Windows.UI.Popups;
|
|
11
|
-
|
|
12
|
-
namespace __PROJECT_NAME__
|
|
13
|
-
{
|
|
14
|
-
internal static class CrashDiagnostics
|
|
15
|
-
{
|
|
16
|
-
private static bool _installed;
|
|
17
|
-
|
|
18
|
-
public static void InstallGlobalHandlers()
|
|
19
|
-
{
|
|
20
|
-
if (_installed) return;
|
|
21
|
-
_installed = true;
|
|
22
|
-
|
|
23
|
-
AppDomain.CurrentDomain.UnhandledException += (_, args) =>
|
|
24
|
-
{
|
|
25
|
-
var ex = args.ExceptionObject as Exception;
|
|
26
|
-
WriteExceptionReport("AppDomain.UnhandledException", ex, "IsTerminating=" + args.IsTerminating);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
TaskScheduler.UnobservedTaskException += (_, args) =>
|
|
30
|
-
{
|
|
31
|
-
WriteExceptionReport("TaskScheduler.UnobservedTaskException", args.Exception, null);
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public static void WriteExceptionReport(string source, Exception ex, string details)
|
|
36
|
-
{
|
|
37
|
-
var sb = new StringBuilder();
|
|
38
|
-
sb.AppendLine("============================================================");
|
|
39
|
-
sb.AppendLine("Timestamp: " + DateTimeOffset.UtcNow.ToString("o"));
|
|
40
|
-
sb.AppendLine("Source: " + source);
|
|
41
|
-
if (!string.IsNullOrWhiteSpace(details)) sb.AppendLine("Details: " + details);
|
|
42
|
-
if (ex != null) { sb.AppendLine("Exception:"); sb.AppendLine(ex.ToString()); }
|
|
43
|
-
else sb.AppendLine("Exception: <null>");
|
|
44
|
-
sb.AppendLine("Managed stack snapshot:");
|
|
45
|
-
sb.AppendLine(Environment.StackTrace);
|
|
46
|
-
sb.AppendLine();
|
|
47
|
-
AppendToLog(sb.ToString());
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public static void WriteMessage(string source, string message)
|
|
51
|
-
{
|
|
52
|
-
var sb = new StringBuilder();
|
|
53
|
-
sb.AppendLine("============================================================");
|
|
54
|
-
sb.AppendLine("Timestamp: " + DateTimeOffset.UtcNow.ToString("o"));
|
|
55
|
-
sb.AppendLine("Source: " + source);
|
|
56
|
-
sb.AppendLine("Message: " + message);
|
|
57
|
-
sb.AppendLine();
|
|
58
|
-
AppendToLog(sb.ToString());
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public static string BuildErrorReport(Exception ex, string jsError = null, string extraDetails = null)
|
|
62
|
-
{
|
|
63
|
-
var sb = new StringBuilder();
|
|
64
|
-
|
|
65
|
-
if (!string.IsNullOrWhiteSpace(jsError))
|
|
66
|
-
{
|
|
67
|
-
sb.AppendLine("── JavaScript Error ──────────────────────────────────────");
|
|
68
|
-
sb.AppendLine(jsError.Trim());
|
|
69
|
-
sb.AppendLine();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (ex != null)
|
|
73
|
-
{
|
|
74
|
-
sb.AppendLine("── Native Exception ──────────────────────────────────────");
|
|
75
|
-
sb.AppendLine(ex.GetType().Name + ": " + ex.Message);
|
|
76
|
-
if (ex.StackTrace != null) sb.AppendLine(ex.StackTrace);
|
|
77
|
-
var inner = ex.InnerException;
|
|
78
|
-
while (inner != null)
|
|
79
|
-
{
|
|
80
|
-
sb.AppendLine("Caused by: " + inner.GetType().Name + ": " + inner.Message);
|
|
81
|
-
if (inner.StackTrace != null) sb.AppendLine(inner.StackTrace);
|
|
82
|
-
inner = inner.InnerException;
|
|
83
|
-
}
|
|
84
|
-
sb.AppendLine();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Include panic log from previous or current run
|
|
88
|
-
try
|
|
89
|
-
{
|
|
90
|
-
var panicLog = Path.Combine(ApplicationData.Current.LocalFolder.Path, "nativescript-panic.log");
|
|
91
|
-
if (File.Exists(panicLog))
|
|
92
|
-
{
|
|
93
|
-
var content = File.ReadAllText(panicLog, Encoding.UTF8).Trim();
|
|
94
|
-
if (!string.IsNullOrEmpty(content))
|
|
95
|
-
{
|
|
96
|
-
sb.AppendLine("── Rust Panic Log ────────────────────────────────────────");
|
|
97
|
-
sb.AppendLine(content);
|
|
98
|
-
sb.AppendLine();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
catch { }
|
|
103
|
-
|
|
104
|
-
if (!string.IsNullOrWhiteSpace(extraDetails))
|
|
105
|
-
{
|
|
106
|
-
sb.AppendLine("── Additional Info ───────────────────────────────────────");
|
|
107
|
-
sb.AppendLine(extraDetails);
|
|
108
|
-
sb.AppendLine();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
sb.AppendLine("──────────────────────────────────────────────────────────");
|
|
112
|
-
sb.AppendLine("Timestamp: " + DateTimeOffset.UtcNow.ToString("o"));
|
|
113
|
-
|
|
114
|
-
return sb.ToString();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
public static string CrashLogPath()
|
|
118
|
-
{
|
|
119
|
-
try { return Path.Combine(ApplicationData.Current.LocalFolder.Path, "nativescript-crash.log"); }
|
|
120
|
-
catch { return null; }
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/// Parses the first "path:line:col" source location from a JS stack trace.
|
|
124
|
-
/// Returns null if none found. Handles Windows drive-letter paths (C:\...).
|
|
125
|
-
public static (string file, int line, int col)? TryExtractSourceLocation(string errorReport)
|
|
126
|
-
{
|
|
127
|
-
if (string.IsNullOrEmpty(errorReport)) return null;
|
|
128
|
-
|
|
129
|
-
// Match the contents of the first (path:line:col) group in the stack trace.
|
|
130
|
-
var m = Regex.Match(errorReport, @"\(([^)]+)\)");
|
|
131
|
-
if (!m.Success) return null;
|
|
132
|
-
|
|
133
|
-
var inner = m.Groups[1].Value; // e.g. "C:\app\bundle.js:42:13"
|
|
134
|
-
|
|
135
|
-
// Parse col from the right (last :digits).
|
|
136
|
-
var lastColon = inner.LastIndexOf(':');
|
|
137
|
-
if (lastColon < 0 || !int.TryParse(inner.Substring(lastColon + 1), out int col)) return null;
|
|
138
|
-
inner = inner.Substring(0, lastColon);
|
|
139
|
-
|
|
140
|
-
// Parse line from the right (second-to-last :digits).
|
|
141
|
-
lastColon = inner.LastIndexOf(':');
|
|
142
|
-
if (lastColon < 0 || !int.TryParse(inner.Substring(lastColon + 1), out int line)) return null;
|
|
143
|
-
var file = inner.Substring(0, lastColon);
|
|
144
|
-
|
|
145
|
-
return string.IsNullOrEmpty(file) ? null : (file, line, col);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
public static async Task ShowCrashDialogAsync(string heading, string errorReport)
|
|
149
|
-
{
|
|
150
|
-
try
|
|
151
|
-
{
|
|
152
|
-
// Write full details to log so developer can access them even if the
|
|
153
|
-
// dialog summary is truncated.
|
|
154
|
-
var logPath = CrashLogPath();
|
|
155
|
-
if (logPath != null)
|
|
156
|
-
File.WriteAllText(logPath, errorReport, Encoding.UTF8);
|
|
157
|
-
|
|
158
|
-
// Truncate for the dialog (MessageDialog has practical limits).
|
|
159
|
-
const int MaxLen = 800;
|
|
160
|
-
var summary = errorReport.Length > MaxLen
|
|
161
|
-
? errorReport.Substring(0, MaxLen) + "\n\n[truncated — see log for full details]"
|
|
162
|
-
: errorReport;
|
|
163
|
-
|
|
164
|
-
if (logPath != null)
|
|
165
|
-
summary += "\n\nFull log: " + logPath;
|
|
166
|
-
|
|
167
|
-
var dialog = new MessageDialog(summary, "NativeScript Runtime Error");
|
|
168
|
-
|
|
169
|
-
// MessageDialog supports at most 3 commands. When a source location is
|
|
170
|
-
// available, swap "Copy Details" for "Open in VS Code" so the user can
|
|
171
|
-
// choose between jumping to the error or restarting. Full details are
|
|
172
|
-
// always written to the log file shown in the dialog text.
|
|
173
|
-
var srcLocation = TryExtractSourceLocation(errorReport);
|
|
174
|
-
if (srcLocation.HasValue)
|
|
175
|
-
{
|
|
176
|
-
var (srcFile, srcLine, srcCol) = srcLocation.Value;
|
|
177
|
-
dialog.Commands.Add(new UICommand("Open Source File", async _ =>
|
|
178
|
-
{
|
|
179
|
-
try
|
|
180
|
-
{
|
|
181
|
-
var normalizedPath = srcFile.Replace('\\', '/');
|
|
182
|
-
var uriStr = $"file:///{normalizedPath}";
|
|
183
|
-
if (Uri.TryCreate(uriStr, UriKind.Absolute, out var fileUri))
|
|
184
|
-
await Launcher.LaunchUriAsync(fileUri,
|
|
185
|
-
new LauncherOptions { DisplayApplicationPicker = true });
|
|
186
|
-
}
|
|
187
|
-
catch { }
|
|
188
|
-
}));
|
|
189
|
-
}
|
|
190
|
-
else
|
|
191
|
-
{
|
|
192
|
-
dialog.Commands.Add(new UICommand("Copy Details", _ =>
|
|
193
|
-
{
|
|
194
|
-
try
|
|
195
|
-
{
|
|
196
|
-
var dp = new DataPackage();
|
|
197
|
-
dp.SetText(errorReport);
|
|
198
|
-
Clipboard.SetContent(dp);
|
|
199
|
-
}
|
|
200
|
-
catch { }
|
|
201
|
-
}));
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
dialog.Commands.Add(new UICommand("Restart App", async _ =>
|
|
205
|
-
{
|
|
206
|
-
try { await CoreApplication.RequestRestartAsync("crash-restart"); }
|
|
207
|
-
catch { }
|
|
208
|
-
}));
|
|
209
|
-
|
|
210
|
-
dialog.Commands.Add(new UICommand("Dismiss"));
|
|
211
|
-
dialog.DefaultCommandIndex = 0;
|
|
212
|
-
dialog.CancelCommandIndex = 2;
|
|
213
|
-
|
|
214
|
-
await dialog.ShowAsync();
|
|
215
|
-
}
|
|
216
|
-
catch (Exception ex)
|
|
217
|
-
{
|
|
218
|
-
System.Diagnostics.Debug.WriteLine("[NativeScript] Failed to show crash dialog: " + ex.Message);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/// <summary>
|
|
223
|
-
/// Appends <paramref name="message"/> to ns_trace.log using the Win32 temp path.
|
|
224
|
-
/// Inside UWP, GetTempPath() virtualises to AC\Temp — the same folder Rust's
|
|
225
|
-
/// std::env::temp_dir() uses — so this write appears in the CLI's log stream.
|
|
226
|
-
/// </summary>
|
|
227
|
-
public static void WriteToTraceLog(string message)
|
|
228
|
-
{
|
|
229
|
-
try
|
|
230
|
-
{
|
|
231
|
-
// System.IO.Path.GetTempPath() calls Win32 GetTempPathW() which inside a
|
|
232
|
-
// UWP process returns the container's AC\Temp folder, matching Rust.
|
|
233
|
-
var tracePath = Path.Combine(System.IO.Path.GetTempPath(), "ns_trace.log");
|
|
234
|
-
File.AppendAllText(tracePath, message, Encoding.UTF8);
|
|
235
|
-
}
|
|
236
|
-
catch { }
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
private static void AppendToLog(string content)
|
|
240
|
-
{
|
|
241
|
-
try
|
|
242
|
-
{
|
|
243
|
-
var logPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "nativescript-crash.log");
|
|
244
|
-
File.AppendAllText(logPath, content, Encoding.UTF8);
|
|
245
|
-
}
|
|
246
|
-
catch { }
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
1
|
+
using System;
|
|
2
|
+
using System.IO;
|
|
3
|
+
using System.Text;
|
|
4
|
+
using System.Text.RegularExpressions;
|
|
5
|
+
using System.Threading.Tasks;
|
|
6
|
+
using Windows.ApplicationModel.Core;
|
|
7
|
+
using Windows.ApplicationModel.DataTransfer;
|
|
8
|
+
using Windows.Storage;
|
|
9
|
+
using Windows.System;
|
|
10
|
+
using Windows.UI.Popups;
|
|
11
|
+
|
|
12
|
+
namespace __PROJECT_NAME__
|
|
13
|
+
{
|
|
14
|
+
internal static class CrashDiagnostics
|
|
15
|
+
{
|
|
16
|
+
private static bool _installed;
|
|
17
|
+
|
|
18
|
+
public static void InstallGlobalHandlers()
|
|
19
|
+
{
|
|
20
|
+
if (_installed) return;
|
|
21
|
+
_installed = true;
|
|
22
|
+
|
|
23
|
+
AppDomain.CurrentDomain.UnhandledException += (_, args) =>
|
|
24
|
+
{
|
|
25
|
+
var ex = args.ExceptionObject as Exception;
|
|
26
|
+
WriteExceptionReport("AppDomain.UnhandledException", ex, "IsTerminating=" + args.IsTerminating);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
TaskScheduler.UnobservedTaskException += (_, args) =>
|
|
30
|
+
{
|
|
31
|
+
WriteExceptionReport("TaskScheduler.UnobservedTaskException", args.Exception, null);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static void WriteExceptionReport(string source, Exception ex, string details)
|
|
36
|
+
{
|
|
37
|
+
var sb = new StringBuilder();
|
|
38
|
+
sb.AppendLine("============================================================");
|
|
39
|
+
sb.AppendLine("Timestamp: " + DateTimeOffset.UtcNow.ToString("o"));
|
|
40
|
+
sb.AppendLine("Source: " + source);
|
|
41
|
+
if (!string.IsNullOrWhiteSpace(details)) sb.AppendLine("Details: " + details);
|
|
42
|
+
if (ex != null) { sb.AppendLine("Exception:"); sb.AppendLine(ex.ToString()); }
|
|
43
|
+
else sb.AppendLine("Exception: <null>");
|
|
44
|
+
sb.AppendLine("Managed stack snapshot:");
|
|
45
|
+
sb.AppendLine(Environment.StackTrace);
|
|
46
|
+
sb.AppendLine();
|
|
47
|
+
AppendToLog(sb.ToString());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public static void WriteMessage(string source, string message)
|
|
51
|
+
{
|
|
52
|
+
var sb = new StringBuilder();
|
|
53
|
+
sb.AppendLine("============================================================");
|
|
54
|
+
sb.AppendLine("Timestamp: " + DateTimeOffset.UtcNow.ToString("o"));
|
|
55
|
+
sb.AppendLine("Source: " + source);
|
|
56
|
+
sb.AppendLine("Message: " + message);
|
|
57
|
+
sb.AppendLine();
|
|
58
|
+
AppendToLog(sb.ToString());
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public static string BuildErrorReport(Exception ex, string jsError = null, string extraDetails = null)
|
|
62
|
+
{
|
|
63
|
+
var sb = new StringBuilder();
|
|
64
|
+
|
|
65
|
+
if (!string.IsNullOrWhiteSpace(jsError))
|
|
66
|
+
{
|
|
67
|
+
sb.AppendLine("── JavaScript Error ──────────────────────────────────────");
|
|
68
|
+
sb.AppendLine(jsError.Trim());
|
|
69
|
+
sb.AppendLine();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (ex != null)
|
|
73
|
+
{
|
|
74
|
+
sb.AppendLine("── Native Exception ──────────────────────────────────────");
|
|
75
|
+
sb.AppendLine(ex.GetType().Name + ": " + ex.Message);
|
|
76
|
+
if (ex.StackTrace != null) sb.AppendLine(ex.StackTrace);
|
|
77
|
+
var inner = ex.InnerException;
|
|
78
|
+
while (inner != null)
|
|
79
|
+
{
|
|
80
|
+
sb.AppendLine("Caused by: " + inner.GetType().Name + ": " + inner.Message);
|
|
81
|
+
if (inner.StackTrace != null) sb.AppendLine(inner.StackTrace);
|
|
82
|
+
inner = inner.InnerException;
|
|
83
|
+
}
|
|
84
|
+
sb.AppendLine();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Include panic log from previous or current run
|
|
88
|
+
try
|
|
89
|
+
{
|
|
90
|
+
var panicLog = Path.Combine(ApplicationData.Current.LocalFolder.Path, "nativescript-panic.log");
|
|
91
|
+
if (File.Exists(panicLog))
|
|
92
|
+
{
|
|
93
|
+
var content = File.ReadAllText(panicLog, Encoding.UTF8).Trim();
|
|
94
|
+
if (!string.IsNullOrEmpty(content))
|
|
95
|
+
{
|
|
96
|
+
sb.AppendLine("── Rust Panic Log ────────────────────────────────────────");
|
|
97
|
+
sb.AppendLine(content);
|
|
98
|
+
sb.AppendLine();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch { }
|
|
103
|
+
|
|
104
|
+
if (!string.IsNullOrWhiteSpace(extraDetails))
|
|
105
|
+
{
|
|
106
|
+
sb.AppendLine("── Additional Info ───────────────────────────────────────");
|
|
107
|
+
sb.AppendLine(extraDetails);
|
|
108
|
+
sb.AppendLine();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
sb.AppendLine("──────────────────────────────────────────────────────────");
|
|
112
|
+
sb.AppendLine("Timestamp: " + DateTimeOffset.UtcNow.ToString("o"));
|
|
113
|
+
|
|
114
|
+
return sb.ToString();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public static string CrashLogPath()
|
|
118
|
+
{
|
|
119
|
+
try { return Path.Combine(ApplicationData.Current.LocalFolder.Path, "nativescript-crash.log"); }
|
|
120
|
+
catch { return null; }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// Parses the first "path:line:col" source location from a JS stack trace.
|
|
124
|
+
/// Returns null if none found. Handles Windows drive-letter paths (C:\...).
|
|
125
|
+
public static (string file, int line, int col)? TryExtractSourceLocation(string errorReport)
|
|
126
|
+
{
|
|
127
|
+
if (string.IsNullOrEmpty(errorReport)) return null;
|
|
128
|
+
|
|
129
|
+
// Match the contents of the first (path:line:col) group in the stack trace.
|
|
130
|
+
var m = Regex.Match(errorReport, @"\(([^)]+)\)");
|
|
131
|
+
if (!m.Success) return null;
|
|
132
|
+
|
|
133
|
+
var inner = m.Groups[1].Value; // e.g. "C:\app\bundle.js:42:13"
|
|
134
|
+
|
|
135
|
+
// Parse col from the right (last :digits).
|
|
136
|
+
var lastColon = inner.LastIndexOf(':');
|
|
137
|
+
if (lastColon < 0 || !int.TryParse(inner.Substring(lastColon + 1), out int col)) return null;
|
|
138
|
+
inner = inner.Substring(0, lastColon);
|
|
139
|
+
|
|
140
|
+
// Parse line from the right (second-to-last :digits).
|
|
141
|
+
lastColon = inner.LastIndexOf(':');
|
|
142
|
+
if (lastColon < 0 || !int.TryParse(inner.Substring(lastColon + 1), out int line)) return null;
|
|
143
|
+
var file = inner.Substring(0, lastColon);
|
|
144
|
+
|
|
145
|
+
return string.IsNullOrEmpty(file) ? null : (file, line, col);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public static async Task ShowCrashDialogAsync(string heading, string errorReport)
|
|
149
|
+
{
|
|
150
|
+
try
|
|
151
|
+
{
|
|
152
|
+
// Write full details to log so developer can access them even if the
|
|
153
|
+
// dialog summary is truncated.
|
|
154
|
+
var logPath = CrashLogPath();
|
|
155
|
+
if (logPath != null)
|
|
156
|
+
File.WriteAllText(logPath, errorReport, Encoding.UTF8);
|
|
157
|
+
|
|
158
|
+
// Truncate for the dialog (MessageDialog has practical limits).
|
|
159
|
+
const int MaxLen = 800;
|
|
160
|
+
var summary = errorReport.Length > MaxLen
|
|
161
|
+
? errorReport.Substring(0, MaxLen) + "\n\n[truncated — see log for full details]"
|
|
162
|
+
: errorReport;
|
|
163
|
+
|
|
164
|
+
if (logPath != null)
|
|
165
|
+
summary += "\n\nFull log: " + logPath;
|
|
166
|
+
|
|
167
|
+
var dialog = new MessageDialog(summary, "NativeScript Runtime Error");
|
|
168
|
+
|
|
169
|
+
// MessageDialog supports at most 3 commands. When a source location is
|
|
170
|
+
// available, swap "Copy Details" for "Open in VS Code" so the user can
|
|
171
|
+
// choose between jumping to the error or restarting. Full details are
|
|
172
|
+
// always written to the log file shown in the dialog text.
|
|
173
|
+
var srcLocation = TryExtractSourceLocation(errorReport);
|
|
174
|
+
if (srcLocation.HasValue)
|
|
175
|
+
{
|
|
176
|
+
var (srcFile, srcLine, srcCol) = srcLocation.Value;
|
|
177
|
+
dialog.Commands.Add(new UICommand("Open Source File", async _ =>
|
|
178
|
+
{
|
|
179
|
+
try
|
|
180
|
+
{
|
|
181
|
+
var normalizedPath = srcFile.Replace('\\', '/');
|
|
182
|
+
var uriStr = $"file:///{normalizedPath}";
|
|
183
|
+
if (Uri.TryCreate(uriStr, UriKind.Absolute, out var fileUri))
|
|
184
|
+
await Launcher.LaunchUriAsync(fileUri,
|
|
185
|
+
new LauncherOptions { DisplayApplicationPicker = true });
|
|
186
|
+
}
|
|
187
|
+
catch { }
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
else
|
|
191
|
+
{
|
|
192
|
+
dialog.Commands.Add(new UICommand("Copy Details", _ =>
|
|
193
|
+
{
|
|
194
|
+
try
|
|
195
|
+
{
|
|
196
|
+
var dp = new DataPackage();
|
|
197
|
+
dp.SetText(errorReport);
|
|
198
|
+
Clipboard.SetContent(dp);
|
|
199
|
+
}
|
|
200
|
+
catch { }
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
dialog.Commands.Add(new UICommand("Restart App", async _ =>
|
|
205
|
+
{
|
|
206
|
+
try { await CoreApplication.RequestRestartAsync("crash-restart"); }
|
|
207
|
+
catch { }
|
|
208
|
+
}));
|
|
209
|
+
|
|
210
|
+
dialog.Commands.Add(new UICommand("Dismiss"));
|
|
211
|
+
dialog.DefaultCommandIndex = 0;
|
|
212
|
+
dialog.CancelCommandIndex = 2;
|
|
213
|
+
|
|
214
|
+
await dialog.ShowAsync();
|
|
215
|
+
}
|
|
216
|
+
catch (Exception ex)
|
|
217
|
+
{
|
|
218
|
+
System.Diagnostics.Debug.WriteLine("[NativeScript] Failed to show crash dialog: " + ex.Message);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/// <summary>
|
|
223
|
+
/// Appends <paramref name="message"/> to ns_trace.log using the Win32 temp path.
|
|
224
|
+
/// Inside UWP, GetTempPath() virtualises to AC\Temp — the same folder Rust's
|
|
225
|
+
/// std::env::temp_dir() uses — so this write appears in the CLI's log stream.
|
|
226
|
+
/// </summary>
|
|
227
|
+
public static void WriteToTraceLog(string message)
|
|
228
|
+
{
|
|
229
|
+
try
|
|
230
|
+
{
|
|
231
|
+
// System.IO.Path.GetTempPath() calls Win32 GetTempPathW() which inside a
|
|
232
|
+
// UWP process returns the container's AC\Temp folder, matching Rust.
|
|
233
|
+
var tracePath = Path.Combine(System.IO.Path.GetTempPath(), "ns_trace.log");
|
|
234
|
+
File.AppendAllText(tracePath, message, Encoding.UTF8);
|
|
235
|
+
}
|
|
236
|
+
catch { }
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private static void AppendToLog(string content)
|
|
240
|
+
{
|
|
241
|
+
try
|
|
242
|
+
{
|
|
243
|
+
var logPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "nativescript-crash.log");
|
|
244
|
+
File.AppendAllText(logPath, content, Encoding.UTF8);
|
|
245
|
+
}
|
|
246
|
+
catch { }
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nativescript/windows",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "NativeScript for using Windows v8",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "https://github.com/NativeScript/windows.git"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "pwsh -File build.ps1",
|
|
11
|
-
"build:x64": "pwsh -File build.ps1 -SkipArm64",
|
|
12
|
-
"build:nodotnet": "pwsh -File build.ps1 -SkipDotnet"
|
|
13
|
-
},
|
|
14
|
-
"keywords": ["nativescript", "windows", "winrt", "uwp"],
|
|
15
|
-
"license": "Apache-2.0",
|
|
16
|
-
"files": [
|
|
17
|
-
"**/*"
|
|
18
|
-
]
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@nativescript/windows",
|
|
3
|
+
"version": "0.1.0-alpha.32",
|
|
4
|
+
"description": "NativeScript for using Windows v8",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/NativeScript/windows.git"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "pwsh -File build.ps1",
|
|
11
|
+
"build:x64": "pwsh -File build.ps1 -SkipArm64",
|
|
12
|
+
"build:nodotnet": "pwsh -File build.ps1 -SkipDotnet"
|
|
13
|
+
},
|
|
14
|
+
"keywords": ["nativescript", "windows", "winrt", "uwp"],
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"files": [
|
|
17
|
+
"**/*"
|
|
18
|
+
]
|
|
19
|
+
}
|