Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

namespace System.Xml
{
// we must specify the error flag as false so that we can typeforward this type without hitting a compile error.
[Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.")]
[Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)]
[EditorBrowsable(EditorBrowsableState.Never)]
public interface IApplicationResourceStreamResolver
{
Expand Down

This file was deleted.

8 changes: 4 additions & 4 deletions src/libraries/shims.proj
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
<TargetFramework>$(NetCoreAppCurrent)-$(TargetOS)</TargetFramework>
</PropertyGroup>

<!-- Reference the source project shims which themselves then reference their corresponding ref project, if it exists. -->
<!-- Reference the source project shims which themselves then reference their corresponding ref project, if such exist. -->
<ItemGroup>
<ProjectReference Include="shims\src\*.csproj" />
<ProjectReference Include="shims\*\src\*.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(RefOnly)' == 'true'">
<ReferenceShimProject Include="shims\ref\*.csproj" />
<ReferenceShimProject Include="shims\*\ref\*.csproj" />
<ProjectReference Include="@(ReferenceShimProject)" />
<!-- Omit projects which depend on source projects to be built. -->
<ProjectReference Remove="@(ReferenceShimProject->'shims\src\%(Filename)%(Extension)')" />
<ProjectReference Remove="@(ReferenceShimProject->'shims\%(Filename)\src\%(Filename)%(Extension)')" />
</ItemGroup>

</Project>
62 changes: 21 additions & 41 deletions src/libraries/shims/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,39 @@

<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)-$(TargetOS)</TargetFramework>
<Nullable>disable</Nullable>
<EnableDefaultItems>true</EnableDefaultItems>
<!-- By default make shims compile against reference assemblies. -->
<CompileUsingReferenceAssemblies>true</CompileUsingReferenceAssemblies>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<GenFacadesIgnoreMissingTypes>true</GenFacadesIgnoreMissingTypes>
<!-- ensure the desktop compat shims reference the lowest possible version of dependencies
since those do not all ship as part of the framework and we don't want to force apps
to reference the latest packages.
netstandard.dll doesn't need to do this since it has no dangling dependencies -->
<GenFacadesForceZeroVersionSeeds Condition="'$(MSBuildProjectName)' != 'netstandard'">true</GenFacadesForceZeroVersionSeeds>
<!-- Ensure the .NET Framework shims reference the lowest possible version of dependencies since
those do not all ship as part of the framework and we don't want to force apps to reference the
latest packages. netstandard.dll doesn't need to do this since it has no dangling dependencies. -->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we not want the latest package to he referenced?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already the same in main. Or are you asking about why we are doing this generally? IMO the comment captures that nicely. We make sure that shims don't depend on the very latest packages and instead work with any version. When you look at any of the shims in ilspy, i.e. mscorlib you will see that all dependency versions in its metadata are 0.0.0.0.

<GenFacadesForceZeroVersionSeeds Condition="$(NetFxReference.Contains('$(MSBuildProjectName);'))">true</GenFacadesForceZeroVersionSeeds>
<!-- Opt out of some features which are on by default. -->
<EnableLibraryImportGenerator>false</EnableLibraryImportGenerator>
<ApiCompatValidateAssemblies>false</ApiCompatValidateAssemblies>
<ILLinkTrimAssembly>false</ILLinkTrimAssembly>
<AddOSPlatformAttributes>false</AddOSPlatformAttributes>
<!-- Allow shim ref projects to reference source projects which is required for referencing shared
framework dependencies. -->
<SkipValidateReferenceAssemblyProjectReferences Condition="'$(IsReferenceAssemblyProject)' == 'true'">true</SkipValidateReferenceAssemblyProjectReferences>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is related to what you told me yesterday that refs don't necessarily expose all the public APIs that exist in src.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was also already in main just in a different location:

<!-- Allow shim ref projects to reference source projects. -->
<SkipValidateReferenceAssemblyProjectReferences>true</SkipValidateReferenceAssemblyProjectReferences>

Usually our reference source project must not have a TFM with a $(TargetOS) in it. In this case we override that validation as the shim refernce source projects are a bit special. That could be cleaned-up in the future but is unrelated to this PR.

</PropertyGroup>

<ItemGroup Condition="'$(MSBuildProjectName)' == 'System.Runtime' or
'$(MSBuildProjectName)' == 'mscorlib' or
'$(MSBuildProjectName)' == 'netstandard'">
<!-- Omit System.Void since C# doesn't permit the use of the `System.Void`
typename and instead requires callers to use the `void` keyword. -->
<GenFacadesOmitType Include="System.Void" />
<Compile Include="$(MSBuildThisFileDirectory)System.Void.cs" />
</ItemGroup>

<ItemGroup>
<!-- Include any forwards needed by both ref and src projects. -->
<Compile Include="$(MSBuildThisFileDirectory)$(MSBuildProjectName).forwards.cs"
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildProjectName).forwards.cs')" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)..\sfx-src.proj" Condition="'$(RefOnly)' != 'true'" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\sfx-ref.proj" Condition="'$(RefOnly)' == 'true'" />
</ItemGroup>
<PropertyGroup Condition="'$(IsSourceProject)' == 'true'">
<ContractProject>$(MSBuildProjectDirectory)\..\ref\$(MSBuildProjectName).csproj</ContractProject>
<IsRuntimeAndReferenceAssembly Condition="!Exists('$(ContractProject)')">true</IsRuntimeAndReferenceAssembly>
</PropertyGroup>

