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

Remove the use of IsPartialFacadeAssembly in refererences #52793

Merged
merged 6 commits into from
May 19, 2021
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
10 changes: 7 additions & 3 deletions docs/coding-guidelines/updating-ref-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This document provides the steps you need to take to update the reference assemb
3. Navigate to the ref directory and build the reference assembly.
4. Add, build, and run tests.

** **Note:** If you already added the new API to the reference source, re-generating it (after building the source assembly) will update it to be fully qualified and placed in the correct order. This can be done by running the `GenerateReferenceAssemblySource` command from the ref directory.
** **Note:** If you already added the new API to the reference source, re-generating it (after building the source assembly) will update it to be fully qualified and placed in the correct order. This can be done by running the `GenerateReferenceAssemblySource` command from the ref directory.

## For System.Runtime

Expand All @@ -16,10 +16,14 @@ These steps can also be applied to some unique assemblies which depend on change
1) Run `dotnet build --no-incremental /t:GenerateReferenceSource` from the System.Runtime/src directory.
2) Filter out all unrelated changes and extract the changes you care about (ignore certain attributes being removed). Generally, this step is not required for other reference assemblies.

## For Full Facade Assemblies
## For Full Facade Assemblies implementation assemblies

For assemblies that are "full facades" over another assembly (ex. System.Runtime.Serialization.Json or System.Xml.XDocument), use the following command to generate the reference source code instead:
For implementation assemblies that are "full facades" over another assembly but define types in the reference assembly (ex. System.Runtime.Serialization.Json or System.Xml.XDocument), use the following command to generate the reference source code instead:

```
dotnet msbuild /t:GenerateReferenceAssemblySource /p:GenAPIAdditionalParameters=--follow-type-forwards
```

## For .NETFramework Facade Assemblies

Some assemblies define types in .NETStandard and .NETCore but require facades on .NETFramework to forward types to their existing location in .NETFramework. In these cases we need to add type forwards manually to the .NETFramework build of the reference assembly. TypeForwards must be added for every type in the compatible .NETStandard reference assembly that exists in the .NETFramework, types which are defined in the .NETFramework reference should be factored into a shared source file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<IsPartialFacadeAssembly Condition="$(TargetFramework.StartsWith('net4'))">true</IsPartialFacadeAssembly>
</PropertyGroup>
<ItemGroup>
<Compile Include="Microsoft.Win32.Registry.cs" />
<Compile Condition="'$(TargetFramework)' != 'net461'" Include="Microsoft.Win32.Registry.cs" />
<Compile Condition="'$(TargetFramework)' == 'net461'" Include="Microsoft.Win32.Registry.net461.cs" />
</ItemGroup>
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<ItemGroup Condition="'$(TargetFramework)' != 'net461'">
<ProjectReference Include="..\..\System.Security.AccessControl\ref\System.Security.AccessControl.csproj" />
<ProjectReference Include="..\..\System.Security.Principal.Windows\ref\System.Security.Principal.Windows.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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.
// ------------------------------------------------------------------------------

using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.RegistryAccessRule))]
[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.RegistryAuditRule))]
[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.RegistryRights))]
[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.RegistrySecurity))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.Registry))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryHive))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryKey))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryKeyPermissionCheck))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryOptions))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryValueKind))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryValueOptions))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryView))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SafeHandles.SafeRegistryHandle))]
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<IsPartialFacadeAssembly Condition="$(TargetFramework.StartsWith('net4'))">true</IsPartialFacadeAssembly>
</PropertyGroup>
<ItemGroup>
<Compile Include="Microsoft.Win32.SystemEvents.cs" />
<Compile Condition="'$(TargetFramework)' != 'net461'" Include="Microsoft.Win32.SystemEvents.cs" />
<Compile Condition="'$(TargetFramework)' == 'net461'" Include="Microsoft.Win32.SystemEvents.net461.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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.
// ------------------------------------------------------------------------------

