Skip to content

Get more libraries tests running with NativeAOT #72917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/runtime-extra-platforms-other.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
isSingleFile: true
nameSuffix: NativeAOT_Libs_Passing
buildArgs: -s clr.aot+libs+libs.tests -c $(_BuildConfig) /p:TestNativeAot=true /p:ArchiveTests=true
timeoutInMinutes: 180
timeoutInMinutes: 240
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ internal static IntPtr ComInterfaceForObject(object instance)
{
if (s_globalInstanceForMarshalling == null)
{
throw new InvalidOperationException(SR.InvalidOperation_ComInteropRequireComWrapperInstance);
throw new NotSupportedException(SR.InvalidOperation_ComInteropRequireComWrapperInstance);
}

return s_globalInstanceForMarshalling.GetOrCreateComInterfaceForObject(instance, CreateComInterfaceFlags.None);
Expand All @@ -640,7 +640,7 @@ internal static object ComObjectForInterface(IntPtr externalComObject)
{
if (s_globalInstanceForMarshalling == null)
{
throw new InvalidOperationException(SR.InvalidOperation_ComInteropRequireComWrapperInstance);
throw new NotSupportedException(SR.InvalidOperation_ComInteropRequireComWrapperInstance);
}

return s_globalInstanceForMarshalling.GetOrCreateObjectForComInstance(externalComObject, CreateObjectFlags.Unwrap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ public static int GetHRForException(Exception? e)
[EditorBrowsable(EditorBrowsableState.Never)]
public static IntPtr CreateAggregatedObject(IntPtr pOuter, object o)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
[SupportedOSPlatform("windows")]
public static object BindToMoniker(string monikerName)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

public static void CleanupUnusedObjectsInCurrentContext()
Expand All @@ -45,32 +45,32 @@ public static void CleanupUnusedObjectsInCurrentContext()
[SupportedOSPlatform("windows")]
public static IntPtr CreateAggregatedObject<T>(IntPtr pOuter, T o) where T : notnull
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static object? CreateWrapperOfType(object? o, Type t)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
public static TWrapper CreateWrapperOfType<T, TWrapper>(T? o)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
public static void ChangeWrapperHandleStrength(object otp, bool fIsWeak)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
public static int FinalReleaseComObject(object o)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
Expand All @@ -94,7 +94,7 @@ public static IntPtr GetComInterfaceForObject(object o, Type T)
[EditorBrowsable(EditorBrowsableState.Never)]
public static IntPtr GetComInterfaceForObject(object o, Type T, CustomQueryInterfaceMode mode)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
Expand All @@ -106,7 +106,7 @@ public static IntPtr GetComInterfaceForObject<T, TInterface>([DisallowNull] T o)
[SupportedOSPlatform("windows")]
public static object? GetComObjectData(object obj, object key)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
Expand Down Expand Up @@ -302,7 +302,7 @@ public static void GetNativeVariantForObject<T>(T? obj, IntPtr pDstNativeVariant
[SupportedOSPlatform("windows")]
public static object GetTypedObjectForIUnknown(IntPtr pUnk, Type t)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
Expand Down Expand Up @@ -364,33 +364,33 @@ public static object GetObjectForIUnknown(IntPtr pUnk)
[EditorBrowsable(EditorBrowsableState.Never)]
public static T GetObjectForNativeVariant<T>(IntPtr pSrcNativeVariant)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static object?[] GetObjectsForNativeVariants(IntPtr aSrcNativeVariant, int cVars)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static T[] GetObjectsForNativeVariants<T>(IntPtr aSrcNativeVariant, int cVars)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
public static int GetStartComSlot(Type t)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
public static int GetEndComSlot(Type t)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

internal static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError)
Expand All @@ -401,13 +401,13 @@ public static int GetEndComSlot(Type t)
[SupportedOSPlatform("windows")]
public static string GetTypeInfoName(ITypeInfo typeInfo)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
public static object GetUniqueObjectForIUnknown(IntPtr unknown)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

public static bool IsComObject(object o)
Expand All @@ -432,13 +432,13 @@ public static bool IsTypeVisibleFromCom(Type t)
[SupportedOSPlatform("windows")]
public static int ReleaseComObject(object o)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

[SupportedOSPlatform("windows")]
public static bool SetComObjectData(object obj, object key, object? data)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ public void Equality(Color left, Color right, bool expected)
Assert.Equal(!expected, right != left);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsDebuggerTypeProxyAttributeSupported))]
public void DebuggerAttributesAreValid()
{
DebuggerAttributes.ValidateDebuggerDisplayReferences(Color.Aquamarine);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace System.Drawing.Primitives.Tests
{
[ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBuiltWithAggressiveTrimming))]
public class DataContractSerializerTests
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace System.Runtime.InteropServices.Tests
public partial class MarshalComDisabledTests
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72914", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void GetTypeFromCLSID_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetTypeFromCLSID(Guid.Empty));
Expand Down Expand Up @@ -67,12 +68,14 @@ public void CreateWrapperOfType_T_TWrapper_ThrowsNotSupportedException()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72911", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void GetNativeVariantForObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetNativeVariantForObject(99, IntPtr.Zero));
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72911", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void GetNativeVariantForObject_T_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetNativeVariantForObject<double>(99, IntPtr.Zero));
Expand All @@ -81,6 +84,7 @@ public void GetNativeVariantForObject_T_ThrowsNotSupportedException()
public struct NativeVariant{}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72911", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void GetObjectForNativeVariant_ThrowsNotSupportedException()
{
NativeVariant variant = new NativeVariant();
Expand All @@ -100,6 +104,7 @@ public void GetObjectForNativeVariant_ThrowsNotSupportedException()
public struct NativeVariant_T{}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72911", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void GetObjectForNativeVariant_T_ThrowsNotSupportedException()
{
NativeVariant_T variant = new NativeVariant_T();
Expand Down
Loading