public static void Register(Assembly?assembly = null) { var standardPlatform = new StandardRuntimePlatform(); var os = standardPlatform.GetRuntimeInfo().OperatingSystem; AssetLoader.RegisterResUriParsers(); AvaloniaLocator.CurrentMutable .Bind <IRuntimePlatform>().ToConstant(standardPlatform) .Bind <IAssetLoader>().ToConstant(new AssetLoader(assembly)) .Bind <IDynamicLibraryLoader>().ToConstant( os switch { OperatingSystemType.WinNT => new Win32Loader(), OperatingSystemType.OSX => new UnixLoader(), OperatingSystemType.Linux => new UnixLoader(), OperatingSystemType.Android => new UnixLoader(), // iOS, WASM, ... _ => (IDynamicLibraryLoader) new NotSupportedLoader() }
public UnmanagedBlob(StandardRuntimePlatform plat, int size) { try { if (size <= 0) { throw new ArgumentException("Positive number required", nameof(size)); } _plat = plat; _address = plat.Alloc(size); GC.AddMemoryPressure(size); Size = size; } catch { GC.SuppressFinalize(this); throw; } #if DEBUG _backtrace = Environment.StackTrace; lock (_btlock) Backtraces.Add(_backtrace); #endif }