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

Make sure Memory and Unsafe are packaged w/o RID#16244

Merged
ericstj merged 1 commit into
dotnet:masterfrom
ericstj:refactorMemoryUnsafeConfigs
Feb 17, 2017
Merged

Make sure Memory and Unsafe are packaged w/o RID#16244
ericstj merged 1 commit into
dotnet:masterfrom
ericstj:refactorMemoryUnsafeConfigs

Conversation

@ericstj
Copy link
Copy Markdown
Member

@ericstj ericstj commented Feb 17, 2017

The workaround being used by our build system to only build these
packages on Windows was leaking into the packaging.

To fix that I overrode the packaging RID for Unsafe, since it was the
only thing that actually needed the filtering.

Then to fix Memory I added a reference assembly for unsafe and built
against that instead.

Eventually we'll be able to remove the filtering from unsafe but having
a reference assembly for this is general goodness.

I also tried to tackle cross-compiling Unsafe for netstandard.dll and hit
what appears to be a bug in ilasm. It didn't like me claiming that
System.Object was in netstandard, and instead tried to insist it was in
mscorlib and added a reference to that to the output assembly. I could
change System.Object to some other type (eg: System.Attribute) and it
was fine. @jkotas I think this is one of those hard-coding-the core assembly
bugs. We should see if it's fixed by using a newer ilasm (@mellinoe is
working on that), if not we should hunt it down and fix it in coreclr.

/cc @mellinoe @ahsonkhan @weshaggard

netstandard1.0;
netstandard;
netcoreapp-Windows_NT;
netcoreapp-Unix;
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 must keep OS-specific configs since it references the core assembly which is different per-os.

The workaround being used by our build system to only build these
packages on Windows was leaking into the packaging.

To fix that I overrode the packaging RID for Unsafe, since it was the
only thing that actually needed the filtering.

Then to fix Memory I added a reference assembly for unsafe and built
against that instead.
@ericstj ericstj force-pushed the refactorMemoryUnsafeConfigs branch from 0f421ca to fbafeb4 Compare February 17, 2017 01:09
Copy link
Copy Markdown
Contributor

@mellinoe mellinoe left a comment

Choose a reason for hiding this comment

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

LGTM

@ericstj ericstj merged commit b31ed13 into dotnet:master Feb 17, 2017
<PropertyGroup>
<BuildConfigurations>
netstandard1.0;
netstandard;
Copy link
Copy Markdown
Member

@jkotas jkotas Feb 17, 2017

Choose a reason for hiding this comment

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

Which version out of these two will end up in the netcoreapp flat layout?

It should be the netstandard1.0 one so that it does not have crazy dependencies.

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.

the netstandard one will.

What do you mean by "crazy" dependencies? Currently they're both building against System.Runtime, but the "netstandard" one should eventually build against netstandard.dll (once ilasm is fixed). Both System.Runtime.dll and netstandard.dll are part of netcoreapp so I don't see either of them as "crazy".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

S.R.CS.Unsafe is very low (depends on System.Runtime only) and it is being used to implement other netcoreapp assemblies that are very low (System.Memory, likely more in future).

netstandard.dll is very high. If S.R.CS.Unsafe bundled into netcoreapp depends on netstandard.dll, we will end up with dependency cycle in netcoreapp implementation.

Do we have something in place to catch implementation dependency cycles in the new build? If not, we should add it. Dependency cycles are nightmare to untangle once they sneak in.

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.

Yes, we do catch dependency cycles. The VerifyClosure task runs against MS.NETCore.App and catches exactly the type of cycle you suggest.

If we do run into a situation where a low-level assembly needs to use this we can cross-compile for NETCoreApp and have it reference either System.Runtime, or even System.Private.Corelib. If you'd prefer to undo the factoring I did to allow this project to specify the core-assembly I can do that too. I left it in because it seemed like the "right thing to do" to build a netstandard version of this library, and because it uncovered a bug in ilasm.

Currently this assembly isn't even in the shared framework FYI.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

catches exactly the type of cycle you suggest

Awesome! Thanks

If you'd prefer to undo the factoring

This factoring is good because of it gives us flexibility. My concern was only about what kind of build we get for netcoreapp.

we can cross-compile for NETCoreApp and have it reference either System.Runtime, or even System.Private.Corelib

Agree. We will want to do that as we try to do #15768 again. cc @ahsonkhan @mellinoe

@jkotas
Copy link
Copy Markdown
Member

jkotas commented Feb 18, 2017

hit what appears to be a bug in ilasm

@ericstj Have you opened a bug on it?

@jkotas jkotas mentioned this pull request Feb 20, 2017
@weshaggard
Copy link
Copy Markdown
Member

@ericstj are you planning to add these guys to the shared framework as a separate change?

@ericstj
Copy link
Copy Markdown
Member Author

ericstj commented Feb 21, 2017

hit what appears to be a bug in ilasm

@ericstj Have you opened a bug on it?

I have not. Since we were still using the desktop ilasm here I didn't want to create noise for you. I think we need to test with the coreclr ilasm before filing a bug in coreclr. Let's let dotnet/buildtools#1301 track that.

@ericstj are you planning to add these guys to the shared framework as a separate change?

No. Its unclear to me if these need to be in the shared framework. My understanding based on discussion with @ahsonkhan is that System.Memory timeline may not align with nca2.0 timeline but I could be wrong. Not sure what folks want for Unsafe but none of my existing closure-based rules will bring it in.

@benaadams
Copy link
Copy Markdown
Member

I think Span itself should typeforward but you want the System.Memory span extensions to remain in package (so for example the extensions have access to System.Numerics.Vector etc)

@karelz karelz modified the milestone: 2.0.0 Feb 22, 2017
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…afeConfigs

Make sure Memory and Unsafe are packaged w/o RID

Commit migrated from dotnet/corefx@b31ed13
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.

7 participants