-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Make sure Memory and Unsafe are packaged w/o RID #16244
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <PropertyGroup> | ||
| <BuildConfigurations> | ||
| netstandard1.0; | ||
| netstandard; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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".
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks
This factoring is good because of it gives us flexibility. My concern was only about what kind of build we get for netcoreapp.
Agree. We will want to do that as we try to do #15768 again. cc @ahsonkhan @mellinoe |
||
| </BuildConfigurations> | ||
| </PropertyGroup> | ||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
| // ------------------------------------------------------------------------------ | ||
| // Changes to this file must follow the http://aka.ms/api-review process. | ||
| // ------------------------------------------------------------------------------ | ||
|
|
||
| namespace System.Runtime.CompilerServices | ||
| { | ||
| public static partial class Unsafe | ||
| { | ||
| public static ref T AddByteOffset<T>(ref T source, System.IntPtr byteOffset) { throw null; } | ||
| public static ref T Add<T>(ref T source, int elementOffset) { throw null; } | ||
| public static ref T Add<T>(ref T source, System.IntPtr elementOffset) { throw null; } | ||
| public static bool AreSame<T>(ref T left, ref T right) { throw null; } | ||
| public unsafe static void* AsPointer<T>(ref T value) { throw null; } | ||
| public unsafe static ref T AsRef<T>(void* source) { throw null; } | ||
| public static T As<T>(object o) where T : class { throw null; } | ||
| public static ref TTo As<TFrom, TTo>(ref TFrom source) { throw null; } | ||
| public static System.IntPtr ByteOffset<T>(ref T origin, ref T target) { throw null; } | ||
| public static void CopyBlock(ref byte destination, ref byte source, uint byteCount) { } | ||
| public unsafe static void CopyBlock(void* destination, void* source, uint byteCount) { } | ||
| public static void CopyBlockUnaligned(ref byte destination, ref byte source, uint byteCount) { } | ||
| public unsafe static void CopyBlockUnaligned(void* destination, void* source, uint byteCount) { } | ||
| public unsafe static void Copy<T>(void* destination, ref T source) { } | ||
| public unsafe static void Copy<T>(ref T destination, void* source) { } | ||
| public static void InitBlock(ref byte startAddress, byte value, uint byteCount) { } | ||
| public unsafe static void InitBlock(void* startAddress, byte value, uint byteCount) { } | ||
| public static void InitBlockUnaligned(ref byte startAddress, byte value, uint byteCount) { } | ||
| public unsafe static void InitBlockUnaligned(void* startAddress, byte value, uint byteCount) { } | ||
| public unsafe static T Read<T>(void* source) { throw null; } | ||
| public static int SizeOf<T>() { throw null; } | ||
| public static ref T SubtractByteOffset<T>(ref T source, System.IntPtr byteOffset) { throw null; } | ||
| public static ref T Subtract<T>(ref T source, int elementOffset) { throw null; } | ||
| public static ref T Subtract<T>(ref T source, System.IntPtr elementOffset) { throw null; } | ||
| public unsafe static void Write<T>(void* destination, T value) { } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> | ||
| <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> | ||
| <PropertyGroup> | ||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <ProjectGuid>{649A377C-1E07-4105-B01F-7F1044D3356C}</ProjectGuid> | ||
| <CLSCompliant>false</CLSCompliant> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" /> | ||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" /> | ||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.0-Debug|AnyCPU'" /> | ||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.0-Release|AnyCPU'" /> | ||
| <ItemGroup> | ||
| <Compile Include="System.Runtime.CompilerServices.Unsafe.cs" /> | ||
| <Reference Include="System.Runtime" /> | ||
| </ItemGroup> | ||
| <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> | ||
| </Project> |
There was a problem hiding this comment.
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.