corert icon indicating copy to clipboard operation
corert copied to clipboard

Simple I/O does not work

Open jkotas opened this issue 10 years ago • 14 comments

File.ReadAllBytes("foo.txt");
Console.WriteLine(Directory.GetCurrentDirectory());

There are a few missing P/Invoke marshallers for SafeHandle and StringBuilder.

jkotas avatar Feb 08 '16 16:02 jkotas

@tijoytom @yizhang82 This is blocking a number of simple tests. E.g. @bloudraak asked about this on gitter.

When do you expect that the mcg is going to be properly hooked up to handle these?

I am wondering whether we should add these missing cases to the temporary interop gen in the compiler in the mean time - it is trivial to do.

jkotas avatar Feb 08 '16 17:02 jkotas

@jkotas @yizhang82 The recent CLI changes broke mcg , I have a fix which is not yet merged since CLI folks are moving dotnet compile native as a standalone command.Given this is blocking i will merge the changes today and will update the documentation on how to enable mcg.

tijoytom-zz avatar Feb 08 '16 20:02 tijoytom-zz

Sorry , I did not mean to close it.

tijoytom-zz avatar Feb 08 '16 20:02 tijoytom-zz

Could you please verify that your change makes the end-to-end work for the above simple test (ideally on both Windows and Unix)?

jkotas avatar Feb 08 '16 21:02 jkotas

@tijoytom Can you also see if we can add a simple test in there to avoid future regressions?

yizhang82 avatar Feb 08 '16 22:02 yizhang82

@yizhang82 @jkotas I merged the changes to CLI and verified that Console.WriteLine(Directory.GetCurrentDirectory()) work , but File.ReadAllBytes throw FileNotFound since System.IO.FileSystem is not included in compilation.We need to get pass along the app references to ilc.exe , guess there's workitem for this?.I will verify some other simple scenarios on Windows and then on Linux.

tijoytom-zz avatar Feb 10 '16 00:02 tijoytom-zz

We need to get pass along the app references to ilc.exe , guess there's work item for this?

@schellap is working on this.

jkotas avatar Feb 10 '16 00:02 jkotas

@tijoytom I have looked at your CLI change https://github.com/dotnet/cli/pull/1293. It looks like it is generating the interop for .exe only - it is nice, but it won't help the framework where all interop is. Do you have things in place to generate the interop code for the framework as well (so that the temporary interop generator in ilc can be disabled)?

jkotas avatar Feb 10 '16 00:02 jkotas

@jkotas @yizhang82 By framework you mean ILSDK?We have two options , one is to generate the interop for them during app compile time another is to run mcg as a post build process and add *.interop.dll to ILSDK package.As obvious the first option is redundant , but can be a stop-gap measure till i hook up the post build and generate the package.

tijoytom-zz avatar Feb 10 '16 20:02 tijoytom-zz

Senthil is almost done with trimming the temporary AppDeps package to bare minimum (to just .dlls that we do not have packaged properly yet). We are about to start getting most of the framework (e.g. System.Console.dll, System.IO.*.dll, etc.) via regular nuget packages. So adding *.interop.dll to AppDeps package does not really work well.

jkotas avatar Feb 10 '16 22:02 jkotas

We need to add .NET Native version of System.Threading.Overlapped.dll to appdeps package to make this work out of the box (the CoreCLR version of this .dll that we are picking up right now does not work because of it depends on mscorlib). @schellap Could you please do it when you get a chance?

The other part needed to make this work out of the box is to pick up a updated System.IO.FileSystem.dll - it will solve itself over time.

In the meantime, the workaround is to manually pick up right System.Threading.Overlapped.dll and System.IO.FileSystem.dll from corefx. E.g. build corefx repo and change the paths in ilc response file to:

-r:C:\corefx\bin\Windows_NT.AnyCPU.Debug\System.Threading.Overlapped\netcore50\System.Threading.Overlapped.dll
-r:C:\corefx\bin\Windows_NT.AnyCPU.Debug\System.IO.FileSystem\System.IO.FileSystem.dll

jkotas avatar Feb 22 '16 05:02 jkotas

@jkotas, I had added the Threading.Overlapped with https://github.com/dotnet/cli/pull/1470 using the DLL you had shared. Does FS dll need update as well from same location?

schellap avatar Feb 22 '16 06:02 schellap

Cool - I have not realized that there is updated package available. I am fixing up the CoreRT repo to pull it down as well: https://github.com/dotnet/corert/pull/914

jkotas avatar Feb 22 '16 08:02 jkotas

This works now with most recent package versions.

jkotas avatar Feb 22 '16 08:02 jkotas