473,508 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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


Expand|Select|Wrap|Line Numbers
  1. .Message: "The operation was canceled."
  2.  

Expand|Select|Wrap|Line Numbers
  1.                try
  2.                   {
  3.                       FileIOPermission perm = new FileIOPermission(FileIOPermissionAccess.Write, file_name);
  4.                       perm.Assert();
  5.                       if (!additive && File.Exists(file_name)) File.Delete(file_name);
  6.                       using(FileStream fs = new FileStream(file_name, FileMode.OpenOrCreate, FileAccess.ReadWrite))
  7.                       {
  8.                           using(StreamWriter writer = new StreamWriter(fs))
  9.                           {
  10.                               writer.BaseStream.Seek(0, SeekOrigin.End); 
  11.                               writer.Write(content); 
  12.                               writer.Flush(); 
  13.                               writer.Close();
  14.  
  15.                               result = true;
  16.                           }
  17.                           fs.Close();
  18.                       }
  19.                       CodeAccessPermission.RevertAssert();
  20.                   }
  21.                   catch (System.Exception err)
  22.                   {
  23.                       System.Diagnostics.Debug.WriteLine(err.Message);
  24.                       throw(err);
  25.                   }
  26.  
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?

Thanks,
Michal
Jul 31 '08 #1
2 2783
kenobewan
4,871 Recognized Expert Specialist
So this error has only happened once. Could it be a file permissions error?
Jul 31 '08 #2
strakamichal
3 New Member
Yes, it happened once. But I'am not sure with permissions error. I try to write to readonly file or disconnect virual hardisk during writing, but error message is different.
Aug 1 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1798
by: RWC | last post by:
Hi, I'm running into a problem with Access XP (SP2) that's driving me up the wall. It's Error 2001 "You canceled the previous operation". There is no voodoo going on really when I get this...
2
14926
by: Ronny Sigo | last post by:
Hello all, I already put the same question, only now I have more to tell ... Although I used this code before in the same routine (only the fieldname of the table differs) ___ at this point in the...
0
358
by: Tamar | last post by:
Hello all, I am so frustrated. I am doing something so simple and yet I confront such a problem. I am writing a program in VB, opening a db connection to an access db using ADODC control. I...
1
3194
by: John A. | last post by:
This is a database in use on Terminal server, been reliable, no corruption problems. (so far) Designing a form, asked to save objects, Access put up a dialog box for the current form asking me...
20
2842
by: Jason Dravet | last post by:
Some time ago I wrote an application that controls the projectors in our classrooms(turn on, turn off, and volume control). This application is written in VB.net 2003. It was working perfectly...
3
9513
by: subha | last post by:
I have a HelloWorld webservice that works on my IE browser. But, when I add a webreference to it and call the HelloWorld method from my WindowsFormsApp (return in C#), I get error messages. The...
0
1053
by: Chubbly Geezer | last post by:
I am in the process of converting an app from VB 2003 to VB 2005. This conversion works fine, but I now wish to swap from an EXE run app to a published app on our network. I am however getting...
2
2054
by: akameswaran | last post by:
Admittedly this problem causes no actual functional issues aside from an occasional error message when the program exits. The error is: Unhandled exception in thread started by Error in...
1
2723
by: strakamichal | last post by:
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: "The operation was canceled." try {...
0
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.