Skip to content
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

Introduce non-shipped System.Runtime.Internal assembly #61754

Closed
Closed
Show file tree
Hide file tree
Changes from 3 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
21 changes: 3 additions & 18 deletions eng/pipelines/common/templates/runtimes/build-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ parameters:
### Build managed test components (native components are getting built as part
### of the the product build job).

### TODO: As of today, build of managed test components requires the product build
### as a prerequisite due to dependency on System.Private.Corelib. After switching
### over to its reference assembly we should be able to remove this dependency and
### run managed test builds in parallel with the product build job.


jobs:
- template: /eng/pipelines/${{ parameters.runtimeFlavor }}/templates/xplat-pipeline-job.yml
parameters:
Expand All @@ -48,10 +42,7 @@ jobs:
liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }}
pool: ${{ parameters.pool }}
dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }}
${{ if eq(parameters.runtimeFlavor, 'coreclr') }}:
liveRuntimeBuildParams: ${{ format('clr.corelib+libs.ref+libs.native -rc {0} -c {1} -arch {2} -ci', coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig), parameters.liveLibrariesBuildConfig, parameters.archType) }}
${{ if eq(parameters.runtimeFlavor, 'mono') }}:
liveRuntimeBuildParams: ${{ format('mono.corelib+libs.ref+libs.native -rc {0} -c {1} -arch {2} -ci', coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig), parameters.liveLibrariesBuildConfig, parameters.archType) }}
liveRuntimeBuildParams: ${{ format('libs.ref+libs.native -c {0} -arch {1} -ci', parameters.liveLibrariesBuildConfig, parameters.archType) }}

${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.compilerName, 'gcc'), not(and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubgroup, '_musl'), eq(parameters.archType, 'x64'))), not(eq(parameters.osGroup, 'OSX'))) }}:
compilerArg: '-clang9'
Expand Down Expand Up @@ -84,14 +75,8 @@ jobs:
timeoutInMinutes: 160

