Sunday, August 29, 2010

C# - Object is currently in use elsewhere

Why can't Microsoft give better description of the exception??

For this message, System.InvalidOperationException: Object is currently in use elsewhere.

Does this message make sense to you by itself? Which object? Where?

When you see this message during Graphics operations, the object may be referring to the Pen or Brush which you are using for drawing. It seems that Graphics operation is not thread safe. The same pen or brush cannot be use when different threads are rendering on different Graphics. Simply, pen and brush cannot be shared across multiple treads.

No comments:

Post a Comment

Tomcat - removing server info

Below are the steps to remove Tomcat Server Information 1. Make sure Tomcat is not running 2. Navigate to "Tomcat Installation"...