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

Cleanup GenFacades logic and don't bind against non-shipping contract assemblies #78703

Merged
merged 4 commits into from
Nov 22, 2022

Conversation

ViktorHofer
Copy link
Member

@ViktorHofer ViktorHofer commented Nov 22, 2022

Fixes #63467

Update the GenFacades package and configure it so that shims can pass a different reference assembly in than what they return via the ReferenceAssembly attribute in the AnnotateTargetPathWithTargetPlatformMonikerWithReferenceAssembly target.

Restructure the resolveContract.targets file to make it more shareable with the rest of the repository (potential follow-up change). Define section to better indicate what features the file exposes. Merge the resolveContract.props into it as that file's purpose was limited.

Introduce the AnnotateTargetPathWithContract switch to make it configure-able when a source project should return the reference project's assembly instead of the source assembly, when other projects compile against it. Set it so that reference assemblies are only returned for NetCoreAppCurrent tfms or when the project isn't packable.

System.DirectoryServices.AccountManagement now builds against
src/System.DirectoryServices instead of ref/System.DirectoryServices
(because the package doesn't contain the ref assembly).

Because of that, the compiler now gets confused because of the
System.DirectoryServices.Interop namespace and the global Interop class.
This happens even though the DirectoryServices.Interop namespace doesn't include any
public types.

That results in the following errors:

src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\AD\SidList.cs(50,26): error CS0246: The type or namespace name 'SID_AND_ATTRIBUTES' could not be found (are you missing a using directive or an assembly reference?)
src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\interopt.cs(439,20): error CS0246: The type or namespace name 'UNICODE_INTPTR_STRING' could not be found (are you missing a using directive or an assembly reference?)

This commit fixes that by removing the System.DirectoryServices.Interop
namespace and moving the types into the parent namespace.

Now that Schema compiles against the source assembly of System.CodeDom,
it receives nullability errors. I'm suppressing them manually for now
but am filing an issue to correctly fix those.

Related: #78036
Opened #78704 to track cleaning-up the introduced nullability suppressions.

System.DirectoryServices.AccountManagement now builds against
src/System.DirectoryServices instead of ref/System.DirectoryServices
(because the package doesn't contain the ref assembly).

Because of that, the compiler now gets confused because of the
System.DirectoryServices.Interop namespace and the global Interop class.
This happens even though the DirectoryServices.Interop namespace doesn't include any
public types.

That results in the following erros:
src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\AD\SidList.cs(50,26): error CS0246: The type or namespace name 'SID_AND_ATTRIBUTES' could not be found (are you missing a using directive or an assembly reference?)
src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\interopt.cs(439,20): error CS0246: The type or namespace name 'UNICODE_INTPTR_STRING' could not be found (are you missing a using directive or an assembly reference?)

This commit fixes that by removing the System.DirectoryServices.Interop
namespace and moving the types into the parent namespace.
Now that Schema compiles against the source assembly of System.CodeDom,
it receives nullability errors. I'm suppressing them manually for now
but am filing an issue to correctly fix those.

Related: dotnet#78036
@ghost
Copy link

ghost commented Nov 22, 2022

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #63467

Update the GenFacades package and configure it so that shims can pass a different reference assembly in than what they return via the ReferenceAssembly attribute in the AnnotateTargetPathWithTargetPlatformMonikerWithReferenceAssembly target.

Restructure the resolveContract.targets file to make it more shareable with the rest of the repository (potential follow-up change). Define section to better indicate what features the file exposes. Merge the resolveContract.props into it as that file's purpose was limited.

Introduce the AnnotateTargetPathWithContract switch to make it configure-able when a source project should return the reference project's assembly instead of the source assembly, when other projects compile against it. Set it so that reference assemblies are only returned for NetCoreAppCurrent tfms or when the project isn't packable.

System.DirectoryServices.AccountManagement now builds against
src/System.DirectoryServices instead of ref/System.DirectoryServices
(because the package doesn't contain the ref assembly).

Because of that, the compiler now gets confused because of the
System.DirectoryServices.Interop namespace and the global Interop class.
This happens even though the DirectoryServices.Interop namespace doesn't include any
public types.

That results in the following errors:

src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\AD\SidList.cs(50,26): error CS0246: The type or namespace name 'SID_AND_ATTRIBUTES' could not be found (are you missing a using directive or an assembly reference?)
src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\interopt.cs(439,20): error CS0246: The type or namespace name 'UNICODE_INTPTR_STRING' could not be found (are you missing a using directive or an assembly reference?)

This commit fixes that by removing the System.DirectoryServices.Interop
namespace and moving the types into the parent namespace.

Now that Schema compiles against the source assembly of System.CodeDom,
it receives nullability errors. I'm suppressing them manually for now
but am filing an issue to correctly fix those.

Related: #78036

Author: ViktorHofer
Assignees: ViktorHofer
Labels:

area-Infrastructure-libraries

Milestone: -

@ViktorHofer ViktorHofer changed the title Cleanup APICompat and GenAPI logic and don't bind against non-shipping contract assemblies Cleanup GenFacades logic and don't bind against non-shipping contract assemblies Nov 22, 2022
Copy link
Member

@akoeplinger akoeplinger left a comment

Choose a reason for hiding this comment

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

One question, looks good otherwise.

src/libraries/apicompat/ApiCompat.proj Show resolved Hide resolved
@ViktorHofer ViktorHofer merged commit c8503d3 into dotnet:main Nov 22, 2022
@ViktorHofer ViktorHofer deleted the CleanupApiCompatAndGenAPILogic branch November 22, 2022 19:01
@ghost ghost locked as resolved and limited conversation to collaborators Dec 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OOB Library's AssemblyVersion is inconsistent between ref and src assemblies in servicing
2 participants