-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Description
We have poly filled the Index and Range types to make them work on ns2.0 and netfx. This issue is tracking to ensure all components we build in .NET shouldn't carry its own version of these types and instead should be referencing Microsoft.Bcl.Memory package.
Searching the sources, looks only ComInterfaceGenerator.csproj is using the Index source file. To remove this dependency, we will need to have this project depend on Microsoft.Bcl.Memory and ensure Microsoft.Bcl.Memory library is included in microsoft.netcore.app.ref pack too under the analyzers\dotnet\cs folder. Unfortunately, the current infrastructure does not allow to bin pace such dependency.
Here are the things need to be done:
- Remove compiling the Index source code in
Line 29 in 7b1c0f3
<Compile Include="$(CoreLibSharedDir)System\Index.cs" Link="Common\System\Index.cs" /> - Let ComInterfaceGenerator.csproj reference the project of
Microsoft.Bcl.Memory. - Delete the lines
runtime/src/libraries/Directory.Build.targets
Lines 205 to 209 in 7b9f1c3
<ItemGroup Condition="'$(IncludeIndexRangeTypes)' == 'true' and '$(TargetFrameworkIdentifier)' != '.NETCoreApp'"> <Compile Include="$(CoreLibSharedDir)System\Index.cs" Link="System\Index.cs" /> <Compile Include="$(CoreLibSharedDir)System\Range.cs" Link="System\Range.cs" /> <Compile Include="$(CoreLibSharedDir)System\Numerics\Hashing.cs" Link="System\Numerics\Hashing.cs" /> </ItemGroup> - Ensure when building
Microsoft.Bcl.Memoryis bin placed inside themicrosoft.netcore.app.refpackage underanalyzers\dotnet\csfolder and next to the ComInterfaceGenerator lib. - Edit Index and Range to remove the
#ifthere and only keeppublicspecifier. - edit
Microsoft.Bcl.Memory.csprojfrom librarysrcfolder to remove the line<DefineConstants>MICROSOFT_BCL_MEMORY;$(DefineConstants)</DefineConstants> - Build the whole tree and validate tests of the com interface and
Microsoft.Bcl.Memorypass and the packagemicrosoft.netcore.app.refincludeMicrosoft.Bcl.Memorylibrary.
Reproduction Steps
Com interface source gen is including the Index.cs in the project.
Expected behavior
No component in .NET is embedding the Index/Range sources.
Actual behavior
Com interface source gen carries a copy of the Index type code.
Regression?
No
Known Workarounds
No response
Configuration
No response
Other information
No response