mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-23 03:39:35 -10:00
* Add tests for FormatterServices.GetUninitializedObject - non runtime types - array, pointer, ref types - abstract/interface types - open generic types - byref like types - shared generic instantiations - COM objects - nullable types - default constructor - static constructor (non beforefieldinit) - static field (beforefieldinit) - static constructor throwing as * Address PR feedback - Remove now uneeded netcoreapp configuration and definition to use a simpler non RuntimeType - Update test that relies on System.__Canon to be coreclr specific - Add test that actually tests for COM objects - Fix naming of test for subclass of ContextBoundObject * Split coreclr runtime specific code into it's own coreclr specific test * Fix Unix test failures * Add another test for GetUninitializedObject(TypeDesc) (generic type parameter) * Address more PR feedback * Fix CI errors Commit migrated from https://github.com/dotnet/corefx/commit/b6d4e5fa4bddd130fa2f95e34f5487064ff6bd1b
29 lines
1007 B
C#
29 lines
1007 B
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// 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.Collections.Generic;
|
|
using System.Reflection;
|
|
using System.Runtime.InteropServices;
|
|
using Xunit;
|
|
|
|
namespace System.Runtime.Serialization.Formatters.Tests
|
|
{
|
|
public partial class FormatterServicesTests
|
|
{
|
|
[Fact]
|
|
public void GetUninitializedObject_COMObject_ThrowsNotSupportedException()
|
|
{
|
|
Type comObjectType = typeof(COMObject);
|
|
Assert.True(comObjectType.IsCOMObject);
|
|
|
|
Assert.Throws<NotSupportedException>(() => FormatterServices.GetUninitializedObject(typeof(COMObject)));
|
|
Assert.Throws<NotSupportedException>(() => FormatterServices.GetSafeUninitializedObject(typeof(COMObject)));
|
|
}
|
|
|
|
[ComImport]
|
|
[Guid("00000000-0000-0000-0000-000000000000")]
|
|
public class COMObject { }
|
|
}
|
|
}
|