CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Jul 2008
    Posts
    1

    C# - APP: Exception: The operation was canceled.

    Hi all,
    i need help with one exception. I know only .Message of this exception and i know which part of code throws it.


    Message:
    .Message: "The operation was canceled."




    Code:
    Code:
    try
                            {
                                FileIOPermission perm = new FileIOPermission(FileIOPermissionAccess.Write, file_name);
                                perm.Assert();
                                if (!additive && File.Exists(file_name)) File.Delete(file_name);
                                using(FileStream fs = new FileStream(file_name, FileMode.OpenOrCreate, FileAccess.ReadWrite))
                                {
                                    using(StreamWriter writer = new StreamWriter(fs))
                                    {
                                        writer.BaseStream.Seek(0, SeekOrigin.End);
                                        writer.Write(content);
                                        writer.Flush();
                                        writer.Close();
           
                                        result = true;
                                    }
                                    fs.Close();
                                }
                                CodeAccessPermission.RevertAssert();
                            }
                            catch (System.Exception err)
                            {
                                System.Diagnostics.Debug.WriteLine(err.Message);
                                throw(err);
                            }
    FYI: This Windows application runs for many years, but once this error was occured and stored in log. Can somebody help me? Is anythere List of exception messages, where I can find what does the exception mean?
    Last edited by cjard; July 31st, 2008 at 12:03 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured