Skip to content

Commit dacb224

Browse files
[main] Update dependencies from dotnet/runtime dotnet/efcore (#49704)
[main] Update dependencies from dotnet/runtime dotnet/efcore - React to the new NativeAOT annotations in EF - Merge remote-tracking branch 'origin/main' into darc-main-42aacfbe-ed21-4d49-84b9-a3a4395f168f - cleanup of the wasm runtime dependency - active issue dotnet/runtime#89883
1 parent 5f8b7fd commit dacb224

File tree

14 files changed

+348
-333
lines changed

14 files changed

+348
-333
lines changed

eng/Version.Details.xml

Lines changed: 154 additions & 154 deletions
Large diffs are not rendered by default.

eng/Versions.props

Lines changed: 77 additions & 77 deletions
Large diffs are not rendered by default.

src/Components/Web.JS/@types/dotnet/dotnet-legacy.d.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,6 @@ type MONOType = {
154154
* @deprecated Please use config.assets instead
155155
*/
156156
mono_wasm_runtime_ready: () => void;
157-
/**
158-
* @deprecated Please use config.assets instead
159-
*/
160-
mono_wasm_load_data_archive: (data: Uint8Array, prefix: string) => boolean;
161-
/**
162-
* @deprecated Please use configSrc instead
163-
*/
164-
mono_wasm_load_config: (configFilePath: string) => Promise<void>;
165-
/**
166-
* @deprecated Please use runMain instead
167-
*/
168-
mono_load_runtime_and_bcl_args: Function;
169157
/**
170158
* @deprecated Please use [JSImportAttribute] or [JSExportAttribute] for interop instead.
171159
*/

src/Components/Web.JS/@types/dotnet/dotnet.d.ts

Lines changed: 94 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//!
44
//! This is generated file, see src/mono/wasm/runtime/rollup.config.js
55

6-
//! This is not considered public API with backward compatibility guarantees.
6+
//! This is not considered public API with backward compatibility guarantees.
77

88
declare interface NativePointer {
99
__brandNativePointer: "NativePointer";
@@ -63,6 +63,9 @@ declare interface EmscriptenModule {
6363
onAbort?: {
6464
(error: any): void;
6565
};
66+
onExit?: {
67+
(code: number): void;
68+
};
6669
}
6770
type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: WebAssembly.Module | undefined) => void;
6871
type InstantiateWasmCallBack = (imports: WebAssembly.Imports, successCallback: InstantiateWasmSuccessCallback) => any;
@@ -92,14 +95,6 @@ interface DotnetHostBuilder {
9295
run(): Promise<number>;
9396
}
9497
type MonoConfig = {
95-
/**
96-
* The subfolder containing managed assemblies and pdbs. This is relative to dotnet.js script.
97-
*/
98-
assemblyRootFolder?: string;
99-
/**
100-
* A list of assets to load along with the runtime.
101-
*/
102-
assets?: AssetEntry[];
10398
/**
10499
* Additional search locations for assets.
105100
*/
@@ -130,6 +125,10 @@ type MonoConfig = {
130125
* debugLevel < 0 enables debugging and disables debug logging.
131126
*/
132127
debugLevel?: number;
128+
/**
129+
* Gets a value that determines whether to enable caching of the 'resources' inside a CacheStorage instance within the browser.
130+
*/
131+
cacheBootResources?: boolean;
133132
/**
134133
* Enables diagnostic log messages during startup
135134
*/
@@ -148,10 +147,6 @@ type MonoConfig = {
148147
* If true, the snapshot of runtime's memory will be stored in the browser and used for faster startup next time. Default is false.
149148
*/
150149
startupMemoryCache?: boolean;
151-
/**
152-
* hash of assets
153-
*/
154-
assetsHash?: string;
155150
/**
156151
* application environment
157152
*/
@@ -164,6 +159,10 @@ type MonoConfig = {
164159
* definition of assets to load along with the runtime.
165160
*/
166161
resources?: ResourceGroups;
162+
/**
163+
* appsettings files to load to VFS
164+
*/
165+
appsettings?: string[];
167166
/**
168167
* config extensions declared in MSBuild items @(WasmBootConfigExtension)
169168
*/
@@ -175,25 +174,31 @@ type ResourceExtensions = {
175174
[extensionName: string]: ResourceList;
176175
};
177176
interface ResourceGroups {
178-
readonly hash?: string;
179-
readonly assembly?: ResourceList;
180-
readonly lazyAssembly?: ResourceList;
181-
readonly pdb?: ResourceList;
182-
readonly runtime?: ResourceList;
183-
readonly satelliteResources?: {
177+
hash?: string;
178+
assembly?: ResourceList;
179+
lazyAssembly?: ResourceList;
180+
pdb?: ResourceList;
181+
jsModuleWorker?: ResourceList;
182+
jsModuleNative: ResourceList;
183+
jsModuleRuntime: ResourceList;
184+
wasmSymbols?: ResourceList;
185+
wasmNative: ResourceList;
186+
icu?: ResourceList;
187+
satelliteResources?: {
184188
[cultureName: string]: ResourceList;
185189
};
186-
readonly libraryInitializers?: {
187-
readonly onRuntimeConfigLoaded: ResourceList;
188-
readonly onRuntimeReady: ResourceList;
189-
};
190-
readonly extensions?: ResourceExtensions;
191-
readonly vfs?: {
190+
modulesAfterConfigLoaded?: ResourceList;
191+
modulesAfterRuntimeReady?: ResourceList;
192+
extensions?: ResourceExtensions;
193+
vfs?: {
192194
[virtualPath: string]: ResourceList;
193195
};
194196
}
197+
/**
198+
* A "key" is name of the file, a "value" is optional hash for integrity check.
199+
*/
195200
type ResourceList = {
196-
[name: string]: string;
201+
[name: string]: string | null | "";
197202
};
198203
/**
199204
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
@@ -203,13 +208,14 @@ type ResourceList = {
203208
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
204209
* @param integrity The integrity string representing the expected content in the response.
205210
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
211+
* When returned string is not qualified with `./` or absolute URL, it will be resolved against the application base URI.
206212
*/
207-
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string) => string | Promise<Response> | null | undefined;
213+
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string, behavior: AssetBehaviors) => string | Promise<Response> | null | undefined;
208214
interface ResourceRequest {
209215
name: string;
210-
behavior: AssetBehaviours;
216+
behavior: AssetBehaviors;
211217
resolvedUrl?: string;
212-
hash?: string;
218+
hash?: string | null | "";
213219
}
214220
interface LoadingResource {
215221
name: string;
@@ -244,59 +250,64 @@ interface AssetEntry extends ResourceRequest {
244250
*/
245251
pendingDownload?: LoadingResource;
246252
}
247-
type AssetBehaviours =
248-
/**
249-
* Load asset as a managed resource assembly.
250-
*/
251-
"resource"
252-
/**
253-
* Load asset as a managed assembly.
254-
*/
255-
| "assembly"
256-
/**
257-
* Load asset as a managed debugging information.
258-
*/
259-
| "pdb"
260-
/**
261-
* Store asset into the native heap.
262-
*/
263-
| "heap"
264-
/**
265-
* Load asset as an ICU data archive.
266-
*/
267-
| "icu"
268-
/**
269-
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
270-
*/
271-
| "vfs"
272-
/**
273-
* The binary of the dotnet runtime.
274-
*/
275-
| "dotnetwasm"
276-
/**
277-
* The javascript module for threads.
278-
*/
279-
| "js-module-threads"
280-
/**
281-
* The javascript module for threads.
282-
*/
283-
| "js-module-runtime"
284-
/**
285-
* The javascript module for threads.
286-
*/
287-
| "js-module-dotnet"
288-
/**
289-
* The javascript module for threads.
290-
*/
291-
| "js-module-native"
292-
/**
293-
* The javascript module that came from nuget package .
294-
*/
295-
| "js-module-library-initializer"
296-
/**
297-
* The javascript module for threads.
298-
*/
299-
| "symbols";
253+
type SingleAssetBehaviors =
254+
/**
255+
* The binary of the dotnet runtime.
256+
*/
257+
"dotnetwasm"
258+
/**
259+
* The javascript module for loader.
260+
*/
261+
| "js-module-dotnet"
262+
/**
263+
* The javascript module for threads.
264+
*/
265+
| "js-module-threads"
266+
/**
267+
* The javascript module for runtime.
268+
*/
269+
| "js-module-runtime"
270+
/**
271+
* The javascript module for emscripten.
272+
*/
273+
| "js-module-native"
274+
/**
275+
* Typically blazor.boot.json
276+
*/
277+
| "manifest";
278+
type AssetBehaviors = SingleAssetBehaviors |
279+
/**
280+
* Load asset as a managed resource assembly.
281+
*/
282+
"resource"
283+
/**
284+
* Load asset as a managed assembly.
285+
*/
286+
| "assembly"
287+
/**
288+
* Load asset as a managed debugging information.
289+
*/
290+
| "pdb"
291+
/**
292+
* Store asset into the native heap.
293+
*/
294+
| "heap"
295+
/**
296+
* Load asset as an ICU data archive.
297+
*/
298+
| "icu"
299+
/**
300+
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
301+
*/
302+
| "vfs"
303+
/**
304+
* The javascript module that came from nuget package .
305+
*/
306+
| "js-module-library-initializer"
307+
/**
308+
* The javascript module for threads.
309+
*/
310+
| "symbols";
300311
declare const enum GlobalizationMode {
301312
/**
302313
* Load sharded ICU data.
@@ -326,10 +337,8 @@ type DotnetModuleConfig = {
326337
onConfigLoaded?: (config: MonoConfig) => void | Promise<void>;
327338
onDotnetReady?: () => void | Promise<void>;
328339
onDownloadResourceProgress?: (resourcesLoaded: number, totalResources: number) => void;
329-
getApplicationEnvironment?: (bootConfigResponse: Response) => string | null;
330340
imports?: any;
331341
exports?: string[];
332-
downloadResource?: (request: ResourceRequest) => LoadingResource | undefined;
333342
} & Partial<EmscriptenModule>;
334343
type APIType = {
335344
runMain: (mainAssemblyName: string, args: string[]) => Promise<number>;
@@ -432,4 +441,4 @@ declare global {
432441
}
433442
declare const createDotnetRuntime: CreateDotnetRuntimeType;
434443

435-
export { AssetEntry, CreateDotnetRuntimeType, DotnetHostBuilder, DotnetModuleConfig, EmscriptenModule, GlobalizationMode, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, createDotnetRuntime as default, dotnet, exit };
444+
export { AssetBehaviors, AssetEntry, CreateDotnetRuntimeType, DotnetHostBuilder, DotnetModuleConfig, EmscriptenModule, GlobalizationMode, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, createDotnetRuntime as default, dotnet, exit };

src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async function importDotnetJs(startOptions: Partial<WebAssemblyStartOptions>): P
161161
// Allow overriding the URI from which the dotnet.*.js file is loaded
162162
if (startOptions.loadBootResource) {
163163
const resourceType: WebAssemblyBootResourceType = 'dotnetjs';
164-
const customSrc = startOptions.loadBootResource(resourceType, 'dotnet.js', src, '');
164+
const customSrc = startOptions.loadBootResource(resourceType, 'dotnet.js', src, '', 'js-module-dotnet');
165165
if (typeof (customSrc) === 'string') {
166166
src = customSrc;
167167
} else if (customSrc) {
@@ -197,7 +197,6 @@ function prepareRuntimeConfig(options: Partial<WebAssemblyStartOptions>): Dotnet
197197
};
198198

199199
const moduleConfig = (window['Module'] || {}) as typeof Module;
200-
// TODO (moduleConfig as any).preloadPlugins = []; // why do we need this ?
201200
const dotnetModuleConfig: DotnetModuleConfig = {
202201
...moduleConfig,
203202
onConfigLoaded: (onConfigLoaded as (config: MonoConfig) => void | Promise<void>),

src/Components/Web.JS/src/Platform/WebAssemblyStartOptions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
import { DotnetHostBuilder } from 'dotnet';
4+
import { DotnetHostBuilder, AssetBehaviors } from 'dotnet';
55

66
export interface WebAssemblyStartOptions {
77
/**
@@ -11,9 +11,11 @@ export interface WebAssemblyStartOptions {
1111
* @param name The name of the resource to be loaded.
1212
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
1313
* @param integrity The integrity string representing the expected content in the response.
14+
* @param behavior The detailed behavior/type of the resource to be loaded.
1415
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
16+
* When returned string is not qualified with `./` or absolute URL, it will be resolved against document.baseURI.
1517
*/
16-
loadBootResource(type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string): string | Promise<Response> | null | undefined;
18+
loadBootResource(type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string, behavior: AssetBehaviors): string | Promise<Response> | null | undefined;
1719

1820
/**
1921
* Override built-in environment setting on start.

src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public override Task InitializeAsync()
3535
return base.InitializeAsync(Guid.NewGuid().ToString());
3636
}
3737

38+
/* Active Issue https://github.com/dotnet/runtime/issues/89883
3839
[Fact]
3940
public void CachesResourcesAfterFirstLoad()
4041
{
@@ -97,6 +98,7 @@ public void IncrementallyUpdatesCache()
9798
Assert.Contains(cacheEntryForDotNetWasm, cacheEntryUrls3);
9899
Assert.DoesNotContain(cacheEntryForDotNetWasmWithChangedHash, cacheEntryUrls3);
99100
}
101+
*/
100102

101103
private IReadOnlyCollection<string> GetCacheEntryUrls()
102104
{

src/Components/test/testassets/Components.TestServer/RazorComponents/App.razor

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
disableDomPreservation: suppressEnhancedNavigation,
2727
},
2828
webAssembly: {
29-
loadBootResource: function (type, name, defaultUri, integrity) {
29+
loadBootResource: function (type, name, defaultUri, integrity, behavior) {
30+
// note this is resolved to absolute URL using document.baseURI
3031
return `WasmMinimal/_framework/${name}`;
3132
},
3233
},

src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseDeveloperPageExceptionFilter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Data.Common;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Linq;
67
using Microsoft.AspNetCore.Builder;
78
using Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Views;
@@ -20,6 +21,7 @@ namespace Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore;
2021
/// <remarks>
2122
/// This should only be enabled in the Development environment.
2223
/// </remarks>
24+
[RequiresDynamicCode("DbContext migrations operations are not supported with NativeAOT")]
2325
public sealed class DatabaseDeveloperPageExceptionFilter : IDeveloperPageExceptionFilter
2426
{
2527
private readonly ILogger _logger;

src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseDeveloperPageExceptionFilterServiceExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics.CodeAnalysis;
45
using Microsoft.AspNetCore.Diagnostics;
56
using Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore;
67
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -21,6 +22,7 @@ public static class DatabaseDeveloperPageExceptionFilterServiceExtensions
2122
/// <remarks>
2223
/// This should only be enabled in the Development environment.
2324
/// </remarks>
25+
[RequiresDynamicCode("DbContext migrations operations are not supported with NativeAOT")]
2426
public static IServiceCollection AddDatabaseDeveloperPageExceptionFilter(this IServiceCollection services)
2527
{
2628
ArgumentNullException.ThrowIfNull(services);

0 commit comments

Comments
 (0)