2

Anyone has the same problem with Windows Phone 8.1?

  1. The type or namespace name 'FileStream' does not exist in the namespace 'System.IO' (are you missing an assembly reference?)
  2. The name 'FileMode' does not exist in the current context
  3. The name 'FileAccess' does not exist in the current context
  4. 'System.IO.StreamReader' does not contain a definition for 'Close' and no extension method 'Close' accepting a first argument of type 'System.IO.StreamReader' could be found (are you missing a using directive or an assembly reference?)
v.g.
  • 1,076
  • 5
  • 19
  • 38
  • 1
    Would be better if we see your code also.. – Soner Gönül Oct 10 '14 at 13:40
  • Its not the code. I try to use System.IO.FileStream and the other three things and it just cant find them, but System.IO is included... – v.g. Oct 10 '14 at 13:43
  • according to msdn it should be supported http://msdn.microsoft.com/en-us/library/system.io.filestream%28v=vs.110%29.aspx – thumbmunkeys Oct 10 '14 at 13:44
  • Why don't you try adding System.IO as a reference to your project? Just saying – Jhon Oct 10 '14 at 13:44
  • I know, I saw it too, but.. – v.g. Oct 10 '14 at 13:44
  • @JhonAlx it doesn't work that way for windows phone 8.1 – thumbmunkeys Oct 10 '14 at 13:44
  • Have someone had the same issue? – v.g. Oct 10 '14 at 13:45
  • could it be that it's just a intellisense error? You can test this by compiling, the compile will succeed, but intellisense will still show errors. – thumbmunkeys Oct 10 '14 at 13:45
  • is it a universal app? – thumbmunkeys Oct 10 '14 at 13:50
  • A Windows Phone 8.1 project, no Windows 8.1. I reopened VS but still fail – v.g. Oct 10 '14 at 13:51
  • can you tell me which template you chose when you made the project? – thumbmunkeys Oct 10 '14 at 13:53
  • Ofc. I created it from Blend using "Blank App (Windows Phone)". This is really weird situation – v.g. Oct 10 '14 at 13:54
  • System.IO.FileStream is not available in Windows Runtime apps. What are trying to accomplish? – Alovchin Oct 10 '14 at 13:57
  • Serialization/Deserialization of a type. Actually this code is generated by Xsd2Code tool and it puts these methods and stuff. What should i do? – v.g. Oct 10 '14 at 13:59
  • Try replacing the FileStream either by a usual Stream, or by one of Windows Runtime streams. It seems to me recently that .NET for Windows Runtime apps has the main goal of providing a projection for Windows Runtime types. Windows Runtime has its own file streams (FileInputStream, FileOutputStream and FileRandomAccessStream), that's likely why we don't have a .NET FileStream. I may be wrong though. – Alovchin Oct 10 '14 at 14:02
  • Well this is not documented anywhere. How should I know? – v.g. Oct 10 '14 at 14:07
  • @V.G. I can't tell you for sure but here's a document called [.NET for Windows Store apps overview](http://msdn.microsoft.com/en-us/library/windows/apps/br230302.aspx). It states that .NET subset for Windows Runtime among the other things omits _types that overlap with Windows Runtime types_. I think this is your case. And [here are](http://msdn.microsoft.com/en-us/library/windows/apps/hh454050.aspx) System.IO namespaces for Windows Runtime docs that have no FileStream class. – Alovchin Oct 10 '14 at 14:13
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/62832/discussion-between-v-g-and-alovchin). – v.g. Oct 10 '14 at 14:28

1 Answers1

0

I had the same problem. The post below resolved the problem.

How do I read an embedded text file on Windows Phone 8.1?

Community
  • 1
  • 1
Matthew C
  • 616
  • 3
  • 10
  • 18