From 8dda44d4ce8ebefa5c53f19c25b8564f4e0f3a4c Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Fri, 21 Jan 2022 18:42:14 -0800 Subject: [PATCH] Fix warnings and namespace conflicts in embedded scenario (#1084) * Fix warnings and namespace conflicts in embedded scenario * Fix embedded support --- .../Interop/IAgileReference.net5.cs | 2 +- .../Interop/IAgileReference.netstandard2.0.cs | 4 +- .../Projections/DataErrorsChangedEventArgs.cs | 2 +- .../Projections/IDictionary.net5.cs | 11 +- .../Projections/IEnumerable.net5.cs | 17 ++- .../Projections/IEnumerable.netstandard2.0.cs | 4 +- src/WinRT.Runtime/Projections/IList.net5.cs | 11 +- .../Projections/IReadOnlyDictionary.net5.cs | 11 +- .../Projections/IReadOnlyList.net5.cs | 11 +- .../Projections/IReferenceArray.net5.cs | 2 +- .../IReferenceArray.netstandard2.0.cs | 2 +- .../NotifyCollectionChangedEventArgs.cs | 4 +- src/WinRT.Runtime/Projections/Nullable.cs | 114 +++++++++--------- .../Projections/PropertyChangedEventArgs.cs | 2 +- src/WinRT.Runtime/Projections/Uri.cs | 2 +- .../Windows.Storage.Streams/IMarshal.cs | 2 +- 16 files changed, 113 insertions(+), 88 deletions(-) diff --git a/src/WinRT.Runtime/Interop/IAgileReference.net5.cs b/src/WinRT.Runtime/Interop/IAgileReference.net5.cs index 29ac3a408..b6e3bf8b9 100644 --- a/src/WinRT.Runtime/Interop/IAgileReference.net5.cs +++ b/src/WinRT.Runtime/Interop/IAgileReference.net5.cs @@ -160,7 +160,7 @@ public struct Vftbl public static implicit operator IGlobalInterfaceTable(IObjectReference obj) => (obj != null) ? new IGlobalInterfaceTable(obj) : null; public static implicit operator IGlobalInterfaceTable(ObjectReference obj) => (obj != null) ? new IGlobalInterfaceTable(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As(); public A As() => _obj.AsType(); diff --git a/src/WinRT.Runtime/Interop/IAgileReference.netstandard2.0.cs b/src/WinRT.Runtime/Interop/IAgileReference.netstandard2.0.cs index 5a7558f5c..671f33c3f 100644 --- a/src/WinRT.Runtime/Interop/IAgileReference.netstandard2.0.cs +++ b/src/WinRT.Runtime/Interop/IAgileReference.netstandard2.0.cs @@ -91,7 +91,7 @@ private static int Do_Abi_Resolve(IntPtr thisPtr, Guid* riid, IntPtr* objectRefe public static implicit operator IAgileReference(IObjectReference obj) => (obj != null) ? new IAgileReference(obj) : null; public static implicit operator IAgileReference(ObjectReference obj) => (obj != null) ? new IAgileReference(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As(); public A As() => _obj.AsType(); @@ -181,7 +181,7 @@ public struct Vftbl public static implicit operator IGlobalInterfaceTable(IObjectReference obj) => (obj != null) ? new IGlobalInterfaceTable(obj) : null; public static implicit operator IGlobalInterfaceTable(ObjectReference obj) => (obj != null) ? new IGlobalInterfaceTable(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As(); public A As() => _obj.AsType(); diff --git a/src/WinRT.Runtime/Projections/DataErrorsChangedEventArgs.cs b/src/WinRT.Runtime/Projections/DataErrorsChangedEventArgs.cs index 2995d4361..bc4610997 100644 --- a/src/WinRT.Runtime/Projections/DataErrorsChangedEventArgs.cs +++ b/src/WinRT.Runtime/Projections/DataErrorsChangedEventArgs.cs @@ -39,7 +39,7 @@ public struct Vftbl public static implicit operator WinRTDataErrorsChangedEventArgsRuntimeClassFactory(IObjectReference obj) => (obj != null) ? new WinRTDataErrorsChangedEventArgsRuntimeClassFactory(obj) : null; public static implicit operator WinRTDataErrorsChangedEventArgsRuntimeClassFactory(ObjectReference obj) => (obj != null) ? new WinRTDataErrorsChangedEventArgsRuntimeClassFactory(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As(); public A As() => _obj.AsType(); diff --git a/src/WinRT.Runtime/Projections/IDictionary.net5.cs b/src/WinRT.Runtime/Projections/IDictionary.net5.cs index ab9adeae3..a7b2d300d 100644 --- a/src/WinRT.Runtime/Projections/IDictionary.net5.cs +++ b/src/WinRT.Runtime/Projections/IDictionary.net5.cs @@ -295,9 +295,14 @@ public static unsafe uint get_Size(IObjectReference obj) namespace ABI.System.Collections.Generic { - using ABI.Windows.Foundation.Collections; - - public static class IDictionaryMethods + using ABI.Windows.Foundation.Collections; + +#if EMBED + internal +#else + public +#endif + static class IDictionaryMethods { public static int get_Count(IObjectReference obj) { diff --git a/src/WinRT.Runtime/Projections/IEnumerable.net5.cs b/src/WinRT.Runtime/Projections/IEnumerable.net5.cs index f090f5360..48a84c8af 100644 --- a/src/WinRT.Runtime/Projections/IEnumerable.net5.cs +++ b/src/WinRT.Runtime/Projections/IEnumerable.net5.cs @@ -59,7 +59,7 @@ public unsafe static IEnumerator First(IObjectReference obj) [Guid("FAA585EA-6214-4217-AFDA-7F46DE5869B3")] internal interface IIterable : ABI.System.Collections.Generic.IEnumerable { - public static Guid PIID = ABI.System.Collections.Generic.IEnumerable.PIID; + public static new Guid PIID = ABI.System.Collections.Generic.IEnumerable.PIID; } } @@ -116,9 +116,14 @@ IEnumerator IEnumerable.GetEnumerator() namespace ABI.System.Collections.Generic { using global::System; - using global::System.Runtime.CompilerServices; - - public static class IEnumerableMethods + using global::System.Runtime.CompilerServices; + +#if EMBED + internal +#else + public +#endif + static class IEnumerableMethods { public static global::System.Collections.Generic.IEnumerator GetEnumerator(IObjectReference obj) { @@ -379,7 +384,7 @@ public void Dispose() } } - public sealed class ToAbiHelper : global::Windows.Foundation.Collections.IIterator, IBindableIterator + public sealed class ToAbiHelper : global::Windows.Foundation.Collections.IIterator, global::Microsoft.UI.Xaml.Interop.IBindableIterator { private readonly global::System.Collections.Generic.IEnumerator m_enumerator; private bool m_firstItem = true; @@ -469,7 +474,7 @@ public uint GetMany(ref T[] items) public bool MoveNext() => _MoveNext(); - uint IBindableIterator.GetMany(ref object[] items) + uint global::Microsoft.UI.Xaml.Interop.IBindableIterator.GetMany(ref object[] items) { // Should not be called. throw new NotImplementedException(); diff --git a/src/WinRT.Runtime/Projections/IEnumerable.netstandard2.0.cs b/src/WinRT.Runtime/Projections/IEnumerable.netstandard2.0.cs index 36a24085b..8a008b0b2 100644 --- a/src/WinRT.Runtime/Projections/IEnumerable.netstandard2.0.cs +++ b/src/WinRT.Runtime/Projections/IEnumerable.netstandard2.0.cs @@ -342,7 +342,7 @@ public void Dispose() } } - public sealed class ToAbiHelper : global::Windows.Foundation.Collections.IIterator, IBindableIterator + public sealed class ToAbiHelper : global::Windows.Foundation.Collections.IIterator, global::Microsoft.UI.Xaml.Interop.IBindableIterator { private readonly global::System.Collections.Generic.IEnumerator m_enumerator; private bool m_firstItem = true; @@ -432,7 +432,7 @@ public uint GetMany(ref T[] items) public bool MoveNext() => _MoveNext(); - uint IBindableIterator.GetMany(ref object[] items) + uint global::Microsoft.UI.Xaml.Interop.IBindableIterator.GetMany(ref object[] items) { // Should not be called. throw new NotImplementedException(); diff --git a/src/WinRT.Runtime/Projections/IList.net5.cs b/src/WinRT.Runtime/Projections/IList.net5.cs index eacd75f46..a989accb5 100644 --- a/src/WinRT.Runtime/Projections/IList.net5.cs +++ b/src/WinRT.Runtime/Projections/IList.net5.cs @@ -148,9 +148,14 @@ IEnumerator IEnumerable.GetEnumerator() namespace ABI.System.Collections.Generic { using global::System; - using global::System.Runtime.CompilerServices; - - public static class IListMethods { + using global::System.Runtime.CompilerServices; + +#if EMBED + internal +#else + public +#endif + static class IListMethods { public static int get_Count(IObjectReference obj) { diff --git a/src/WinRT.Runtime/Projections/IReadOnlyDictionary.net5.cs b/src/WinRT.Runtime/Projections/IReadOnlyDictionary.net5.cs index 5d130bace..f2d7eddbb 100644 --- a/src/WinRT.Runtime/Projections/IReadOnlyDictionary.net5.cs +++ b/src/WinRT.Runtime/Projections/IReadOnlyDictionary.net5.cs @@ -178,9 +178,14 @@ public static unsafe uint get_Size(IObjectReference obj) namespace ABI.System.Collections.Generic { using global::System; - using global::System.Runtime.CompilerServices; - - public static class IReadOnlyDictionaryMethods + using global::System.Runtime.CompilerServices; + +#if EMBED + internal +#else + public +#endif + static class IReadOnlyDictionaryMethods { public static int get_Count(IObjectReference obj) { diff --git a/src/WinRT.Runtime/Projections/IReadOnlyList.net5.cs b/src/WinRT.Runtime/Projections/IReadOnlyList.net5.cs index a6e308072..8bfb99245 100644 --- a/src/WinRT.Runtime/Projections/IReadOnlyList.net5.cs +++ b/src/WinRT.Runtime/Projections/IReadOnlyList.net5.cs @@ -164,9 +164,14 @@ public static unsafe uint get_Size(IObjectReference obj) namespace ABI.System.Collections.Generic { using global::System; - using global::System.Runtime.CompilerServices; - - public static class IReadOnlyListMethods + using global::System.Runtime.CompilerServices; + +#if EMBED + internal +#else + public +#endif + static class IReadOnlyListMethods { public static int get_Count(IObjectReference obj) { diff --git a/src/WinRT.Runtime/Projections/IReferenceArray.net5.cs b/src/WinRT.Runtime/Projections/IReferenceArray.net5.cs index 7d70e4ae4..cc13c5a09 100644 --- a/src/WinRT.Runtime/Projections/IReferenceArray.net5.cs +++ b/src/WinRT.Runtime/Projections/IReferenceArray.net5.cs @@ -121,7 +121,7 @@ internal unsafe Vftbl(IntPtr thisPtr) public static implicit operator IReferenceArray(IObjectReference obj) => (obj != null) ? new IReferenceArray(obj) : null; public static implicit operator IReferenceArray(ObjectReference obj) => (obj != null) ? new IReferenceArray(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As(); public A As() => _obj.AsType(); diff --git a/src/WinRT.Runtime/Projections/IReferenceArray.netstandard2.0.cs b/src/WinRT.Runtime/Projections/IReferenceArray.netstandard2.0.cs index f8403ddcc..01fb0dafe 100644 --- a/src/WinRT.Runtime/Projections/IReferenceArray.netstandard2.0.cs +++ b/src/WinRT.Runtime/Projections/IReferenceArray.netstandard2.0.cs @@ -125,7 +125,7 @@ internal unsafe Vftbl(IntPtr thisPtr) public static implicit operator IReferenceArray(IObjectReference obj) => (obj != null) ? new IReferenceArray(obj) : null; public static implicit operator IReferenceArray(ObjectReference obj) => (obj != null) ? new IReferenceArray(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As(); public A As() => _obj.AsType(); diff --git a/src/WinRT.Runtime/Projections/NotifyCollectionChangedEventArgs.cs b/src/WinRT.Runtime/Projections/NotifyCollectionChangedEventArgs.cs index 3dab26ffc..d9e592fbc 100644 --- a/src/WinRT.Runtime/Projections/NotifyCollectionChangedEventArgs.cs +++ b/src/WinRT.Runtime/Projections/NotifyCollectionChangedEventArgs.cs @@ -33,7 +33,7 @@ public struct Vftbl internal static ObjectReference FromAbi(IntPtr thisPtr) => ObjectReference.FromAbi(thisPtr); public static implicit operator INotifyCollectionChangedEventArgs(IObjectReference obj) => (obj != null) ? new INotifyCollectionChangedEventArgs(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IObjectReference ObjRef { get => _obj; } public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As(); @@ -125,7 +125,7 @@ public struct Vftbl public static implicit operator WinRTNotifyCollectionChangedEventArgsRuntimeClassFactory(IObjectReference obj) => (obj != null) ? new WinRTNotifyCollectionChangedEventArgsRuntimeClassFactory(obj) : null; public static implicit operator WinRTNotifyCollectionChangedEventArgsRuntimeClassFactory(ObjectReference obj) => (obj != null) ? new WinRTNotifyCollectionChangedEventArgsRuntimeClassFactory(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As(); public A As() => _obj.AsType(); diff --git a/src/WinRT.Runtime/Projections/Nullable.cs b/src/WinRT.Runtime/Projections/Nullable.cs index eb2e86287..f537d6d81 100644 --- a/src/WinRT.Runtime/Projections/Nullable.cs +++ b/src/WinRT.Runtime/Projections/Nullable.cs @@ -14,15 +14,15 @@ namespace ABI.Windows.Foundation internal static class BoxedValueIReferenceImpl { - private static Nullable.Vftbl AbiToProjectionVftable; + private static global::ABI.System.Nullable.Vftbl AbiToProjectionVftable; public static IntPtr AbiToProjectionVftablePtr; static unsafe BoxedValueIReferenceImpl() { - AbiToProjectionVftable = new Nullable.Vftbl + AbiToProjectionVftable = new global::ABI.System.Nullable.Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, - get_Value_0 = global::System.Delegate.CreateDelegate(Nullable.Vftbl.get_Value_0_Type, typeof(BoxedValueIReferenceImpl).GetMethod("Do_Abi_get_Value_0", BindingFlags.NonPublic | BindingFlags.Static).MakeGenericMethod(Marshaler.AbiType)) + get_Value_0 = global::System.Delegate.CreateDelegate(global::ABI.System.Nullable.Vftbl.get_Value_0_Type, typeof(BoxedValueIReferenceImpl).GetMethod("Do_Abi_get_Value_0", BindingFlags.NonPublic | BindingFlags.Static).MakeGenericMethod(Marshaler.AbiType)) }; var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(BoxedValueIReferenceImpl), Marshal.SizeOf() + sizeof(IntPtr) * 1); Marshal.StructureToPtr(AbiToProjectionVftable.IInspectableVftbl, (IntPtr)nativeVftbl, false); @@ -186,7 +186,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, int* value); private static readonly GetValueDelegate delegateCache; #endif @@ -196,7 +196,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -207,7 +207,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, int* __return_value__) @@ -263,7 +263,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, IntPtr* value); private static readonly GetValueDelegate delegateCache; #endif @@ -273,7 +273,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -284,7 +284,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, IntPtr* __return_value__) @@ -341,7 +341,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, byte* value); private static readonly GetValueDelegate delegateCache; #endif @@ -351,7 +351,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -362,7 +362,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, byte* __return_value__) @@ -418,7 +418,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, sbyte* value); private static readonly GetValueDelegate delegateCache; #endif @@ -428,7 +428,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -439,7 +439,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, sbyte* __return_value__) @@ -495,7 +495,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, short* value); private static readonly GetValueDelegate delegateCache; #endif @@ -505,7 +505,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -516,7 +516,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, short* __return_value__) @@ -572,7 +572,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, ushort* value); private static readonly GetValueDelegate delegateCache; #endif @@ -582,7 +582,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -593,7 +593,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, ushort* __return_value__) @@ -649,7 +649,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, uint* value); private static readonly GetValueDelegate delegateCache; #endif @@ -659,7 +659,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -670,7 +670,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, uint* __return_value__) @@ -726,7 +726,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, long* value); private static readonly GetValueDelegate delegateCache; #endif @@ -736,7 +736,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -747,7 +747,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, long* __return_value__) @@ -803,7 +803,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, ulong* value); private static readonly GetValueDelegate delegateCache; #endif @@ -813,7 +813,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -824,7 +824,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, ulong* __return_value__) @@ -880,7 +880,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, float* value); private static readonly GetValueDelegate delegateCache; #endif @@ -890,7 +890,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -901,7 +901,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, float* __return_value__) @@ -957,7 +957,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, double* value); private static readonly GetValueDelegate delegateCache; #endif @@ -967,7 +967,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -978,7 +978,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, double* __return_value__) @@ -1034,7 +1034,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, char* value); private static readonly GetValueDelegate delegateCache; #endif @@ -1044,7 +1044,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -1055,7 +1055,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, char* __return_value__) @@ -1111,7 +1111,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, bool* value); private static readonly GetValueDelegate delegateCache; #endif @@ -1121,7 +1121,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -1132,7 +1132,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, bool* __return_value__) @@ -1188,7 +1188,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, Guid* value); private static readonly GetValueDelegate delegateCache; #endif @@ -1198,7 +1198,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -1209,7 +1209,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, Guid* __return_value__) @@ -1265,7 +1265,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, DateTimeOffset* value); private static readonly GetValueDelegate delegateCache; #endif @@ -1275,7 +1275,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -1286,7 +1286,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, DateTimeOffset* __return_value__) @@ -1343,7 +1343,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, TimeSpan* value); private static readonly GetValueDelegate delegateCache; #endif @@ -1353,7 +1353,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -1364,7 +1364,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, TimeSpan* __return_value__) @@ -1421,7 +1421,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, IntPtr* value); private static readonly GetValueDelegate delegateCache; #endif @@ -1431,7 +1431,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -1442,7 +1442,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, IntPtr* __return_value__) @@ -1482,7 +1482,7 @@ public unsafe struct Vftbl private static readonly Vftbl AbiToProjectionVftable; public static readonly IntPtr AbiToProjectionVftablePtr; -#if NETSTANDARD2_0 +#if !NET private unsafe delegate int GetValueDelegate(IntPtr thisPtr, Type* value); private static readonly GetValueDelegate delegateCache; #endif @@ -1492,7 +1492,7 @@ static Vftbl() AbiToProjectionVftable = new Vftbl { IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, -#if NETSTANDARD2_0 +#if !NET _Get_Value_0 = Marshal.GetFunctionPointerForDelegate(delegateCache = Do_Abi_get_Value_0).ToPointer() #else _Get_Value_0 = (delegate* unmanaged)&Do_Abi_get_Value_0 @@ -1503,7 +1503,7 @@ static Vftbl() AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; } -#if !NETSTANDARD2_0 +#if NET [UnmanagedCallersOnly] #endif private static unsafe int Do_Abi_get_Value_0(IntPtr thisPtr, Type* __return_value__) diff --git a/src/WinRT.Runtime/Projections/PropertyChangedEventArgs.cs b/src/WinRT.Runtime/Projections/PropertyChangedEventArgs.cs index 38a62792e..4140fa1cb 100644 --- a/src/WinRT.Runtime/Projections/PropertyChangedEventArgs.cs +++ b/src/WinRT.Runtime/Projections/PropertyChangedEventArgs.cs @@ -35,7 +35,7 @@ public struct Vftbl public static implicit operator WinRTPropertyChangedEventArgsRuntimeClassFactory(IObjectReference obj) => (obj != null) ? new WinRTPropertyChangedEventArgsRuntimeClassFactory(obj) : null; public static implicit operator WinRTPropertyChangedEventArgsRuntimeClassFactory(ObjectReference obj) => (obj != null) ? new WinRTPropertyChangedEventArgsRuntimeClassFactory(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As(); public A As() => _obj.AsType(); diff --git a/src/WinRT.Runtime/Projections/Uri.cs b/src/WinRT.Runtime/Projections/Uri.cs index 1b52e00d0..beddb718d 100644 --- a/src/WinRT.Runtime/Projections/Uri.cs +++ b/src/WinRT.Runtime/Projections/Uri.cs @@ -54,7 +54,7 @@ public unsafe struct Vftbl public static implicit operator WinRTUriRuntimeClassFactory(IObjectReference obj) => (obj != null) ? new WinRTUriRuntimeClassFactory(obj) : null; public static implicit operator WinRTUriRuntimeClassFactory(ObjectReference obj) => (obj != null) ? new WinRTUriRuntimeClassFactory(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As(); public A As() => _obj.AsType(); diff --git a/src/cswinrt/strings/additions/Windows.Storage.Streams/IMarshal.cs b/src/cswinrt/strings/additions/Windows.Storage.Streams/IMarshal.cs index bc005cfab..47d7a3834 100644 --- a/src/cswinrt/strings/additions/Windows.Storage.Streams/IMarshal.cs +++ b/src/cswinrt/strings/additions/Windows.Storage.Streams/IMarshal.cs @@ -196,7 +196,7 @@ private static int Do_Abi_DisconnectObject_5(IntPtr thisPtr, uint dwReserved) internal static ObjectReference FromAbi(IntPtr thisPtr) => ObjectReference.FromAbi(thisPtr); public static implicit operator IMarshal(IObjectReference obj) => (obj != null) ? new IMarshal(obj) : null; - protected readonly ObjectReference _obj; + private readonly ObjectReference _obj; public IObjectReference ObjRef { get => _obj; } public IntPtr ThisPtr => _obj.ThisPtr; public ObjectReference AsInterface() => _obj.As();