FileStream' does not contain a definition for 'Close'
Hey... I was trying to build my project on Windows Store Universal 10 platform but I'm getting following error:
'FileStream' does not contain a definition for 'Close' and no extension method 'Close' accepting a first argument of type 'FileStream' could be found (are you missing a using directive or an assembly reference?)
Any help here would really be appreciated.
file.Close() is where I'm getting the error, I'm using X$$anonymous$$L serializer to save some player data.
XmlSerializer ser = new XmlSerializer(typeof(PlayerData));
FileStream file = File.Create(Application.persistentDataPath + "/playerInfo.dat");
PlayerData data = new PlayerData();
data.PlayerName = playerName;
ser.Serialize(file, data);
file.Close();
same issue here with unity 5.4.0f3 and windows10. Of course as standalone it gave no problems . It makes no sense :v
Answer by paskal007r · Sep 01, 2016 at 05:37 PM
SOLVED! You just need to change .Close() to .Dispose()
Your answer
Follow this Question
Related Questions
What is binaryformatter and how to use it? And how to use filestream? 1 Answer
Need to use .net4.6.2 version of System.runtime 0 Answers
Error While Building for Windows Universal 0 Answers
Streamwriter writealltext on android in existing file, it clear it, but works fine on pc. 0 Answers
Building Error 0 Answers