Skip to content

Commit

Permalink
Fix warnings and namespace conflicts in embedded scenario (#1084)
Browse files Browse the repository at this point in the history
* Fix warnings and namespace conflicts in embedded scenario

* Fix embedded support
  • Loading branch information
manodasanW authored Jan 22, 2022
1 parent 0041d18 commit 8dda44d
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 88 deletions.
2 changes: 1 addition & 1 deletion src/WinRT.Runtime/Interop/IAgileReference.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vftbl> obj) => (obj != null) ? new IGlobalInterfaceTable(obj) : null;
protected readonly ObjectReference<Vftbl> _obj;
private readonly ObjectReference<Vftbl> _obj;
public IntPtr ThisPtr => _obj.ThisPtr;
public ObjectReference<I> AsInterface<I>() => _obj.As<I>();
public A As<A>() => _obj.AsType<A>();
Expand Down
4 changes: 2 additions & 2 deletions src/WinRT.Runtime/Interop/IAgileReference.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vftbl> obj) => (obj != null) ? new IAgileReference(obj) : null;
protected readonly ObjectReference<Vftbl> _obj;
private readonly ObjectReference<Vftbl> _obj;
public IntPtr ThisPtr => _obj.ThisPtr;
public ObjectReference<I> AsInterface<I>() => _obj.As<I>();
public A As<A>() => _obj.AsType<A>();
Expand Down Expand Up @@ -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<Vftbl> obj) => (obj != null) ? new IGlobalInterfaceTable(obj) : null;
protected readonly ObjectReference<Vftbl> _obj;
private readonly ObjectReference<Vftbl> _obj;
public IntPtr ThisPtr => _obj.ThisPtr;
public ObjectReference<I> AsInterface<I>() => _obj.As<I>();
public A As<A>() => _obj.AsType<A>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vftbl> obj) => (obj != null) ? new WinRTDataErrorsChangedEventArgsRuntimeClassFactory(obj) : null;
protected readonly ObjectReference<Vftbl> _obj;
private readonly ObjectReference<Vftbl> _obj;
public IntPtr ThisPtr => _obj.ThisPtr;
public ObjectReference<I> AsInterface<I>() => _obj.As<I>();
public A As<A>() => _obj.AsType<A>();
Expand Down
11 changes: 8 additions & 3 deletions src/WinRT.Runtime/Projections/IDictionary.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<K, V>
using ABI.Windows.Foundation.Collections;

