Strange problem
-
Hallo CP's! Yesterday I've encountered a really strange problem and I hope someone here can help me out. I'm currently developing a small application, which manages birthdays and reminds the user a few days before a birthday. The birthdays are stored into a XML file by using XML serialization.
try
{
XmlRootAttribute xmlRoot = new XmlRootAttribute("BirthdayList");
xmlRoot.Namespace = "http://www.troschuetz.de";XmlSerializer serializer = new XmlSerializer(typeof(BirthdayList), xmlRoot); //<--------- serializer.Serialize(writeStream, this.birthdays);
}
The preceeding code snippet is called by the event handler for the Closing event of my main form. Everything worked fine during development, so I began using the application. As the program has a reminder function it's supossed to run from login until logoff of an user. But here is where the drama begins. When I normally exit the application everything works fine, but when the program has to exit due to an user logoff or a shutdown it crashes. The error is caused by the line marked in the above code snippet. This is what happens: 1. A dialog box pops up saying: "csc.exe Error in the application The application could not be initialized correctly." (Please note that this error message was translated from german) 2. After clicking the OK button the dialog box disappears and the following exception is thrown: Could not find file "C:\DOKUME~1\Arbeiten\LOKALE~1\Temp\ak6ctdg1.dll". System.IO.FileNotFoundException at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.CodeDom.Compiler.CodeCompiler.FromFileBatch(CompilerParameters options, String[] fileNames) at System.CodeDom.Compiler.CodeCompiler.FromSourceBatch(CompilerParameters options, String[] sources) at System.CodeDom.Compiler.CodeCompiler.FromSource(CompilerParameters options, String source) at System.CodeDom.Compiler.CodeCompiler.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSource(CompilerParameters options, String source) at System.Xml.Serialization.Compiler.Compile() at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings) at System.Xml.Serialization.XmlSerializer..ctor(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, Xm
-
Hallo CP's! Yesterday I've encountered a really strange problem and I hope someone here can help me out. I'm currently developing a small application, which manages birthdays and reminds the user a few days before a birthday. The birthdays are stored into a XML file by using XML serialization.
try
{
XmlRootAttribute xmlRoot = new XmlRootAttribute("BirthdayList");
xmlRoot.Namespace = "http://www.troschuetz.de";XmlSerializer serializer = new XmlSerializer(typeof(BirthdayList), xmlRoot); //<--------- serializer.Serialize(writeStream, this.birthdays);
}
The preceeding code snippet is called by the event handler for the Closing event of my main form. Everything worked fine during development, so I began using the application. As the program has a reminder function it's supossed to run from login until logoff of an user. But here is where the drama begins. When I normally exit the application everything works fine, but when the program has to exit due to an user logoff or a shutdown it crashes. The error is caused by the line marked in the above code snippet. This is what happens: 1. A dialog box pops up saying: "csc.exe Error in the application The application could not be initialized correctly." (Please note that this error message was translated from german) 2. After clicking the OK button the dialog box disappears and the following exception is thrown: Could not find file "C:\DOKUME~1\Arbeiten\LOKALE~1\Temp\ak6ctdg1.dll". System.IO.FileNotFoundException at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.CodeDom.Compiler.CodeCompiler.FromFileBatch(CompilerParameters options, String[] fileNames) at System.CodeDom.Compiler.CodeCompiler.FromSourceBatch(CompilerParameters options, String[] sources) at System.CodeDom.Compiler.CodeCompiler.FromSource(CompilerParameters options, String source) at System.CodeDom.Compiler.CodeCompiler.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSource(CompilerParameters options, String source) at System.Xml.Serialization.Compiler.Compile() at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings) at System.Xml.Serialization.XmlSerializer..ctor(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, Xm
Stefan Troschütz wrote: To makes things even more strange, the error only occurs when I run my application under an account without administrator privileges. Your user probably had read/write rights on his %TEMP% directory, but doesn't have execute rights. HTH. Yes, even I am blogging now!
-
Stefan Troschütz wrote: To makes things even more strange, the error only occurs when I run my application under an account without administrator privileges. Your user probably had read/write rights on his %TEMP% directory, but doesn't have execute rights. HTH. Yes, even I am blogging now!
He has all rights on this directory. In fact if he hasn't enough rights the whole thing wouldn't work when normally closing the application. I think the whole mess has something to do with the uncorrect initialization of the "csc.exe". But I don't know why this happens and how to prevent it?