Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

File I/O is not working #2147

Closed
Fabi opened this issue Nov 5, 2016 · 3 comments
Closed

File I/O is not working #2147

Fabi opened this issue Nov 5, 2016 · 3 comments
Labels

Comments

@Fabi
Copy link

Fabi commented Nov 5, 2016

Getting pathes from the Directory classes are fine, however creating or reading files let the native app crash.

I tried simple code like
File.Create("bob.txt");
or
var fs = new FileStream("bob.txt", FileMode.Append);

Using RyuJIT compiler it prints me "Unhandled Exception: System.IO.FileNotFoundException: IO_FileNotFound_FileName
IO_FileName_Name"

and using the cpp one I'm not even able to build in debug mode.

@MichalStrehovsky
Copy link
Member

It compiles, but at runtime it prints:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.Overlapped'. The system cannot find the file specified.
File name: 'System.Threading.Overlapped'

This is because System.Threading.Overlapped.dll wasn't present in the inputs to the compiler. This is in the same bucket as e.g. #2110 and is caused by various cherry picked framework assemblies that don't match or are incomplete. There's work scheduled to fix this.

CppCodegen is hitting various problems related to lazy P/invokes and the missing handling of RVA static fields. I filed a separate issue #2149 on it.

Cc @joshfree @SedarG

@Fabi
Copy link
Author

Fabi commented Jan 7, 2017

Without cpp codegen it works fine for me, thanks!

With cpp:

`C:\Users\Fabian\Documents\Development\nativetest>dotnet build /t:LinkNative /p:NativeCodeGen=cpp
Microsoft (R) Build Engine version 15.1.458.808
Copyright (C) Microsoft Corporation. All rights reserved.

nativetest.cpp
C:\Users\Fabian\Documents\Development\nativetest\Program.cs(109752): error C2440: 'initializing': cannot convert from 'System_Private_CoreLib::System::Threading::NativeOverlapped *' to 'intptr_t' [C:\Users\Fabian\Documents\Development\nativetest\nativetest.csproj]
C:\Users\Fabian\Documents\Development\nativetest\Program.cs(109752): note: There is no context in which this conversion is possible
C:\Users\Fabian\corert\bin\Product\Windows_NT.x64.Release\packaging\publish1\Microsoft.NETCore.Native.targets(117,5): error MSB3073: The command "cl @"obj\X64\Debug\netcoreapp1.0\native\cl.rsp"" exited with code 2. [C:\Users\Fabian\Documents\Development\nativetest\nativetest.csproj]`

@jkotas
Copy link
Member

jkotas commented Jan 7, 2017

@Fabi Thanks for giving it a try! I have create a new issue for the CppCodeGen bug.

@SedarG SedarG removed their assignment Feb 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants