473,383 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

InvalidOperationOperationException problem

I've posted a related question in this newsgroup before, see google
groups link:

http://groups.google.nl/group/micros...8051941dd4e2c4

We still experience the problem ever since we migrated from .NET 1.1
to 2.0. Some of the causes (amongst others bad code in destructors)
have been removed, drastically reducing the number of appearances of
of the dreaded 'InvalidOperationException' right after closing the
application.

However, our testers sometimes get an InvalidOperationException
without clear trace (it occurred in 'System.Windows.Forms', pffff)
when they have just closed the application.

My question then is, can you guys help me compile a list of possible
sources for the above kind of problem? To start of with the ones we
already caught:
- Starting new screens/dialogs/forms in destructors;
- Incorrectly disposing a WebBrowser control
- Meddling with the parent of a form
- ....?
Any suggestions would be appreciated

Aug 8 '07 #1
3 1083
Jeroen,

Looking at your old post, you should not have to do anything in your
Dispose method if all you are doing is disposing of the WebBrowser control.
When the form closes, a close message is sent to all the controls that are
hosted in the form, and disposed of. The overriding of the Dispose method
isn't needed, unless you need to do something else.

The reason you were getting InvalidOperationExceptions in your
finalizers is because you were trying to perform UI operations from the
finalizer. The UI operations have to be performed on the thread that
created the control, and the finalizer runs on its own thread.

Are you doing any other funky things in the finalizer we should know
about?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeroen" <me******@gmail.comwrote in message
news:11**********************@l70g2000hse.googlegr oups.com...
I've posted a related question in this newsgroup before, see google
groups link:

http://groups.google.nl/group/micros...8051941dd4e2c4

We still experience the problem ever since we migrated from .NET 1.1
to 2.0. Some of the causes (amongst others bad code in destructors)
have been removed, drastically reducing the number of appearances of
of the dreaded 'InvalidOperationException' right after closing the
application.

However, our testers sometimes get an InvalidOperationException
without clear trace (it occurred in 'System.Windows.Forms', pffff)
when they have just closed the application.

My question then is, can you guys help me compile a list of possible
sources for the above kind of problem? To start of with the ones we
already caught:
- Starting new screens/dialogs/forms in destructors;
- Incorrectly disposing a WebBrowser control
- Meddling with the parent of a form
- ....?
Any suggestions would be appreciated
Aug 8 '07 #2
Hi Jeroen,
- Starting new screens/dialogs/forms in destructors;
- Incorrectly disposing a WebBrowser control
- Meddling with the parent of a form
I am interested in what you mean by "Meddling with the parent of a form". Could you elaborate on this or send a link with more information? I had similar problems in the past and never found out what my problem was.

Thanks a lot and best wishes,

Marc.
Aug 9 '07 #3
Are you doing any other funky things in the finalizer we
should know about?
We had code that showed a messagebox with an exception message, as
executed from the ~ method. Removal of that code reduced the number of
InvalidOperationException appearances. Nothing further there though.

I am interested in what you mean by "Meddling with the parent
of a form". Could you elaborate on this or send a link with more
information? I had similar problems in the past and never found
out what my problem was.
In our case we had a static variable reffering to a dialog form. A
static method could be called anywhere from the application to show
the dialog, passing (if applicable) a form reference that would act as
a parent to the dialog form. To achieve some specific GUI behavior we
set the dialog 'Owner' property to the passed form ("meddling with the
owner"), which sometimes led to InvalidOperationExceptions.

Aug 9 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
0
by: Refky Wahib | last post by:
Hi I need Technical Support I finished a Great project using .Net and SQL Server and .Net Mobile Control My Business case is to implement this Program to accept about 1 Million concurrent...
9
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.