Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Use nullablePublicOnly flag explicitly in source and ref assemblies#39174

Merged
safern merged 2 commits into
dotnet:masterfrom
safern:NullablePublicOnlySrcAndRef
Jul 3, 2019
Merged

Use nullablePublicOnly flag explicitly in source and ref assemblies#39174
safern merged 2 commits into
dotnet:masterfrom
safern:NullablePublicOnlySrcAndRef

Conversation

@safern

@safern safern commented Jul 3, 2019

Copy link
Copy Markdown
Member

Fixes: https://github.com/dotnet/coreclr/issues/25522

By adding the flag when IsTestProject != true it was passing down this flag for shim projects as well, which was causing the compiler to include some typedefs and attributes to the shims (mscorlib, etc).

cc: @stephentoub @sergiy-k @fadimounir

@safern safern requested review from ViktorHofer and ericstj July 3, 2019 18:45
Comment thread Directory.Build.props Outdated
@fadimounir

Copy link
Copy Markdown

I'm not familiar with these projects to give any meaningful code review feedback. If you can verify that mscorlib.dll with your fix doesn't have any method with IL code, that would be great (it should strictly have type forwarder declarations only)

@safern

safern commented Jul 3, 2019

Copy link
Copy Markdown
Member Author

If you can verify that mscorlib.dll with your fix doesn't have any method with IL code, that would be great

I did verify it on a local build.

Comment thread Directory.Build.props
@safern safern force-pushed the NullablePublicOnlySrcAndRef branch from ca1fd68 to dc4ffb3 Compare July 3, 2019 18:57
Comment thread Directory.Build.props Outdated
Comment thread Directory.Build.props Outdated
@safern safern force-pushed the NullablePublicOnlySrcAndRef branch from dc4ffb3 to e9140f6 Compare July 3, 2019 21:37
@ericstj

ericstj commented Jul 3, 2019

Copy link
Copy Markdown
Member

I don't think I like this heuristic. We have 100s of assemblies that are going to have this additional attribute even if they don't need it / use it. That's not limited to just the shims. Here's a couple other ideas: 1) compiler only emits this when needed 2) compiler errors when its needed and not requested and we more selectively enable it in our projects.

@safern

safern commented Jul 3, 2019

Copy link
Copy Markdown
Member Author

That is what I suggested here: #38887 (comment)

I agree, the compiler shouldn't emit it if not needed.

cc: @cston @agocke

@safern

safern commented Jul 3, 2019

Copy link
Copy Markdown
Member Author

@cston opened: dotnet/roslyn#36977

So I think once we get that fixed, we will be able to use the feature flag globally without any conditions.

Will merge this as is until we get a new compiler with that fixed.

@safern safern merged commit 0e2693a into dotnet:master Jul 3, 2019
@safern safern deleted the NullablePublicOnlySrcAndRef branch July 3, 2019 23:39
@karelz karelz added this to the 3.0 milestone Jul 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PublishReadyToRun should not compile mscorlib

6 participants