I am trying to make a .NET 2 application to run on a Linux environment. So I write code for reading XML document
Something like this:
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(SettingsName);
XmlNodeList xmlNodeList= xmldoc.SelectNodes("/settings/devicesettings/");
After that I foreach the XmlNodeList with
foreach (XmlNode xn in xmlNodeList)
But when it reaches the
foreach
Throws exception:
An exception was thrown by the type initializer for System.Console
InnerException
Exception: handle
Parameter name: Invalid.
StackTrace: System.ArgumentException: handle
Parameter name: Invalid.
at System.IO.FileStream..ctor (IntPtr handle, FileAccess access, Boolean ownsHandle, Int32 bufferSize, Boolean isAsync, Boolean isZeroSize) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (intptr,System.IO.FileAccess,bool,int,bool,bool)
at System.Console.Open (IntPtr handle, FileAccess access, Int32 bufferSize) [0x00000] in <filename unknown>:0
at System.Console.OpenStandardError (Int32 bufferSize) [0x00000] in <filename unknown>:0
at System.Console..cctor () [0x00000] in <filename unknown>:0
So please advice what and why is going on?