- Home /
Missing FileStream constructor(s): FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync);
I'm moving some code over from a Win32 console app into Unity. I've been careful to keep the code Win32, to use only .Net 2.0 stuff, and to not use 'unsafe' but the constructor I'm using for FileStream does not seem to be present:
fs = new FileStream(hidHandle, FileAccess.ReadWrite, InputReportByteLength, true);
i.e. a call to
public FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync);
Looking in the mono source code I can see the constructor I need, but it is not there in Unity.
If I "go to definition" in Visual Studio the constructor I need is mentioned as a hint:
[Obsolete("Use FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) instead")]
public FileStream(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync);
Where is it?
Is there another, Unity friendly, way to make an asynchronous FileStream from a SafeFileHandle to an overlapping device i/o 'file'?
Answer by steo · Jan 17, 2017 at 04:59 PM
Way to get full .Net dlls with constructor you want:
Select Edit->Project Settings->Player->OtherSettings->Api Compability Settings-> .Net2.0 (not subset)
.
Then to regenerate .csproj files select Assets->Open C# project
.
Your answer
Follow this Question
Related Questions
Why is my FileStream constructor throwing an exception for an overlapped HID device 'file' handle? 1 Answer
System.IO.IOException: Win32 IO returned 25?anyone 2 Answers
Unity iPhone: Can I store data on the iPhone to be used later? 4 Answers
Serialization Issue (Data not updating) 1 Answer
File paths on Android 0 Answers