Somehow these slipped through previous rounds of annotating.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Runtime.CompilerServices;
namespace System.Numerics
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
[Guid("00000102-0000-0000-C000-000000000046")]
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
[Guid("00000101-0000-0000-C000-000000000046")]
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
[Guid("00020404-0000-0000-C000-000000000046")]
public interface IEnumVARIANT
{
[PreserveSig]
- int Next(int celt, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] object[] rgVar, IntPtr pceltFetched);
+ int Next(int celt, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] object?[] rgVar, IntPtr pceltFetched);
[PreserveSig]
int Skip(int celt);
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
[StructLayout(LayoutKind.Sequential)]
void GetSizeMax(out long pcbSize);
// IMoniker portion
- void BindToObject(IBindCtx pbc, IMoniker pmkToLeft, [In()] ref Guid riidResult, [MarshalAs(UnmanagedType.Interface)] out object ppvResult);
- void BindToStorage(IBindCtx pbc, IMoniker pmkToLeft, [In()] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppvObj);
- void Reduce(IBindCtx pbc, int dwReduceHowFar, ref IMoniker ppmkToLeft, out IMoniker ppmkReduced);
- void ComposeWith(IMoniker pmkRight, [MarshalAs(UnmanagedType.Bool)] bool fOnlyIfNotGeneric, out IMoniker ppmkComposite);
- void Enum([MarshalAs(UnmanagedType.Bool)] bool fForward, out IEnumMoniker ppenumMoniker);
+ void BindToObject(IBindCtx pbc, IMoniker? pmkToLeft, [In()] ref Guid riidResult, [MarshalAs(UnmanagedType.Interface)] out object ppvResult);
+ void BindToStorage(IBindCtx pbc, IMoniker? pmkToLeft, [In()] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppvObj);
+ void Reduce(IBindCtx pbc, int dwReduceHowFar, ref IMoniker? ppmkToLeft, out IMoniker? ppmkReduced);
+ void ComposeWith(IMoniker pmkRight, [MarshalAs(UnmanagedType.Bool)] bool fOnlyIfNotGeneric, out IMoniker? ppmkComposite);
+ void Enum([MarshalAs(UnmanagedType.Bool)] bool fForward, out IEnumMoniker? ppenumMoniker);
[PreserveSig]
int IsEqual(IMoniker pmkOtherMoniker);
void Hash(out int pdwHash);
[PreserveSig]
- int IsRunning(IBindCtx pbc, IMoniker pmkToLeft, IMoniker pmkNewlyRunning);
- void GetTimeOfLastChange(IBindCtx pbc, IMoniker pmkToLeft, out FILETIME pFileTime);
+ int IsRunning(IBindCtx pbc, IMoniker? pmkToLeft, IMoniker? pmkNewlyRunning);
+ void GetTimeOfLastChange(IBindCtx pbc, IMoniker? pmkToLeft, out FILETIME pFileTime);
void Inverse(out IMoniker ppmk);
- void CommonPrefixWith(IMoniker pmkOther, out IMoniker ppmkPrefix);
- void RelativePathTo(IMoniker pmkOther, out IMoniker ppmkRelPath);
- void GetDisplayName(IBindCtx pbc, IMoniker pmkToLeft, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplayName);
+ void CommonPrefixWith(IMoniker pmkOther, out IMoniker? ppmkPrefix);
+ void RelativePathTo(IMoniker pmkOther, out IMoniker? ppmkRelPath);
+ void GetDisplayName(IBindCtx pbc, IMoniker? pmkToLeft, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplayName);
void ParseDisplayName(IBindCtx pbc, IMoniker pmkToLeft, [MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, out int pchEaten, out IMoniker ppmkOut);
[PreserveSig]
int IsSystemMoniker(out int pdwMksys);
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
[Guid("0000010b-0000-0000-C000-000000000046")]
[PreserveSig]
int IsDirty();
void Load([MarshalAs(UnmanagedType.LPWStr)] string pszFileName, int dwMode);
- void Save([MarshalAs(UnmanagedType.LPWStr)] string pszFileName, [MarshalAs(UnmanagedType.Bool)] bool fRemember);
+ void Save([MarshalAs(UnmanagedType.LPWStr)] string? pszFileName, [MarshalAs(UnmanagedType.Bool)] bool fRemember);
void SaveCompleted([MarshalAs(UnmanagedType.LPWStr)] string pszFileName);
void GetCurFile([MarshalAs(UnmanagedType.LPWStr)] out string ppszFileName);
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
[Guid("00000010-0000-0000-C000-000000000046")]
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
public enum DESCKIND
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
public enum TYPEKIND
void GetDllEntry(int memid, INVOKEKIND invKind, IntPtr pBstrDllName, IntPtr pBstrName, IntPtr pwOrdinal);
void GetRefTypeInfo(int hRef, out ITypeInfo ppTI);
void AddressOfMember(int memid, INVOKEKIND invKind, out IntPtr ppv);
- void CreateInstance([MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [In] ref Guid riid, [MarshalAs(UnmanagedType.IUnknown), Out] out object ppvObj);
- void GetMops(int memid, out string pBstrMops);
+ void CreateInstance([MarshalAs(UnmanagedType.IUnknown)] object? pUnkOuter, [In] ref Guid riid, [MarshalAs(UnmanagedType.IUnknown), Out] out object ppvObj);
+ void GetMops(int memid, out string? pBstrMops);
void GetContainingTypeLib(out ITypeLib ppTLB, out int pIndex);
[PreserveSig]
void ReleaseTypeAttr(IntPtr pTypeAttr);
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
[Guid("00020412-0000-0000-C000-000000000046")]
new void GetDllEntry(int memid, INVOKEKIND invKind, IntPtr pBstrDllName, IntPtr pBstrName, IntPtr pwOrdinal);
new void GetRefTypeInfo(int hRef, out ITypeInfo ppTI);
new void AddressOfMember(int memid, INVOKEKIND invKind, out IntPtr ppv);
- new void CreateInstance([MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [In] ref Guid riid, [MarshalAs(UnmanagedType.IUnknown), Out] out object ppvObj);
- new void GetMops(int memid, out string pBstrMops);
+ new void CreateInstance([MarshalAs(UnmanagedType.IUnknown)] object? pUnkOuter, [In] ref Guid riid, [MarshalAs(UnmanagedType.IUnknown), Out] out object ppvObj);
+ new void GetMops(int memid, out string? pBstrMops);
new void GetContainingTypeLib(out ITypeLib ppTLB, out int pIndex);
[PreserveSig]
new void ReleaseTypeAttr(IntPtr pTypeAttr);
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
public enum SYSKIND
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Runtime.InteropServices.ComTypes
{
[Guid("00020411-0000-0000-C000-000000000046")]
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics;
public interface IClassFactory
{
void CreateInstance(
- [MarshalAs(UnmanagedType.Interface)] object pUnkOuter,
+ [MarshalAs(UnmanagedType.Interface)] object? pUnkOuter,
ref Guid riid,
- [MarshalAs(UnmanagedType.Interface)] out object ppvObject);
+ [MarshalAs(UnmanagedType.Interface)] out object? ppvObject);
void LockServer([MarshalAs(UnmanagedType.Bool)] bool fLock);
}
internal interface IClassFactory2 : IClassFactory
{
new void CreateInstance(
- [MarshalAs(UnmanagedType.Interface)] object pUnkOuter,
+ [MarshalAs(UnmanagedType.Interface)] object? pUnkOuter,
ref Guid riid,
- [MarshalAs(UnmanagedType.Interface)] out object ppvObject);
+ [MarshalAs(UnmanagedType.Interface)] out object? ppvObject);
new void LockServer([MarshalAs(UnmanagedType.Bool)] bool fLock);
[MarshalAs(UnmanagedType.BStr)] out string pBstrKey);
void CreateInstanceLic(
- [MarshalAs(UnmanagedType.Interface)] object pUnkOuter,
- [MarshalAs(UnmanagedType.Interface)] object pUnkReserved,
+ [MarshalAs(UnmanagedType.Interface)] object? pUnkOuter,
+ [MarshalAs(UnmanagedType.Interface)] object? pUnkReserved,
ref Guid riid,
[MarshalAs(UnmanagedType.BStr)] string bstrKey,
[MarshalAs(UnmanagedType.Interface)] out object ppvObject);
{
// Collection of all ALCs used for COM activation. In the event we want to support
// unloadable COM server ALCs, this will need to be changed.
- private static Dictionary<string, AssemblyLoadContext> s_AssemblyLoadContexts = new Dictionary<string, AssemblyLoadContext>(StringComparer.InvariantCultureIgnoreCase);
+ private static readonly Dictionary<string, AssemblyLoadContext> s_AssemblyLoadContexts = new Dictionary<string, AssemblyLoadContext>(StringComparer.InvariantCultureIgnoreCase);
/// <summary>
/// Entry point for unmanaged COM activation API from managed code
{
ClassId = cxtInt.ClassId,
InterfaceId = cxtInt.InterfaceId,
- AssemblyPath = Marshal.PtrToStringUni(new IntPtr(cxtInt.AssemblyPathBuffer)),
- AssemblyName = Marshal.PtrToStringUni(new IntPtr(cxtInt.AssemblyNameBuffer)),
- TypeName = Marshal.PtrToStringUni(new IntPtr(cxtInt.TypeNameBuffer))
+ AssemblyPath = Marshal.PtrToStringUni(new IntPtr(cxtInt.AssemblyPathBuffer))!,
+ AssemblyName = Marshal.PtrToStringUni(new IntPtr(cxtInt.AssemblyNameBuffer))!,
+ TypeName = Marshal.PtrToStringUni(new IntPtr(cxtInt.TypeNameBuffer))!
};
object cf = GetClassFactoryForType(cxt);
_classType = classType;
}
- public static void ValidateInterfaceRequest(Type classType, ref Guid riid, object outer)
+ public static void ValidateInterfaceRequest(Type classType, ref Guid riid, object? outer)
{
Debug.Assert(classType != null);
if (riid == Marshal.IID_IUnknown)
}
public void CreateInstance(
- [MarshalAs(UnmanagedType.Interface)] object pUnkOuter,
+ [MarshalAs(UnmanagedType.Interface)] object? pUnkOuter,
ref Guid riid,
- [MarshalAs(UnmanagedType.Interface)] out object ppvObject)
+ [MarshalAs(UnmanagedType.Interface)] out object? ppvObject)
{
BasicClassFactory.ValidateInterfaceRequest(_classType, ref riid, pUnkOuter);
- ppvObject = Activator.CreateInstance(_classType);
+ ppvObject = Activator.CreateInstance(_classType)!;
if (pUnkOuter != null)
{
ppvObject = BasicClassFactory.CreateAggregatedObject(pUnkOuter, ppvObject);
}
public void CreateInstance(
- [MarshalAs(UnmanagedType.Interface)] object pUnkOuter,
+ [MarshalAs(UnmanagedType.Interface)] object? pUnkOuter,
ref Guid riid,
- [MarshalAs(UnmanagedType.Interface)] out object ppvObject)
+ [MarshalAs(UnmanagedType.Interface)] out object? ppvObject)
{
CreateInstanceInner(pUnkOuter, ref riid, key: null, isDesignTime: true, out ppvObject);
}
}
public void CreateInstanceLic(
- [MarshalAs(UnmanagedType.Interface)] object pUnkOuter,
- [MarshalAs(UnmanagedType.Interface)] object pUnkReserved,
+ [MarshalAs(UnmanagedType.Interface)] object? pUnkOuter,
+ [MarshalAs(UnmanagedType.Interface)] object? pUnkReserved,
ref Guid riid,
[MarshalAs(UnmanagedType.BStr)] string bstrKey,
[MarshalAs(UnmanagedType.Interface)] out object ppvObject)
}
private void CreateInstanceInner(
- object pUnkOuter,
+ object? pUnkOuter,
ref Guid riid,
- string key,
+ string? key,
bool isDesignTime,
out object ppvObject)
{
private MethodInfo _licInfoHelperContains;
// RCW Activation
- private object _licContext;
- private Type _targetRcwType;
+ private object? _licContext;
+ private Type? _targetRcwType;
static LicenseInteropProxy()
{
// Types are as follows:
// LicenseContext, Type, out License, out string
- object licContext = Activator.CreateInstance(_licInfoHelper);
- var parameters = new object[] { licContext, type, /* out */ null, /* out */ null };
+ object licContext = Activator.CreateInstance(_licInfoHelper)!;
+ var parameters = new object?[] { licContext, type, /* out */ null, /* out */ null };
bool isValid = (bool)_validateTypeAndReturnDetails.Invoke(null, BindingFlags.DoNotWrapExceptions, binder: null, parameters: parameters, culture: null);
if (!isValid)
{
return;
}
- var license = (IDisposable)parameters[2];
+ var license = (IDisposable?)parameters[2];
if (license != null)
{
license.Dispose();
// Types are as follows:
// LicenseContext, Type, out License, out string
- var parameters = new object[] { /* use global LicenseContext */ null, type, /* out */ null, /* out */ null };
+ var parameters = new object?[] { /* use global LicenseContext */ null, type, /* out */ null, /* out */ null };
bool isValid = (bool)_validateTypeAndReturnDetails.Invoke(null, BindingFlags.DoNotWrapExceptions, binder: null, parameters: parameters, culture: null);
if (!isValid)
{
throw new COMException(); //E_FAIL
}
- var license = (IDisposable)parameters[2];
+ var license = (IDisposable?)parameters[2];
if (license != null)
{
license.Dispose();
}
- string licenseKey = (string)parameters[3];
+ var licenseKey = (string?)parameters[3];
if (licenseKey == null)
{
throw new COMException(); //E_FAIL
// If we are being entered because of a call to ICF::CreateInstanceLic(),
// "isDesignTime" will be "false" and "key" will point to a non-null
// license key.
- public object AllocateAndValidateLicense(Type type, string key, bool isDesignTime)
+ public object AllocateAndValidateLicense(Type type, string? key, bool isDesignTime)
{
- object[] parameters;
+ object?[] parameters;
object licContext;
if (isDesignTime)
{
}
else
{
- parameters = new object[] { type, key };
+ parameters = new object?[] { type, key };
licContext = _createRuntimeContext.Invoke(null, BindingFlags.DoNotWrapExceptions, binder: null, parameters: parameters, culture: null);
}
// Types are as follows:
// Type, out bool, out string -> LicenseContext
- var parameters = new object[] { targetRcwTypeMaybe, /* out */ null, /* out */ null };
+ var parameters = new object[] { targetRcwTypeMaybe, /* out */ null!, /* out */ null! };
_licContext = _getCurrentContextInfo.Invoke(null, BindingFlags.DoNotWrapExceptions, binder: null, parameters: parameters, culture: null);
_targetRcwType = targetRcwTypeMaybe;
isDesignTime = (bool)parameters[1];
- bstrKey = Marshal.StringToBSTR((string)parameters[2]);
+ bstrKey = Marshal.StringToBSTR((string?)parameters[2]);
}
// The CLR invokes this when instantiating a licensed COM
}
string key = Marshal.PtrToStringBSTR(bstrKey);
- var parameters = new object[] { _targetRcwType, key };
+ var parameters = new object?[] { _targetRcwType, key };
_setSavedLicenseKey.Invoke(_licContext, BindingFlags.DoNotWrapExceptions, binder: null, parameters: parameters, culture: null);
}
}
**
=============================================================================*/
+#nullable enable
namespace System.Runtime.InteropServices {
using System;
using System.Reflection;
// implementations of get_InnerException to be provided by the base class. It works only if Exception.get_InnerException
// is virtual.
//
- Exception InnerException {
+ Exception? InnerException {
get;
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
-using System;
+#nullable enable
using System.Diagnostics;
using System.Runtime.CompilerServices;
-using System.Security;
using Internal.Runtime.CompilerServices;
}
}
- public override string ToString()
+ public override string? ToString()
{
if (_data != null)
{
{
try
{
- coercedArray[i] = CoerceScalarValue<T>(scalarType, dataArray.GetValue(i));
+ coercedArray[i] = CoerceScalarValue<T>(scalarType, dataArray.GetValue(i)!);
}
catch (InvalidCastException elementCastException)
{
{
if (numericScalar.Item1 == typeof(T))
{
- return (T)Convert.ChangeType(value, typeof(T), System.Globalization.CultureInfo.InvariantCulture);
+ return (T)Convert.ChangeType(value, typeof(T), System.Globalization.CultureInfo.InvariantCulture)!;
}
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
-using System;
+#nullable enable
using System.Collections;
using System.Diagnostics;
-using System.Reflection;
-using System.Security;
namespace System.Runtime.InteropServices.WindowsRuntime
{
private T _value;
public CLRIReferenceImpl(PropertyType type, T obj)
- : base(type, obj)
+ : base(type, obj!)
{
Debug.Assert(obj != null, "Must not be null");
_value = obj;
get { return _value; }
}
- public override string ToString()
+ public override string? ToString()
{
if (_value != null)
{
object IGetProxyTarget.GetTarget()
{
- return (object)_value;
+ return _value!; // TODO-NULLABLE-GENERIC
}
// We have T in an IReference<T>. Need to QI for IReference<T> with the appropriate GUID, call
Debug.Assert(wrapper != null);
IReference<T> reference = (IReference<T>)wrapper;
Debug.Assert(reference != null, "CLRIReferenceImpl::UnboxHelper - QI'ed for IReference<" + typeof(T) + ">, but that failed.");
- return reference.Value;
+ return reference.Value!; // TODO-NULLABLE-GENERIC
}
}
get { return _value; }
}
- public override string ToString()
+ public override string? ToString()
{
if (_value != null)
{
if (propType.HasValue)
{
Type specificType = typeof(CLRIReferenceImpl<>).MakeGenericType(type);
- return Activator.CreateInstance(specificType, new object[] { propType.GetValueOrDefault(), obj });
+ return Activator.CreateInstance(specificType, new object[] { propType.GetValueOrDefault(), obj })!;
}
Debug.Fail("We should not see non-WinRT type here");
- return null;
+ return null!;
}
internal static object CreateIReferenceArray(Array obj)
if (type.IsGenericType &&
type.GetGenericTypeDefinition() == typeof(System.Collections.Generic.KeyValuePair<,>))
{
- object[] objArray = new object[obj.Length];
+ object?[] objArray = new object?[obj.Length];
for (int i = 0; i < objArray.Length; i++)
{
objArray[i] = obj.GetValue(i);
{
// All WinRT value type will be Property.Other
Type specificType = typeof(CLRIReferenceArrayImpl<>).MakeGenericType(type);
- return Activator.CreateInstance(specificType, new object[] { propType.GetValueOrDefault(), obj });
+ return Activator.CreateInstance(specificType, new object[] { propType.GetValueOrDefault(), obj })!;
}
else
{