@nativescript/windows 0.1.0-alpha.53 → 0.1.0-alpha.54
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/dotnet-bridge/BinaryProtocol.cs +6 -0
- package/framework/dotnet-bridge/Bridge.BinaryDispatch.cs +16 -5
- package/framework/libs/arm64/nativescript.dll +0 -0
- package/framework/libs/devtools/arm64/nativescript.dll +0 -0
- package/framework/libs/devtools/x64/nativescript.dll +0 -0
- package/framework/libs/x64/nativescript.dll +0 -0
- package/package.json +1 -1
|
@@ -115,6 +115,12 @@ internal ref struct BinWriter(ArrayBufferWriter<byte> buf)
|
|
|
115
115
|
_buf.Advance(4);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
public void WriteI64(long v)
|
|
119
|
+
{
|
|
120
|
+
BinaryPrimitives.WriteInt64LittleEndian(_buf.GetSpan(8), v);
|
|
121
|
+
_buf.Advance(8);
|
|
122
|
+
}
|
|
123
|
+
|
|
118
124
|
public void WriteF64(double v)
|
|
119
125
|
{
|
|
120
126
|
BinaryPrimitives.WriteDoubleLittleEndian(_buf.GetSpan(8), v);
|
|
@@ -158,12 +158,23 @@ public static partial class Bridge
|
|
|
158
158
|
s_handles.TryGetValue(hr.Id, out var obj);
|
|
159
159
|
return obj;
|
|
160
160
|
}
|
|
161
|
-
if (value is WinRtRef wr
|
|
161
|
+
if (value is WinRtRef wr)
|
|
162
162
|
{
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
if (wr.Ptr == 0) return null;
|
|
164
|
+
var nativePtr = new IntPtr((long)wr.Ptr);
|
|
165
|
+
// 1. Typed QI first: works for COM/CsWinRT interface types that carry a
|
|
166
|
+
// [Guid] attribute. More precise than a generic RCW for strongly-typed
|
|
167
|
+
// parameters such as Windows.UI.Xaml.UIElement.
|
|
168
|
+
if (targetType != typeof(object) && targetType.GUID != Guid.Empty)
|
|
169
|
+
{
|
|
170
|
+
try { return Marshal.GetTypedObjectForIUnknown(nativePtr, targetType); }
|
|
171
|
+
catch { }
|
|
172
|
+
}
|
|
173
|
+
// 2. Generic RCW: .NET WinRT interop calls IInspectable::GetRuntimeClassName
|
|
174
|
+
// and projects to the appropriate CsWinRT type automatically.
|
|
175
|
+
// Do NOT swallow the exception — a null return silently breaks the call
|
|
176
|
+
// downstream; a thrown exception surfaces a meaningful error instead.
|
|
177
|
+
return Marshal.GetObjectForIUnknown(nativePtr);
|
|
167
178
|
}
|
|
168
179
|
if (value.GetType() == targetType) return value;
|
|
169
180
|
try { return Convert.ChangeType(value, targetType); }
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|