@nativescript/windows-quickjs 0.1.0-next.2026-08-03-30819078286 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/framework/__PROJECT_NAME__/App.xaml.cs +3 -2
- package/framework/__PROJECT_NAME__/CrashDiagnostics.cs +3 -3
- package/framework/__PROJECT_NAME__/RuntimeHost.cs +149 -24
- package/framework/__PROJECT_NAME__/__PROJECT_NAME__.csproj +35 -41
- package/framework/dotnet-bridge/BinaryProtocol.cs +18 -0
- package/framework/dotnet-bridge/Bridge.BinaryDispatch.cs +75 -8
- package/framework/dotnet-bridge/Bridge.Dispatch.cs +36 -35
- package/framework/dotnet-bridge/Bridge.JsDelegate.cs +115 -59
- package/framework/dotnet-bridge/Bridge.Proxy.cs +141 -86
- package/framework/dotnet-bridge/Bridge.TaskHelper.cs +2 -1
- package/framework/dotnet-bridge/Bridge.cs +9 -5
- package/framework/dotnet-bridge/DotNetBridge.csproj +8 -0
- package/framework/libs/x64/nativescript.dll +0 -0
- package/framework/tools/ManifestMerger/ManifestMerger.dll +0 -0
- package/framework/tools/ManifestMerger/ManifestMerger.pdb +0 -0
- package/framework/tools/dotnet-tool-x64.exe +0 -0
- package/framework/tools/dotnet-tool.exe +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.dll +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.exe +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.pdb +0 -0
- package/framework/tools/nsbundle_pack-x64.exe +0 -0
- package/framework/tools/nsbundle_pack.exe +0 -0
- package/framework/tools/typings-generator-x64.exe +0 -0
- package/framework/tools/typings-generator.exe +0 -0
- package/package.json +1 -1
- package/framework/tools/sbg-arm64.exe +0 -0
- package/framework/tools/sbg-x64.exe +0 -0
- package/framework/tools/sbg.exe +0 -0
|
@@ -51,9 +51,7 @@ public static partial class Bridge
|
|
|
51
51
|
public static T InvokeMethodTyped<T>(object instance, string methodName, object[] args)
|
|
52
52
|
{
|
|
53
53
|
var result = ProxyInvokeMethod(instance, methodName, args);
|
|
54
|
-
|
|
55
|
-
if (result is T t) return t;
|
|
56
|
-
return (T)Convert.ChangeType(result, typeof(T), CultureInfo.InvariantCulture);
|
|
54
|
+
return (T)ConvertJsResult(result, typeof(T))!;
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
public static object? InvokeMethod(object instance, string methodName, object[] args)
|
|
@@ -69,9 +67,7 @@ public static partial class Bridge
|
|
|
69
67
|
public static T GetProperty<T>(object instance, string propertyName)
|
|
70
68
|
{
|
|
71
69
|
var result = ProxyGetProperty(instance, propertyName);
|
|
72
|
-
|
|
73
|
-
if (result is T t) return t;
|
|
74
|
-
return (T)Convert.ChangeType(result, typeof(T), CultureInfo.InvariantCulture);
|
|
70
|
+
return (T)ConvertJsResult(result, typeof(T))!;
|
|
75
71
|
}
|
|
76
72
|
|
|
77
73
|
public static void SetProperty(object instance, string propertyName, object? value)
|
|
@@ -208,8 +204,10 @@ public static partial class Bridge
|
|
|
208
204
|
// ctor exists on the derived type. If the base type has no parameterless
|
|
209
205
|
// ctor, emit a parameterless ctor that forwards default(T) values to the
|
|
210
206
|
// first available base ctor (dev-only convenience).
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
// Public and protected base constructors: a JS subclass can call either through super(...),
|
|
208
|
+
// and abstract classes / composable WinRT classes (Panel, Control) only have protected ones.
|
|
209
|
+
var baseCtors = baseType.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
|
|
210
|
+
.Where(c => !c.IsGenericMethod && (c.IsPublic || c.IsFamily || c.IsFamilyOrAssembly))
|
|
213
211
|
.ToArray();
|
|
214
212
|
|
|
215
213
|
ConstructorInfo? chosenBaseForDefault = null;
|
|
@@ -293,8 +291,12 @@ public static partial class Bridge
|
|
|
293
291
|
// Override only the base virtuals JS actually asked for (memberSet). Anything not in
|
|
294
292
|
// that set is simply never touched, so the base implementation stays live in the vtable —
|
|
295
293
|
// no "call base" IL needed. (Skip ref/out and generic methods — unsupported.)
|
|
294
|
+
// Abstract members are always implemented (dispatching to JS, which reports a missing
|
|
295
|
+
// implementation as an error) — a type with an unimplemented abstract member can't be created.
|
|
296
296
|
var virtualMethods = baseType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
|
|
297
|
-
.Where(m => m.IsVirtual && !m.IsFinal && !m.IsGenericMethod && !m.IsConstructor
|
|
297
|
+
.Where(m => m.IsVirtual && !m.IsFinal && !m.IsGenericMethod && !m.IsConstructor
|
|
298
|
+
&& (m.IsPublic || m.IsFamily || m.IsFamilyOrAssembly)
|
|
299
|
+
&& (memberSet.Contains(m.Name) || m.IsAbstract))
|
|
298
300
|
.ToArray();
|
|
299
301
|
|
|
300
302
|
foreach (var mi in virtualMethods)
|
|
@@ -310,6 +312,11 @@ public static partial class Bridge
|
|
|
310
312
|
MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig,
|
|
311
313
|
mi.CallingConvention, mi.ReturnType, paramTypes, mi.Name);
|
|
312
314
|
definedSignatures[sigKey] = mb;
|
|
315
|
+
|
|
316
|
+
// `super.Name(...)` from JS: a public, non-virtual entry point to the base
|
|
317
|
+
// implementation (a plain call, so it can't dispatch back into the override).
|
|
318
|
+
if (!mi.IsAbstract)
|
|
319
|
+
EmitBaseCallMethod(tb, mi, paramTypes);
|
|
313
320
|
}
|
|
314
321
|
|
|
315
322
|
tb.DefineMethodOverride(mb, mi);
|
|
@@ -359,6 +366,20 @@ public static partial class Bridge
|
|
|
359
366
|
return tb.CreateTypeInfo()!.AsType();
|
|
360
367
|
}
|
|
361
368
|
|
|
369
|
+
internal const string BaseCallPrefix = "__ns_base_";
|
|
370
|
+
|
|
371
|
+
private static void EmitBaseCallMethod(TypeBuilder tb, MethodInfo baseMethod, Type[] paramTypes)
|
|
372
|
+
{
|
|
373
|
+
var mb = tb.DefineMethod(BaseCallPrefix + baseMethod.Name,
|
|
374
|
+
MethodAttributes.Public | MethodAttributes.HideBySig, CallingConventions.HasThis,
|
|
375
|
+
baseMethod.ReturnType, paramTypes);
|
|
376
|
+
var il = mb.GetILGenerator();
|
|
377
|
+
il.Emit(OpCodes.Ldarg_0);
|
|
378
|
+
for (int i = 0; i < paramTypes.Length; i++) il.Emit(OpCodes.Ldarg, i + 1);
|
|
379
|
+
il.Emit(OpCodes.Call, baseMethod);
|
|
380
|
+
il.Emit(OpCodes.Ret);
|
|
381
|
+
}
|
|
382
|
+
|
|
362
383
|
// Shared IL body for both base-virtual overrides and interface-member implementations: box
|
|
363
384
|
// args into an object[], forward to ProxyRuntime.InvokeVoid/InvokeMethodTyped<T> by name.
|
|
364
385
|
private static MethodBuilder EmitProxyMethodBody(
|
|
@@ -406,83 +427,103 @@ public static partial class Bridge
|
|
|
406
427
|
|
|
407
428
|
private static DispatchResult CreateJsSubclass(
|
|
408
429
|
string? assemblyName, string typeName, int callbackId, string[] interfaceNames, string[] memberNames)
|
|
430
|
+
=> CreateJsSubclass(assemblyName, typeName, callbackId, interfaceNames, memberNames, []);
|
|
431
|
+
|
|
432
|
+
// Creates an instance of a JS subclass: a dynamic subclass of the base type (or of System.Object
|
|
433
|
+
// when the "base" is an interface being implemented) whose overridden virtuals and interface
|
|
434
|
+
// members call the JS object registered under `callbackId`. `ctorArgs` select and feed the
|
|
435
|
+
// base constructor, as `super(...)` arguments do on Android/iOS.
|
|
436
|
+
private static DispatchResult CreateJsSubclass(
|
|
437
|
+
string? assemblyName, string typeName, int callbackId, string[] interfaceNames, string[] memberNames, object?[] ctorArgs)
|
|
409
438
|
{
|
|
410
439
|
EnsureProxyDispatcherCallbacksRegistered();
|
|
411
440
|
|
|
412
|
-
|
|
441
|
+
// `typeName` is the base type; older runtimes passed an auto-generated proxy name there and
|
|
442
|
+
// the base type in `assemblyName`.
|
|
443
|
+
var baseType = ResolveType(null, typeName)
|
|
444
|
+
?? (string.IsNullOrEmpty(assemblyName) ? null : ResolveType(null, assemblyName))
|
|
445
|
+
?? throw new TypeLoadException($"Type not found: {typeName}");
|
|
413
446
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
Type? t = FindGeneratedProxyType(typeName);
|
|
417
|
-
if (t is null)
|
|
447
|
+
var interfaces = interfaceNames.ToList();
|
|
448
|
+
if (baseType.IsInterface)
|
|
418
449
|
{
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
&& typeName != null
|
|
425
|
-
&& typeName.StartsWith("com.tns.gen.winrt.", StringComparison.Ordinal))
|
|
426
|
-
{
|
|
427
|
-
resolveFrom = assemblyName;
|
|
428
|
-
}
|
|
450
|
+
interfaces.Insert(0, baseType.FullName!);
|
|
451
|
+
baseType = typeof(object);
|
|
452
|
+
}
|
|
453
|
+
if (baseType.IsSealed)
|
|
454
|
+
throw new InvalidOperationException($"{baseType.FullName} is sealed and can't be extended.");
|
|
429
455
|
|
|
430
|
-
|
|
431
|
-
var baseType = ResolveType(null, resolveFrom)
|
|
432
|
-
?? ResolveType(assemblyName, typeName)
|
|
433
|
-
?? throw new TypeLoadException($"Type not found: {resolveFrom} (proxy: {typeName}, assembly: {assemblyName})");
|
|
456
|
+
var proxyType = GetOrCreateDynamicProxyType(baseType, interfaces.ToArray(), memberNames);
|
|
434
457
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
|
|
458
|
+
// Pick the constructor by argument count, preferring one whose parameters the arguments
|
|
459
|
+
// convert to.
|
|
460
|
+
var ctors = proxyType.GetConstructors().Where(c => c.GetParameters().Length == ctorArgs.Length).ToArray();
|
|
461
|
+
if (ctors.Length == 0)
|
|
462
|
+
throw new MissingMethodException($"{baseType.FullName} has no constructor taking {ctorArgs.Length} argument(s).");
|
|
463
|
+
object? instance = null;
|
|
464
|
+
Exception? lastError = null;
|
|
465
|
+
s_pendingProxyCallbackId.Value = callbackId;
|
|
466
|
+
try
|
|
467
|
+
{
|
|
468
|
+
foreach (var ctor in ctors)
|
|
441
469
|
{
|
|
442
|
-
|
|
470
|
+
object?[] built;
|
|
471
|
+
try { built = BuildArgsBinExact(ctorArgs, ctor.GetParameters()); }
|
|
472
|
+
catch (Exception e) { lastError = e; continue; }
|
|
473
|
+
if (!ArgsFit(built, ctor.GetParameters())) continue;
|
|
474
|
+
instance = ctor.Invoke(built);
|
|
475
|
+
break;
|
|
443
476
|
}
|
|
477
|
+
if (instance is null)
|
|
478
|
+
throw lastError ?? new MissingMethodException(
|
|
479
|
+
$"No constructor of {baseType.FullName} accepts the given {ctorArgs.Length} argument(s).");
|
|
480
|
+
RegisterJsBacked(instance, callbackId);
|
|
481
|
+
}
|
|
482
|
+
catch (TargetInvocationException tie) when (tie.InnerException is not null)
|
|
483
|
+
{
|
|
484
|
+
throw tie.InnerException;
|
|
485
|
+
}
|
|
486
|
+
finally
|
|
487
|
+
{
|
|
488
|
+
s_pendingProxyCallbackId.Value = null;
|
|
444
489
|
}
|
|
445
|
-
|
|
446
|
-
// Create the managed instance. Generated classes should call
|
|
447
|
-
// ProxyDispatcher.InitializeInstance(this, typeName) in their constructor,
|
|
448
|
-
// which will invoke our ProxyInitializeInstance and capture the pending callback id.
|
|
449
|
-
object? instance = Activator.CreateInstance(t);
|
|
450
|
-
if (instance is null)
|
|
451
|
-
throw new InvalidOperationException($"Failed to instantiate proxy type {t.FullName}.");
|
|
452
|
-
|
|
453
|
-
// Ensure there's a mapping for this instance immediately to avoid any
|
|
454
|
-
// early virtual calls from constructors reaching the JS side before
|
|
455
|
-
// the handle is registered. Call our initializer directly to register
|
|
456
|
-
// the pending callback id when dynamic proxies don't call it.
|
|
457
|
-
try { ProxyInitializeInstance(instance, typeName); } catch { }
|
|
458
490
|
|
|
459
491
|
// Force COM CCW vtable creation for any implemented WinRT interfaces now, rather than
|
|
460
492
|
// relying on it happening implicitly the first time the instance crosses the ABI boundary.
|
|
461
|
-
|
|
462
|
-
if (interfaceNames.Length > 0)
|
|
463
|
-
{
|
|
464
|
-
TryActivateWinRTInterfaces(instance);
|
|
465
|
-
}
|
|
493
|
+
if (interfaces.Count > 0) TryActivateWinRTInterfaces(instance);
|
|
466
494
|
|
|
467
|
-
// Box the instance into a handle to return to the runtime.
|
|
468
495
|
var result = Box(instance);
|
|
469
|
-
|
|
470
|
-
// Populate holder with handle id now that a handle exists.
|
|
471
496
|
if (s_proxyCallbacks.TryGetValue(instance, out var holder))
|
|
497
|
+
holder.HandleId = result.HandleId();
|
|
498
|
+
return result;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
private static bool ArgsFit(object?[] built, ParameterInfo[] parameters)
|
|
502
|
+
{
|
|
503
|
+
for (int i = 0; i < parameters.Length; i++)
|
|
472
504
|
{
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
{
|
|
477
|
-
// If the generated proxy did not call InitializeInstance, create mapping now.
|
|
478
|
-
int hid = 0;
|
|
479
|
-
try { hid = result.HandleId(); } catch { hid = 0; }
|
|
480
|
-
var newHolder = new ProxyCallbackHolder(callbackId) { HandleId = hid };
|
|
481
|
-
s_proxyCallbacks.Add(instance, newHolder);
|
|
505
|
+
var p = parameters[i].ParameterType;
|
|
506
|
+
if (built[i] is null) { if (p.IsValueType && Nullable.GetUnderlyingType(p) is null) return false; continue; }
|
|
507
|
+
if (!p.IsInstanceOfType(built[i])) return false;
|
|
482
508
|
}
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
483
511
|
|
|
484
|
-
|
|
485
|
-
|
|
512
|
+
private static void RegisterJsBacked(object instance, int callbackId)
|
|
513
|
+
{
|
|
514
|
+
if (!s_proxyCallbacks.TryGetValue(instance, out _))
|
|
515
|
+
s_proxyCallbacks.Add(instance, new ProxyCallbackHolder(callbackId));
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
internal static bool IsJsBacked(object instance) => s_proxyCallbacks.TryGetValue(instance, out _);
|
|
519
|
+
|
|
520
|
+
private static bool TryGetJsBackedHandle(object instance, out int handle)
|
|
521
|
+
{
|
|
522
|
+
handle = 0;
|
|
523
|
+
if (!s_proxyCallbacks.TryGetValue(instance, out var holder) || holder.HandleId == 0) return false;
|
|
524
|
+
if (!s_handles.TryGetValue(holder.HandleId, out var current) || !ReferenceEquals(current, instance)) return false;
|
|
525
|
+
handle = holder.HandleId;
|
|
526
|
+
return true;
|
|
486
527
|
}
|
|
487
528
|
|
|
488
529
|
// Locates CsWinRT's ComWrappersSupport via reflection (same style as the WinRT.IWinRTObject
|
|
@@ -532,42 +573,56 @@ public static partial class Bridge
|
|
|
532
573
|
private static void ProxyInitializeInstance(object instance, string typeName)
|
|
533
574
|
{
|
|
534
575
|
var cb = s_pendingProxyCallbackId.Value;
|
|
535
|
-
if (cb.HasValue)
|
|
576
|
+
if (cb.HasValue) RegisterJsBacked(instance, cb.Value);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// The holder for a JS-backed instance. A virtual the base constructor calls runs before
|
|
580
|
+
// CreateJsSubclass has registered the instance, so fall back to the pending callback id.
|
|
581
|
+
private static ProxyCallbackHolder JsHolderFor(object instance)
|
|
582
|
+
{
|
|
583
|
+
if (s_proxyCallbacks.TryGetValue(instance, out var holder)) return holder;
|
|
584
|
+
var pending = s_pendingProxyCallbackId.Value;
|
|
585
|
+
if (pending.HasValue)
|
|
536
586
|
{
|
|
537
|
-
|
|
538
|
-
s_proxyCallbacks.
|
|
587
|
+
RegisterJsBacked(instance, pending.Value);
|
|
588
|
+
if (s_proxyCallbacks.TryGetValue(instance, out holder)) return holder;
|
|
539
589
|
}
|
|
590
|
+
throw new InvalidOperationException("No JS callback registered for proxy instance.");
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// Payload for the JS dispatcher: (self handle, member name, ...args). The arguments are sent
|
|
594
|
+
// individually so each arrives as its JS value (numbers, strings, structs as plain objects,
|
|
595
|
+
// objects as handles).
|
|
596
|
+
private static object?[] DispatchPayload(ProxyCallbackHolder holder, string memberName, object?[] args)
|
|
597
|
+
{
|
|
598
|
+
var payload = new object?[args.Length + 2];
|
|
599
|
+
payload[0] = new HandleRef(holder.HandleId);
|
|
600
|
+
payload[1] = memberName;
|
|
601
|
+
Array.Copy(args, 0, payload, 2, args.Length);
|
|
602
|
+
return payload;
|
|
540
603
|
}
|
|
541
604
|
|
|
542
605
|
private static object? ProxyInvokeMethod(object instance, string methodName, object[] args)
|
|
543
606
|
{
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return CallJsCallback(holder.CallbackId, payload);
|
|
607
|
+
var holder = JsHolderFor(instance);
|
|
608
|
+
return CallJsCallback(holder.CallbackId, DispatchPayload(holder, methodName, args), expectsResult: true);
|
|
547
609
|
}
|
|
548
610
|
|
|
549
611
|
private static void ProxyInvokeVoid(object instance, string methodName, object[] args)
|
|
550
612
|
{
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
var payload = new object?[] { new HandleRef(holder.HandleId), methodName, args };
|
|
554
|
-
CallJsCallback(holder.CallbackId, payload);
|
|
613
|
+
var holder = JsHolderFor(instance);
|
|
614
|
+
CallJsCallback(holder.CallbackId, DispatchPayload(holder, methodName, args), expectsResult: false);
|
|
555
615
|
}
|
|
556
616
|
|
|
557
617
|
private static object? ProxyGetProperty(object instance, string propertyName)
|
|
558
618
|
{
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
var payload = new object?[] { new HandleRef(holder.HandleId), "get:" + propertyName };
|
|
562
|
-
return CallJsCallback(holder.CallbackId, payload);
|
|
619
|
+
var holder = JsHolderFor(instance);
|
|
620
|
+
return CallJsCallback(holder.CallbackId, DispatchPayload(holder, "get_" + propertyName, []), expectsResult: true);
|
|
563
621
|
}
|
|
564
622
|
|
|
565
623
|
private static void ProxySetProperty(object instance, string propertyName, object? value)
|
|
566
624
|
{
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
var payload = new object?[] { new HandleRef(holder.HandleId), "set:" + propertyName, value };
|
|
570
|
-
CallJsCallback(holder.CallbackId, payload);
|
|
625
|
+
var holder = JsHolderFor(instance);
|
|
626
|
+
CallJsCallback(holder.CallbackId, DispatchPayload(holder, "set_" + propertyName, [value]), expectsResult: false);
|
|
571
627
|
}
|
|
572
628
|
}
|
|
573
|
-
|
|
@@ -22,9 +22,10 @@ public static partial class Bridge
|
|
|
22
22
|
$"Object of type {obj.GetType().FullName} is not awaitable. " +
|
|
23
23
|
$"Expected Task<T>, ValueTask<T>, IAsyncOperation<T>, or any type implementing GetAwaiter().");
|
|
24
24
|
|
|
25
|
+
// The handle stays valid after completion (the JS proxy releases it when collected), so
|
|
26
|
+
// the same Task can be awaited again.
|
|
25
27
|
task.ContinueWith(completed =>
|
|
26
28
|
{
|
|
27
|
-
s_handles.TryRemove(handleId, out _);
|
|
28
29
|
try
|
|
29
30
|
{
|
|
30
31
|
if (completed.IsFaulted)
|
|
@@ -115,7 +115,7 @@ public static partial class Bridge
|
|
|
115
115
|
var simple = Path.GetFileNameWithoutExtension(file);
|
|
116
116
|
if (string.IsNullOrEmpty(simple)) continue;
|
|
117
117
|
|
|
118
|
-
Assembly asm = AppDomain.CurrentDomain.GetAssemblies()
|
|
118
|
+
Assembly? asm = AppDomain.CurrentDomain.GetAssemblies()
|
|
119
119
|
.FirstOrDefault(a => string.Equals(a.GetName().Name, simple, StringComparison.OrdinalIgnoreCase));
|
|
120
120
|
if (asm is null)
|
|
121
121
|
{
|
|
@@ -123,8 +123,12 @@ public static partial class Bridge
|
|
|
123
123
|
catch { continue; }
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
// The app's own assembly (C# sources compiled into the app) contributes
|
|
127
|
+
// its internal types too: they are reachable from JS (type resolution
|
|
128
|
+
// finds non-public types), so their namespaces must be as well.
|
|
126
129
|
Type[] types;
|
|
127
|
-
try { types = asm.GetExportedTypes(); }
|
|
130
|
+
try { types = asm == Assembly.GetEntryAssembly() ? asm.GetTypes() : asm.GetExportedTypes(); }
|
|
131
|
+
catch (ReflectionTypeLoadException e) { types = e.Types.Where(t => t != null).ToArray()!; }
|
|
128
132
|
catch { types = Array.Empty<Type>(); }
|
|
129
133
|
|
|
130
134
|
var assemblyName = asm.GetName().Name;
|
|
@@ -132,7 +136,7 @@ public static partial class Bridge
|
|
|
132
136
|
|
|
133
137
|
foreach (var t in types)
|
|
134
138
|
{
|
|
135
|
-
if (string.IsNullOrEmpty(t.Namespace)) continue;
|
|
139
|
+
if (string.IsNullOrEmpty(t.Namespace) || t.Name.StartsWith('<')) continue;
|
|
136
140
|
map[t.Namespace] = assemblyName;
|
|
137
141
|
var root = t.Namespace.Split('.')[0];
|
|
138
142
|
if (!map.ContainsKey(root)) map[root] = assemblyName;
|
|
@@ -540,7 +544,7 @@ public static partial class Bridge
|
|
|
540
544
|
{
|
|
541
545
|
var handlerType = ev.EventHandlerType;
|
|
542
546
|
var method = typeof(Bridge).GetMethod(nameof(CoreApplicationUnhandledErrorHandler), BindingFlags.NonPublic | BindingFlags.Static);
|
|
543
|
-
if (method != null)
|
|
547
|
+
if (handlerType != null && method != null)
|
|
544
548
|
{
|
|
545
549
|
var del = Delegate.CreateDelegate(handlerType, method);
|
|
546
550
|
ev.AddEventHandler(null, del);
|
|
@@ -633,7 +637,7 @@ public static partial class Bridge
|
|
|
633
637
|
try
|
|
634
638
|
{
|
|
635
639
|
var iidLocal = s_iidIInspectable;
|
|
636
|
-
var hr = Marshal.QueryInterface(iunknown,
|
|
640
|
+
var hr = Marshal.QueryInterface(iunknown, in iidLocal, out var inspectable);
|
|
637
641
|
if (hr == 0 && inspectable != IntPtr.Zero)
|
|
638
642
|
{
|
|
639
643
|
Marshal.Release(iunknown);
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
host process is already running on net10. LatestMajor accepts any version >= 9. -->
|
|
17
17
|
<RollForward>LatestMajor</RollForward>
|
|
18
18
|
</PropertyGroup>
|
|
19
|
+
<ItemGroup>
|
|
20
|
+
<!-- The bridge only runs inside a Windows host, but the TFM stays plain net9.0 so the
|
|
21
|
+
net9.0 test/benchmark projects can reference it. Declaring the platform here keeps
|
|
22
|
+
CA1416 quiet for the Marshal COM APIs. Skipped when an OS-specific TFM already emits it. -->
|
|
23
|
+
<AssemblyAttribute Include="System.Runtime.Versioning.SupportedOSPlatformAttribute" Condition="'$(TargetPlatformIdentifier)' == ''">
|
|
24
|
+
<_Parameter1>windows</_Parameter1>
|
|
25
|
+
</AssemblyAttribute>
|
|
26
|
+
</ItemGroup>
|
|
19
27
|
<Target Name="WriteDotNetToolDone" AfterTargets="Publish">
|
|
20
28
|
<PropertyGroup>
|
|
21
29
|
<DotNetToolDoneFile>$(MSBuildProjectDirectory)\publish\.dotnet_tool_done</DotNetToolDoneFile>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
package/framework/tools/sbg.exe
DELETED
|
Binary file
|