<ItemGroup Condition="'$(MSBuildProjectName)' != 'netstandard'">
<!-- .NET Framework shims compile against OOBs and the netstandard shim. -->
<ProjectReference Include="$(MSBuildThisFileDirectory)src\netstandard.csproj" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\oob-src.proj" Condition="'$(RefOnly)' != 'true'" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\oob-ref.proj" Condition="'$(RefOnly)' == 'true'" />
<ItemGroup Condition="'$(IsSourceProject)' == 'true'">
<!-- If an extra reference source project exists, use its source. -->
<Compile Include="$(MSBuildProjectDirectory)\..\ref\$(MSBuildProjectName).cs"
Condition="'$(IsRuntimeAndReferenceAssembly)' != 'true'" />
</ItemGroup>

<ItemGroup>
<!-- System.Data.SqlClient is not live built anymore, reference it manually to avoid tfm nuget selection fallback errors
Comment thread
ViktorHofer marked this conversation as resolved.
when the TargetOS i.e. is MacCatalyst. Set Private false so that it doesn't flow down to consuming projects. -->
<PackageDownload Include="System.Data.SqlClient" Version="[$(SystemDataSqlClientVersion)]" />
<Reference Include="$([MSBuild]::NormalizePath('$(NuGetPackageRoot)', 'system.data.sqlclient', '$(SystemDataSqlClientVersion)', 'ref', 'netcoreapp2.1', 'System.Data.SqlClient.dll'))" Private="false" />

<!-- Use PackageDownload to not bring in System.Drawing.Common's dependencies (Microsoft.Win32.SystemEvents). -->
<PackageDownload Include="System.Drawing.Common" Version="[$(SystemDrawingCommonVersion)]" />
<Reference Include="$([MSBuild]::NormalizePath('$(NuGetPackageRoot)', 'system.drawing.common', '$(SystemDrawingCommonVersion)', 'lib', 'net7.0', 'System.Drawing.Common.dll'))" Private="false" />
<ItemGroup Condition="'$(GenFacadesForceZeroVersionSeeds)' == 'true'">
<PackageReference Include="Microsoft.DotNet.GenFacades"
Version="$(MicrosoftDotNetGenFacadesVersion)"
PrivateAssets="all"
IsImplicitlyDefined="true" />
</ItemGroup>

</Project>
16 changes: 2 additions & 14 deletions src/libraries/shims/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
<Project>
<Import Project="..\Directory.Build.targets" />

