@@ -11,7 +11,7 @@ import { WebAssemblyResourceLoader, LoadingResource } from '../WebAssemblyResour
1111import { Platform , System_Array , Pointer , System_Object , System_String , HeapLock , PlatformApi } from '../Platform' ;
1212import { WebAssemblyBootResourceType , WebAssemblyStartOptions } from '../WebAssemblyStartOptions' ;
1313import { Blazor } from '../../GlobalExports' ;
14- import { DotnetModuleConfig , EmscriptenModule , MonoConfig , ModuleAPI , BootJsonData , ICUDataMode } from 'dotnet' ;
14+ import { DotnetModuleConfig , EmscriptenModule , MonoConfig , ModuleAPI , BootJsonData , ICUDataMode , RuntimeAPI } from 'dotnet' ;
1515import { BINDINGType , MONOType } from 'dotnet/dotnet-legacy' ;
1616import { WebAssemblyComponentDescriptor , discoverComponents , discoverPersistedState } from '../../Services/ComponentDescriptorDiscovery' ;
1717import { attachRootComponentToElement , attachRootComponentToLogicalElement } from '../../Rendering/Renderer' ;
@@ -24,6 +24,7 @@ export let BINDING: BINDINGType = undefined as any;
2424export let MONO : MONOType = undefined as any ;
2525export let Module : DotnetModuleConfig & EmscriptenModule = undefined as any ;
2626let MONO_INTERNAL : any = undefined as any ;
27+ let runtime : RuntimeAPI = undefined as any ;
2728
2829const uint64HighOrderShift = Math . pow ( 2 , 32 ) ;
2930const maxSafeNumberHighPart = Math . pow ( 2 , 21 ) - 1 ; // The high-order int32 from Number.MAX_SAFE_INTEGER
@@ -62,10 +63,8 @@ export const monoPlatform: Platform = {
6263 } ,
6364
6465 callEntryPoint : async function callEntryPoint ( assemblyName : string ) : Promise < any > {
65- const emptyArray = [ [ ] ] ;
66-
6766 try {
68- await BINDING . call_assembly_entry_point ( assemblyName , emptyArray , 'm' ) ;
67+ await runtime . runMain ( assemblyName , [ ] ) ;
6968 } catch ( error ) {
7069 console . error ( error ) ;
7170 showErrorNotification ( ) ;
@@ -131,18 +130,7 @@ export const monoPlatform: Platform = {
131130 return unboxedValue ;
132131 }
133132
134- let decodedString : string | null | undefined ;
135- if ( currentHeapLock ) {
136- decodedString = currentHeapLock . stringCache . get ( fieldValue ) ;
137- if ( decodedString === undefined ) {
138- decodedString = BINDING . conv_string ( fieldValue as any as System_String ) ;
139- currentHeapLock . stringCache . set ( fieldValue , decodedString ) ;
140- }
141- } else {
142- decodedString = BINDING . conv_string ( fieldValue as any as System_String ) ;
143- }
144-
145- return decodedString ;
133+ return BINDING . conv_string ( fieldValue as any as System_String ) ;
146134 } ,
147135
148136 readStructField : function readStructField < T extends Pointer > ( baseAddress : Pointer , fieldOffset ?: number ) : T {
@@ -321,7 +309,7 @@ async function createRuntimeInstance(options: Partial<WebAssemblyStartOptions>):
321309
322310 anyDotnet . withStartupOptions ( options ) . withModuleConfig ( moduleConfig ) ;
323311
324- const runtime = await dotnet . create ( ) ;
312+ runtime = await dotnet . create ( ) ;
325313 const { MONO : mono , BINDING : binding , Module : module , setModuleImports, INTERNAL : mono_internal } = runtime ;
326314 Module = module ;
327315 BINDING = binding ;
@@ -472,9 +460,6 @@ function assertHeapIsNotLocked() {
472460}
473461
474462class MonoHeapLock implements HeapLock {
475- // Within a given heap lock, it's safe to cache decoded strings since the memory can't change
476- stringCache = new Map < number , string | null > ( ) ;
477-
478463 // eslint-disable-next-line @typescript-eslint/ban-types
479464 private postReleaseActions ?: Function [ ] ;
480465
0 commit comments