Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6b91c6a

Browse filesBrowse files
committed
more
1 parent 2fd14de commit 6b91c6a
Copy full SHA for 6b91c6a

4 files changed

+35-9Lines changed: 35 additions & 9 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets‎

Copy file name to clipboardExpand all lines: src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,13 @@ Copyright (c) .NET Foundation. All rights reserved.
895895
IsAot="$(RunAOTCompilation)"
896896
IsMultiThreaded="$(WasmEnableThreads)"
897897
FingerprintAssets="$(_WasmFingerprintAssets)"
898-
BundlerFriendly="$(_WasmBundlerFriendlyBootConfig)" />
898+
BundlerFriendly="$(_WasmBundlerFriendlyBootConfig)"
899+
ExitOnUnhandledError="$(WasmTestExitOnUnhandledError)"
900+
AppendElementOnExit="$(WasmTestAppendElementOnExit)"
901+
LogExitCode="$(WasmTestLogExitCode)"
902+
AsyncFlushOnExit="$(WasmTestAsyncFlushOnExit)"
903+
ForwardConsole="$(WasmTestForwardConsole)"
904+
/>
899905

900906
<ItemGroup>
901907
<FileWrites Include="$(IntermediateOutputPath)$(_WasmPublishBootConfigFileName)" />
Collapse file

‎src/mono/sample/wasm/Directory.Build.targets‎

Copy file name to clipboardExpand all lines: src/mono/sample/wasm/Directory.Build.targets
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
<NestedBuildProperty Include="WasmEnableWebcil" />
4747
<NestedBuildProperty Include="EnableAggressiveTrimming" />
4848
<NestedBuildProperty Include="TrimMode" />
49+
<NestedBuildProperty Include="WasmTestSupport" />
50+
<NestedBuildProperty Include="WasmTestExitOnUnhandledError" />
51+
<NestedBuildProperty Include="WasmTestAppendElementOnExit" />
52+
<NestedBuildProperty Include="WasmTestLogExitCode" />
53+
<NestedBuildProperty Include="WasmTestAsyncFlushOnExit" />
54+
<NestedBuildProperty Include="WasmTestForwardConsole" />
4955
</ItemGroup>
5056

5157
<Target Name="BuildSampleInTree"
Collapse file

‎src/native/corehost/browserhost/host/host.ts‎

Copy file name to clipboardExpand all lines: src/native/corehost/browserhost/host/host.ts
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export async function runMain(mainAssemblyName?: string, args?: string[]): Promi
152152
Module.stackRestore(sp);
153153
}
154154
} catch (error: any) {
155+
// if the error is an ExitStatus, use its status code
155156
if (error && typeof error.status === "number") {
156157
return error.status;
157158
}
@@ -161,8 +162,12 @@ export async function runMain(mainAssemblyName?: string, args?: string[]): Promi
161162
}
162163

163164
export async function runMainAndExit(mainAssemblyName?: string, args?: string[]): Promise<number> {
164-
await runMain(mainAssemblyName, args);
165-
dotnetApi.exit(0, null);
166-
return 0;
165+
const res = await runMain(mainAssemblyName, args);
166+
try {
167+
dotnetApi.exit(0, null);
168+
} catch {
169+
// do not propagate this exception
170+
}
171+
return res;
167172
}
168173

Collapse file

‎src/native/libs/System.Native.Browser/diagnostics/exit.ts‎

Copy file name to clipboardExpand all lines: src/native/libs/System.Native.Browser/diagnostics/exit.ts
+14-5Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,31 @@ function onExit(exitCode: number, reason: any, silent: boolean): boolean {
5252

5353
function logExitReason(exit_code: number, reason: any) {
5454
if (exit_code !== 0 && reason) {
55+
const exitStatus = isExitStatus(reason);
5556
if (typeof reason == "string") {
5657
dotnetLogger.error(reason);
5758
} else {
58-
const ExitStatus = dotnetBrowserHostExports.getExitStatus();
59-
if (reason.stack === undefined && !ExitStatus && !(reason instanceof ExitStatus)) {
59+
if (reason.stack === undefined && !exitStatus) {
6060
reason.stack = new Error().stack + "";
6161
}
62-
if (reason.message) {
63-
dotnetLogger.error(symbolicateStackTrace(reason.message + "\n" + reason.stack));
62+
const message = reason.message
63+
? symbolicateStackTrace(reason.message + "\n" + reason.stack)
64+
: reason.toString();
65+
66+
if (exitStatus) {
67+
dotnetLogger.debug(message);
6468
} else {
65-
dotnetLogger.error(JSON.stringify(reason));
69+
dotnetLogger.error(message);
6670
}
6771
}
6872
}
6973
}
7074

75+
function isExitStatus(reason: any): boolean {
76+
const ExitStatus = dotnetBrowserHostExports.getExitStatus();
77+
return ExitStatus && reason instanceof ExitStatus;
78+
}
79+
7180
function logExitCode(exitCode: number): void {
7281
const message = config.logExitCode
7382
? "WASM EXIT " + exitCode

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.