Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Strange problem

Strange problem

Scheduled Pinned Locked Moved C#
helpxmljson
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stefan Troschuetz
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • S Stefan Troschuetz

      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

      D Offline
      D Offline
      Daniel Turini
      wrote on last edited by
      #2

      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!

      S 1 Reply Last reply
      0
      • D Daniel Turini

        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!

        S Offline
        S Offline
        Stefan Troschuetz
        wrote on last edited by
        #3

        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?


        www.troschuetz.de

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups