dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.

Home Page:http://dot.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

removefeature:Globalization

RalfKornmannEnvision opened this issue · comments

As ICU has a dataset of close to 30MB alone and we would need to ship and load anything I am somewhat interested in getting rid of it as invariant culture is good enough for us. 

removefeature:Globalization seems to mostly do the trick but it still tries to link 6 GlobalizationNative_* functions. It's a optimized build and >I even forced GetGlobalizationInvariantMode to set invariantEnabled always to true before it calls Interop.Globalization.LoadICU. The call is still there but should be dead code.

I am sure I can just provide some dummy functions to work around this. But I am curious if removefeature:Globalization should remove all dependencies to System.Globalization.Native?

I am sure I can just provide some dummy functions to work around this. But I am curious if removefeature:Globalization should remove all dependencies to System.Globalization.Native?

Yes, it probably should, but removefeature is a bit of a hack and needs RemovingILProvider.cs to stay in sync with CoreLib (it's a component that replaces method bodies when a feature is getting removed).

You could follow the technique described in #7962 to figure out what is the thing that is still bringing System.Globalization.Native into the picture and add extra stubbing out in RemovingILProvider.cs for that.

Globalization code (that CoreRT shares with CoreCLR but hasn't updated for a couple months) changed a bit in the past months because it was decided we need to inflict the ICU pain on Windows by default too, so it's possible the RemovingILProvider will get even more out of sync as we move the codebase to the dotnet/runtimelab repo.

A more systematic approach to this is coming in .NET 5: dotnet/designs#99. The compiler will need to learn respecting the XML annotations described in the document. Globalization in CoreLib will be already annotated with that once we finish the move to runtimelab.

Found the issue but I am not sure on which side the fix needs to be applied.

In RemovingILProvider.cs it looks for System.Globalization.Native but in src\Common\src\Interop\Interop.Libraries.cs it's libSystem.Globalization.Native

It should be fixed in RemovingILProvider.cs.