using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Microsoft.Win32.PowerModeChangedEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.PowerModeChangedEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.PowerModes))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionEndedEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionEndedEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionEndingEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionEndingEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionEndReasons))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionSwitchEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionSwitchEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionSwitchReason))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SystemEvents))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.TimerElapsedEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.TimerElapsedEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.UserPreferenceCategory))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.UserPreferenceChangedEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.UserPreferenceChangedEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.UserPreferenceChangingEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.UserPreferenceChangingEventHandler))]
9 changes: 3 additions & 6 deletions src/libraries/System.CodeDom/ref/System.CodeDom.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<IsPartialFacadeAssembly Condition="$(TargetFramework.StartsWith('net4'))">true</IsPartialFacadeAssembly>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.CodeDom.cs" />
<Compile Condition="'$(TargetFramework)' != 'net461'" Include="System.CodeDom.cs" />
<Compile Condition="'$(TargetFramework)' == 'net461'" Include="System.CodeDom.net461.cs" />
</ItemGroup>
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<ItemGroup Condition="'$(TargetFramework)' != 'net461'">
<ProjectReference Include="..\..\System.Security.Permissions\ref\System.Security.Permissions.csproj" />
</ItemGroup>
</Project>
113 changes: 113 additions & 0 deletions src/libraries/System.CodeDom/ref/System.CodeDom.net461.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// 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.
// ------------------------------------------------------------------------------

using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeArgumentReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeArrayCreateExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeArrayIndexerExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAssignStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAttachEventStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAttributeArgument))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAttributeArgumentCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAttributeDeclaration))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAttributeDeclarationCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeBaseReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeBinaryOperatorExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeBinaryOperatorType))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCastExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCatchClause))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCatchClauseCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeChecksumPragma))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeComment))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCommentStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCommentStatementCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCompileUnit))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeConditionStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeConstructor))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDefaultValueExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDelegateCreateExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDelegateInvokeExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDirectionExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDirective))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDirectiveCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeEntryPointMethod))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeEventReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeExpressionCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeExpressionStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeFieldReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeGotoStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeIndexerExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeIterationStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeLabeledStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeLinePragma))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMemberEvent))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMemberField))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMemberMethod))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMemberProperty))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMethodInvokeExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMethodReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMethodReturnStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeNamespace))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeNamespaceCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeNamespaceImport))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeNamespaceImportCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeObject))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeObjectCreateExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeParameterDeclarationExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeParameterDeclarationExpressionCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodePrimitiveExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodePropertyReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodePropertySetValueReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeRegionDirective))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeRegionMode))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeRemoveEventStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeSnippetCompileUnit))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeSnippetExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeSnippetStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeSnippetTypeMember))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeStatementCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeThisReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeThrowExceptionStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTryCatchFinallyStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeConstructor))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeDeclaration))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeDeclarationCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeDelegate))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeMember))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeMemberCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeOfExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeParameter))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeParameterCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeReference))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeReferenceCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeReferenceOptions))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeVariableDeclarationStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeVariableReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.FieldDirection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.MemberAttributes))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CodeCompiler))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CodeDomProvider))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CodeGenerator))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CodeGeneratorOptions))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CodeParser))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CompilerError))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CompilerErrorCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CompilerInfo))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CompilerParameters))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CompilerResults))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.Executor))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.GeneratorSupport))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.ICodeCompiler))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.ICodeGenerator))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.ICodeParser))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.LanguageOptions))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.TempFileCollection))]
[assembly: TypeForwardedTo(typeof(Microsoft.VisualBasic.VBCodeProvider))]
[assembly: TypeForwardedTo(typeof(Microsoft.CSharp.CSharpCodeProvider))]
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<NoWarn>$(NoWarn);CS0618</NoWarn>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<IsPartialFacadeAssembly Condition="$(TargetFramework.StartsWith('net4'))">true</IsPartialFacadeAssembly>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net461'">
<Compile Include="System.Configuration.ConfigurationManager.cs" />
<Compile Include="$(CommonPath)System\Obsoletions.cs" Link="Common\System\Obsoletions.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<Compile Include="System.Configuration.ConfigurationManager.net461.cs" />
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Security.Permissions\ref\System.Security.Permissions.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true'">
<Reference Include="System.Configuration" />
</ItemGroup>
</Project>
Loading