<PropertyGroup>
<!-- Tell GenFacades which msbuild item maps to the reference assembly to use. -->
<GenFacadesReferenceAssemblyItemName>GenFacadesReferenceAssembly</GenFacadesReferenceAssemblyItemName>
</PropertyGroup>
<Import Project="..\Directory.Build.targets" />

<!-- Tell GenFacades to use reference assemblies instead of the implementation assemblies (for most of the shims). -->
<PropertyGroup Condition="'$(CompileUsingReferenceAssemblies)' != 'false'">
<PropertyGroup Condition="'$(CompileUsingReferenceAssemblies)' == 'true'">
<TrimOutPrivateAssembliesFromReferencePath>true</TrimOutPrivateAssembliesFromReferencePath>
<GeneratePartialFacadeSourceDependsOn>$(GeneratePartialFacadeSourceDependsOn);FindReferenceAssembliesForReferences</GeneratePartialFacadeSourceDependsOn>
<GenFacadesReferencePathItemName>ReferencePathWithRefAssemblies</GenFacadesReferencePathItemName>
</PropertyGroup>

<ItemGroup Condition="'$(MSBuildProjectName)' != 'netstandard'">
<PackageDownload Include="Microsoft.NETFramework.ReferenceAssemblies.net48"
Version="[$(MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion)]" />
<GenFacadesReferenceAssembly Include="$([MSBuild]::NormalizePath('$(NuGetPackageRoot)', 'microsoft.netframework.referenceassemblies.net48', '$(MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion)', 'build', '.NETFramework', 'v4.8', '$(MSBuildProjectName).dll'))" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.AppWinStyle))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CallType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Collection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.ComClassAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompareMethod))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.BooleanType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.ByteType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.CharArrayType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.CharType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.Conversions))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.DateType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.DecimalType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.DesignerGeneratedAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.DoubleType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.IncompleteInitialization))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.IntegerType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.LateBinding))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.LikeOperator))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.LongType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.NewLateBinding))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.ObjectFlowControl))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.ObjectType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.Operators))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.OptionCompareAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.OptionTextAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.ProjectData))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.ShortType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.SingleType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.StaticLocalInitFlag))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.StringType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.Utils))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.Versioned))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Constants))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.ControlChars))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Conversion))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.DateAndTime))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.DateFormat))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.DateInterval))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.DueDate))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.ErrObject))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.DeleteDirectoryOption))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.FieldType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.FileSystem))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.MalformedLineException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.RecycleOption))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.SearchOption))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.SpecialDirectories))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.TextFieldParser))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.UICancelOption))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.UIOption))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileSystem))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Financial))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FirstDayOfWeek))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FirstWeekOfYear))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.HideModuleNameAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Information))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Interaction))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.MsgBoxResult))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.MsgBoxStyle))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.MyGroupCollectionAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.OpenAccess))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.OpenMode))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.OpenShare))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.SpcInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Strings))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.TabInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.TriState))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.VariantType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.VBFixedArrayAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.VBFixedStringAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.VBMath))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.VbStrConv))]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.VisualBasic.Core\src\Microsoft.VisualBasic.Core.vbproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\src\System.Runtime.csproj" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions src/libraries/shims/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# .NETCoreApp shared framework facade assemblies ("shims")

The projects under this directory are pure facade assemblies (also called shims) and don't contain any source code aside from `System.Runtime.CompilerServices.TypeForwardedTo` assembly attributes.

Currently, the following types of facades are checked-in:
- .NET Framework facade assemblies (i.e. mscorlib.dll) which enable loading .NET Framework compiled assemblies into a .NETCoreApp environment.
- .NET Standard facade assembly (netstandard.dll) which enables loading .NET Standard compiled assemblies into a .NETCoreApp environment.

Some facade folders contain reference source projects ("ref") in addition to source projects ("src"). Those might exist because of the source project referencing internal types. If only a source project exists, the compiled assembly will be included in both the targeting and the runtime pack.
Loading