Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5a76ad1
Merge in 'release/7.0' changes
dotnet-bot Mar 8, 2023
84e7e19
Merge in 'release/7.0' changes
dotnet-bot Mar 8, 2023
2c2402c
Merge in 'release/7.0' changes
dotnet-bot Mar 8, 2023
7e25da6
Merge in 'release/7.0' changes
dotnet-bot Mar 8, 2023
882512d
Merge in 'release/7.0' changes
dotnet-bot Mar 8, 2023
d46f5e5
Merge in 'release/7.0' changes
dotnet-bot Mar 8, 2023
a1a6ef3
Merge in 'release/7.0' changes
dotnet-bot Mar 8, 2023
089ea99
Merge in 'release/7.0' changes
dotnet-bot Mar 8, 2023
2f81831
Merge in 'release/7.0' changes
dotnet-bot Mar 9, 2023
21bd0a7
Merge in 'release/7.0' changes
dotnet-bot Mar 9, 2023
15f5d02
Merge in 'release/7.0' changes
dotnet-bot Mar 10, 2023
0f05efe
Merge in 'release/7.0' changes
dotnet-bot Mar 10, 2023
eaaed2a
Merge in 'release/7.0' changes
dotnet-bot Mar 10, 2023
5a1baeb
Merged PR 29231: [internal/release/7.0] Fix handling of load for msqu…
elinor-fung Mar 10, 2023
5359e8e
Merge in 'release/7.0' changes
dotnet-bot Mar 10, 2023
bfdc43b
Merge in 'release/7.0' changes
dotnet-bot Mar 11, 2023
71aa107
Merge in 'release/7.0' changes
dotnet-bot Mar 14, 2023
634640c
Merge in 'release/7.0' changes
dotnet-bot Mar 14, 2023
2c9e64f
Merge in 'release/7.0' changes
dotnet-bot Mar 15, 2023
90e3df4
Merge in 'release/7.0' changes
dotnet-bot Mar 17, 2023
fb541ff
Merge in 'release/7.0' changes
dotnet-bot Mar 20, 2023
8042d61
Merge in 'release/7.0' changes
dotnet-bot Mar 23, 2023
062f700
[release/7.0] Update dependencies from dotnet/runtime-assets (#84123)
dotnet-maestro[bot] Apr 7, 2023
a283bb9
Merge pull request #84594 from carlossanlop/release/7.0-staging
carlossanlop Apr 11, 2023
4e9cde7
Merge commit '8042d61b17540e49e53569e3728d2faa1c596583' into internal…
vseanreesermsft Apr 11, 2023
af23cd6
Merge pull request #84640 from vseanreesermsft/internal-merge-7.0-202…
carlossanlop Apr 11, 2023
d477fbf
Update dependencies from https://github.com/dotnet/arcade build 20230…
dotnet-maestro[bot] Apr 12, 2023
5266169
Update dependencies from https://github.com/dotnet/icu build 20230411…
dotnet-maestro[bot] Apr 12, 2023
43b5822
Update dependencies from https://github.com/dotnet/emsdk build 202304…
dotnet-maestro[bot] Apr 12, 2023
3de70ef
[release/7.0] Move mono.mscordbi subset off the offical buildMove mon…
steveisok Apr 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ private static bool TryOpen(string filePath, [NotNullWhen(true)] out SafeFileHan
{
// Read in all of the terminfo data
long termInfoLength = RandomAccess.GetLength(fd);
const int MaxTermInfoLength = 4096; // according to the term and tic man pages, 4096 is the terminfo file size max
const int HeaderLength = 12;
if (termInfoLength <= HeaderLength || termInfoLength > MaxTermInfoLength)
if (termInfoLength <= HeaderLength)
{
throw new InvalidOperationException(SR.IO_TermInfoInvalid);
}
Expand Down
2 changes: 1 addition & 1 deletion src/mono/sample/wasm/browser/Wasm.Browser.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
<PropertyGroup>
<_SampleProject>Wasm.Browser.Sample.csproj</_SampleProject>
</PropertyGroup>
<Target Name="RunSample" DependsOnTargets="RunSampleWithBrowser" />
<Target Name="RunSample" DependsOnTargets="RunSampleWithBrowserAndSimpleServer" />
</Project>
16 changes: 16 additions & 0 deletions src/mono/sample/wasm/browser/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,28 @@ function sub(a, b) {
return a - b;
}

let testError = true;
let testAbort = true;
try {
const { runtimeBuildInfo, setModuleImports, getAssemblyExports, runMain, getConfig } = await dotnet
.withConsoleForwarding()
.withElementOnExit()
.withModuleConfig({
configSrc: "./mono-config.json",
imports: {
fetch: (url, fetchArgs) => {
// we are testing that we can retry loading of the assembly
if (testAbort && url.indexOf('System.Private.Uri.dll') != -1) {
testAbort = false;
return fetch(url + "?testAbort=true", fetchArgs);
}
if (testError && url.indexOf('System.Console.dll') != -1) {
testError = false;
return fetch(url + "?testError=true", fetchArgs);
}
return fetch(url, fetchArgs);
}
},
onConfigLoaded: (config) => {
// This is called during emscripten `dotnet.wasm` instantiation, after we fetched config.
console.log('user code Module.onConfigLoaded');
Expand Down
26 changes: 25 additions & 1 deletion src/mono/sample/wasm/simple-server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,36 @@ private async void ServeAsync(HttpListenerContext context)
if (path.EndsWith(".js") || path.EndsWith(".mjs") || path.EndsWith(".cjs"))
contentType = "text/javascript";

var stream = context.Response.OutputStream;

// test download re-try
if (url.Query.Contains("testError"))
{
Console.WriteLine("Faking 500 " + url);
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
await stream.WriteAsync(buffer, 0, 0).ConfigureAwait(false);
await stream.FlushAsync();
context.Response.Close();
return;
}

if (contentType != null)
context.Response.ContentType = contentType;

context.Response.ContentLength64 = buffer.Length;
context.Response.AppendHeader("cache-control", "public, max-age=31536000");
var stream = context.Response.OutputStream;

// test download re-try
if (url.Query.Contains("testAbort"))
{
Console.WriteLine("Faking abort " + url);
await stream.WriteAsync(buffer, 0, 10).ConfigureAwait(false);
await stream.FlushAsync();
await Task.Delay(100);
context.Response.Abort();
return;
}

try
{
await stream.WriteAsync(buffer).ConfigureAwait(false);
Expand Down
22 changes: 13 additions & 9 deletions src/mono/wasm/runtime/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ export async function mono_download_assets(): Promise<void> {
asset.pendingDownloadInternal = asset.pendingDownload;
const waitForExternalData: () => Promise<AssetWithBuffer> = async () => {
const response = await asset.pendingDownloadInternal!.response;
++actual_downloaded_assets_count;
if (!headersOnly) {
asset.buffer = await response.arrayBuffer();
}
++actual_downloaded_assets_count;
return { asset, buffer: asset.buffer };
};
promises_of_assets_with_buffer.push(waitForExternalData());
Expand Down Expand Up @@ -122,6 +122,10 @@ export async function mono_download_assets(): Promise<void> {
if (!skipInstantiateByAssetTypes[asset.behavior]) {
expected_instantiated_assets_count--;
}
} else {
if (skipBufferByAssetTypes[asset.behavior]) {
++actual_downloaded_assets_count;
}
}
}
})());
Expand Down Expand Up @@ -197,7 +201,9 @@ async function start_asset_download_with_throttle(asset: AssetEntry, downloadDat
if (!downloadData || !response) {
return undefined;
}
return await response.arrayBuffer();
const buffer = await response.arrayBuffer();
++actual_downloaded_assets_count;
return buffer;
}
finally {
--parallel_count;
Expand Down Expand Up @@ -226,7 +232,6 @@ async function start_asset_download_sources(asset: AssetEntryInternal): Promise<
}
}) as any
};
++actual_downloaded_assets_count;
return asset.pendingDownloadInternal.response;
}
if (asset.pendingDownloadInternal && asset.pendingDownloadInternal.response) {
Expand Down Expand Up @@ -262,7 +267,6 @@ async function start_asset_download_sources(asset: AssetEntryInternal): Promise<
if (!response.ok) {
continue;// next source
}
++actual_downloaded_assets_count;
return response;
}
catch (err) {
Expand Down Expand Up @@ -293,7 +297,7 @@ function resolve_path(asset: AssetEntry, sourcePrefix: string): string {
: asset.name;
}
else if (asset.behavior === "resource") {
const path = asset.culture !== "" ? `${asset.culture}/${asset.name}` : asset.name;
const path = asset.culture && asset.culture !== "" ? `${asset.culture}/${asset.name}` : asset.name;
attemptUrl = assemblyRootFolder
? (assemblyRootFolder + "/" + path)
: path;
Expand Down Expand Up @@ -420,7 +424,7 @@ function _instantiate_asset(asset: AssetEntry, url: string, bytes: Uint8Array) {
Module.printErr(`MONO_WASM: Error loading ICU asset ${asset.name}`);
}
else if (asset.behavior === "resource") {
cwraps.mono_wasm_add_satellite_assembly(virtualName, asset.culture!, offset!, bytes.length);
cwraps.mono_wasm_add_satellite_assembly(virtualName, asset.culture || "", offset!, bytes.length);
}
++actual_instantiated_assets_count;
}
Expand All @@ -429,10 +433,10 @@ export async function instantiate_wasm_asset(
pendingAsset: AssetEntryInternal,
wasmModuleImports: WebAssembly.Imports,
successCallback: InstantiateWasmSuccessCallback,
) {
mono_assert(pendingAsset && pendingAsset.pendingDownloadInternal, "Can't load dotnet.wasm");
): Promise<void> {
mono_assert(pendingAsset && pendingAsset.pendingDownloadInternal && pendingAsset.pendingDownloadInternal.response, "Can't load dotnet.wasm");
const response = await pendingAsset.pendingDownloadInternal.response;
const contentType = response.headers ? response.headers.get("Content-Type") : undefined;
const contentType = response.headers && response.headers.get ? response.headers.get("Content-Type") : undefined;
let compiledInstance: WebAssembly.Instance;
let compiledModule: WebAssembly.Module;
if (typeof WebAssembly.instantiateStreaming === "function" && contentType === "application/wasm") {
Expand Down