variables:
- ${{ each variable in parameters.variables }}:
- ${{ variable }}
- ${{ if eq(parameters.runtimeFlavor, 'coreclr') }}:
- name: liveRuntimeBuildParams
value: ${{ format('clr.corelib+libs.ref+libs.native -rc {0} -c {1} -arch {2} -ci', coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig), parameters.liveLibrariesBuildConfig, parameters.archType) }}
- ${{ if eq(parameters.runtimeFlavor, 'mono') }}:
- name: liveRuntimeBuildParams
value: ${{ format('mono.corelib+libs.ref+libs.native -rc {0} -c {1} -arch {2} -ci', coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig), parameters.liveLibrariesBuildConfig, parameters.archType) }}
- name: liveRuntimeBuildParams
value: ${{ format('libs.ref+libs.native -c {0} -arch {1} -ci', parameters.liveLibrariesBuildConfig, parameters.archType) }}
- name: compilerArg
value: ''
- ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.compilerName, 'gcc')) }}:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ void CreateInstanceLic(
public partial struct ComActivationContext
{
[RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
[CLSCompliant(false)]
public static unsafe ComActivationContext Create(ref ComActivationContextInternal cxtInt)
internal static unsafe ComActivationContext Create(ref ComActivationContextInternal cxtInt)
{
if (!Marshal.IsBuiltInComSupported)
{
Expand Down
6 changes: 6 additions & 0 deletions src/libraries/System.Runtime.Internal/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
</PropertyGroup>
</Project>
3 changes: 3 additions & 0 deletions src/libraries/System.Runtime.Internal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# System.Runtime.Internal

The System.Runtime.Internal library is designed for internal usage in our test tree. This library exposes some public APIs from System.Private.CoreLib for usage in our tests that are not exposed via the Microsoft.NETCore.App framework. These API are either used by the hosting layer (so they don't need to be exposed publicly) or used by some old internal tooling that we're working to remove in future versions of .NET.
33 changes: 33 additions & 0 deletions src/libraries/System.Runtime.Internal/System.Runtime.Internal.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Microsoft Visual Studio Solution File, Format Version 12.00
#
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime", "ref\System.Runtime.Internal.csproj", "{F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{D00764F9-F736-4072-A7DD-B4BF05CF4786}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Runtime.Internal", "src\System.Runtime.Internal.csproj", "{215536A6-ECCE-4AF9-B108-8ED370095D78}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Release|Any CPU.Build.0 = Release|Any CPU
{215536A6-ECCE-4AF9-B108-8ED370095D78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{215536A6-ECCE-4AF9-B108-8ED370095D78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{215536A6-ECCE-4AF9-B108-8ED370095D78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{215536A6-ECCE-4AF9-B108-8ED370095D78}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C} = {D00764F9-F736-4072-A7DD-B4BF05CF4786}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {19706846-1F47-42ED-B649-B0982EE96E6B}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace Internal.Runtime.InteropServices
{
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static class ComActivator
{
//
// Summary:
// Entry point for unmanaged COM register/unregister API from managed code
//
// Parameters:
// cxt:
// Reference to a Internal.Runtime.InteropServices.ComActivationContext instance
//
// register:
// true if called for register or false to indicate unregister
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
public static void ClassRegistrationScenarioForType(ComActivationContext cxt, bool register) {}
//
// Summary:
// Entry point for unmanaged COM activation API from managed code
//
// Parameters:
// cxt:
// Reference to a Internal.Runtime.InteropServices.ComActivationContext instance
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
public static object GetClassFactoryForType(ComActivationContext cxt) => throw null;
}
public struct ComActivationContext
{
public System.Guid ClassId;
public System.Guid InterfaceId;
public string AssemblyPath;
public string AssemblyName;
public string TypeName;
}
public static class InMemoryAssemblyLoader
{
public static unsafe void LoadInMemoryAssembly(System.IntPtr moduleHandle, System.IntPtr assemblyPath) => throw null;
}
}

namespace System.Runtime.CompilerServices
{
public interface ICastable
{
bool IsInstanceOfInterface(RuntimeTypeHandle interfaceType, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out Exception? castError);
RuntimeTypeHandle GetImplType(RuntimeTypeHandle interfaceType);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>System.Runtime.Internal</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Runtime.Internal.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# APIs that we don't need to expose since they're [UnmanagedCallersOnly]
MembersMustExist : Member 'public System.Int32 Internal.Runtime.InteropServices.ComActivator.GetClassFactoryForTypeInternal(Internal.Runtime.InteropServices.ComActivationContextInternal*)' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'public System.Int32 Internal.Runtime.InteropServices.ComActivator.RegisterClassForTypeInternal(Internal.Runtime.InteropServices.ComActivationContextInternal*)' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'public System.Int32 Internal.Runtime.InteropServices.ComActivator.UnregisterClassForTypeInternal(Internal.Runtime.InteropServices.ComActivationContextInternal*)' does not exist in the reference but it does exist in the implementation.
63 changes: 63 additions & 0 deletions src/libraries/System.Runtime.Internal/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="PlatformNotSupported_System_Runtime_Internal" xml:space="preserve">
<value>System.Private.CoreLib Internal APIs are not supported.</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<Nullable>enable</Nullable>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(RuntimeFlavor)' == 'Mono'">SR.PlatformNotSupported_System_Runtime_Internal</GeneratePlatformNotSupportedAssemblyMessage>
<OmitResources Condition="'$(RuntimeFlavor)' != 'Mono'">true</OmitResources>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<FeatureGenericMath>true</FeatureGenericMath>
<NoWarn>$(NoWarn),1718,SYSLIB0013</NoWarn>
<TestRuntime>true</TestRuntime>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks>
<Nullable>disable</Nullable>
<!-- Disable nullability public only feature for NullabilityInfoContextTests -->
<Features>$(Features.Replace('nullablePublicOnly', '')</Features>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition="'$(FeatureGenericMath)' == 'true'">$(DefineConstants);FEATURE_GENERIC_MATH</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\ByteTests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\CharTests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\DoubleTests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\HalfTests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\Int16Tests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\Int32Tests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\Int64Tests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\IntPtrTests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\SByteTests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\SingleTests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\UInt16Tests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\UInt32Tests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\UInt64Tests.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\UIntPtrTests.cs" />
</ItemGroup>
<ItemGroup Condition="'$(FeatureGenericMath)' == 'true'">
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\ByteTests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\CharTests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\DoubleTests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\GenericMathHelpers.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\HalfTests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\Int16Tests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\Int32Tests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\Int64Tests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\IntPtrTests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\SByteTests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\SingleTests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\UInt16Tests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\UInt32Tests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\UInt64Tests.GenericMath.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Runtime\tests\System\UIntPtrTests.GenericMath.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Runtime.Numerics.TestData" Version="$(SystemRuntimeNumericsTestDataVersion)" GeneratePathProperty="true" />
<!-- it's a reference assembly, but the project system doesn't know that - include it during compilation, but don't publish it -->
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.Experimental\ref\System.Runtime.Experimental.csproj" IncludeAssets="compile" Private="false" />
<ProjectReference Include="$(CommonTestPath)TestUtilities.Unicode\TestUtilities.Unicode.csproj" />
</ItemGroup>
</Project>
28 changes: 0 additions & 28 deletions src/tests/Common/override.targets

This file was deleted.

Loading