#if EMBED
internal
#else
public
#endif
static class IDictionaryMethods<K, V>
{
public static int get_Count(IObjectReference obj)
{
Expand Down
17 changes: 11 additions & 6 deletions src/WinRT.Runtime/Projections/IEnumerable.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public unsafe static IEnumerator<T> First(IObjectReference obj)
[Guid("FAA585EA-6214-4217-AFDA-7F46DE5869B3")]
internal interface IIterable<T> : ABI.System.Collections.Generic.IEnumerable<T>
{
public static Guid PIID = ABI.System.Collections.Generic.IEnumerable<T>.PIID;
public static new Guid PIID = ABI.System.Collections.Generic.IEnumerable<T>.PIID;
}
}

Expand Down Expand Up @@ -116,9 +116,14 @@ IEnumerator IEnumerable.GetEnumerator()
namespace ABI.System.Collections.Generic
{
using global::System;
using global::System.Runtime.CompilerServices;

public static class IEnumerableMethods<T>
using global::System.Runtime.CompilerServices;

#if EMBED
internal
#else
public
#endif
static class IEnumerableMethods<T>
{
public static global::System.Collections.Generic.IEnumerator<T> GetEnumerator(IObjectReference obj)
{
Expand Down Expand Up @@ -379,7 +384,7 @@ public void Dispose()
}
}

public sealed class ToAbiHelper : global::Windows.Foundation.Collections.IIterator<T>, IBindableIterator
public sealed class ToAbiHelper : global::Windows.Foundation.Collections.IIterator<T>, global::Microsoft.UI.Xaml.Interop.IBindableIterator
{
private readonly global::System.Collections.Generic.IEnumerator<T> m_enumerator;
private bool m_firstItem = true;
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/WinRT.Runtime/Projections/IEnumerable.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public void Dispose()
}
}

public sealed class ToAbiHelper : global::Windows.Foundation.Collections.IIterator<T>, IBindableIterator
public sealed class ToAbiHelper : global::Windows.Foundation.Collections.IIterator<T>, global::Microsoft.UI.Xaml.Interop.IBindableIterator
{
private readonly global::System.Collections.Generic.IEnumerator<T> m_enumerator;
private bool m_firstItem = true;
Expand Down Expand Up @@ -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();
Expand Down
11 changes: 8 additions & 3 deletions src/WinRT.Runtime/Projections/IList.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,14 @@ IEnumerator IEnumerable.GetEnumerator()
namespace ABI.System.Collections.Generic
{
using global::System;
using global::System.Runtime.CompilerServices;

public static class IListMethods<T> {
using global::System.Runtime.CompilerServices;

#if EMBED
internal
#else
public
#endif
static class IListMethods<T> {

public static int get_Count(IObjectReference obj)
{
Expand Down
11 changes: 8 additions & 3 deletions src/WinRT.Runtime/Projections/IReadOnlyDictionary.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<K, V>
using global::System.Runtime.CompilerServices;

#if EMBED
internal
#else
public
#endif
static class IReadOnlyDictionaryMethods<K, V>
{
public static int get_Count(IObjectReference obj)
{
Expand Down
11 changes: 8 additions & 3 deletions src/WinRT.Runtime/Projections/IReadOnlyList.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>
using global::System.Runtime.CompilerServices;

#if EMBED
internal
#else
public
#endif
static class IReadOnlyListMethods<T>
{
public static int get_Count(IObjectReference obj)
{
Expand Down
2 changes: 1 addition & 1 deletion src/WinRT.Runtime/Projections/IReferenceArray.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ internal unsafe Vftbl(IntPtr thisPtr)

public static implicit operator IReferenceArray<T>(IObjectReference obj) => (obj != null) ? new IReferenceArray<T>(obj) : null;
public static implicit operator IReferenceArray<T>(ObjectReference<Vftbl> obj) => (obj != null) ? new IReferenceArray<T>(obj) : null;
protected readonly ObjectReference<Vftbl> _obj;
private readonly ObjectReference<Vftbl> _obj;
public IntPtr ThisPtr => _obj.ThisPtr;
public ObjectReference<I> AsInterface<I>() => _obj.As<I>();
public A As<A>() => _obj.AsType<A>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ internal unsafe Vftbl(IntPtr thisPtr)

public static implicit operator IReferenceArray<T>(IObjectReference obj) => (obj != null) ? new IReferenceArray<T>(obj) : null;
public static implicit operator IReferenceArray<T>(ObjectReference<Vftbl> obj) => (obj != null) ? new IReferenceArray<T>(obj) : null;
protected readonly ObjectReference<Vftbl> _obj;
private readonly ObjectReference<Vftbl> _obj;
public IntPtr ThisPtr => _obj.ThisPtr;
public ObjectReference<I> AsInterface<I>() => _obj.As<I>();
public A As<A>() => _obj.AsType<A>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public struct Vftbl
internal static ObjectReference<Vftbl> FromAbi(IntPtr thisPtr) => ObjectReference<Vftbl>.FromAbi(thisPtr);

public static implicit operator INotifyCollectionChangedEventArgs(IObjectReference obj) => (obj != null) ? new INotifyCollectionChangedEventArgs(obj) : null;
protected readonly ObjectReference<Vftbl> _obj;
private readonly ObjectReference<Vftbl> _obj;
public IObjectReference ObjRef { get => _obj; }
public IntPtr ThisPtr => _obj.ThisPtr;
public ObjectReference<I> AsInterface<I>() => _obj.As<I>();
Expand Down Expand Up @@ -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<Vftbl> obj) => (obj != null) ? new WinRTNotifyCollectionChangedEventArgsRuntimeClassFactory(obj) : null;
protected readonly ObjectReference<Vftbl> _obj;
private readonly ObjectReference<Vftbl> _obj;
public IntPtr ThisPtr => _obj.ThisPtr;
public ObjectReference<I> AsInterface<I>() => _obj.As<I>();
public A As<A>() => _obj.AsType<A>();
Expand Down
Loading

0 comments on commit 8dda44d

Please sign in to comment.