Kbase P174278: Calling THIS-OBJECT:Close() from with .NET Form constructor causes System.ObjectDisposedException
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  01/10/2010 |
|
Status: Unverified
SYMPTOM(s):
Calling THIS-OBJECT:Close() from with .NET Form constructor causes System.ObjectDisposedException
.NET Form constructor does a security check to see if user is authorized
When authorization fails form is closed by calling THIS-OBJECT:Close()
After THIS-OBJECT:Close() is invoked an exception is generated
System.ObjectDisposedException: Cannot access a disposed object.
FACT(s) (Environment):
Windows
OpenEdge 10.2x
CAUSE:
Calling Close() from within the constructor is destroying the object while it is in the middle of being created. This will always cause an exception.
FIX:
Replace THIS-OBJECT:Close() with a RETURN ERROR statement. The RETURN ERROR will cause the constructor to fail properly and everything will be cleaned up normally.