Article

Error (392) when accessing a shared variable from a class.

Information

 
Article Number000088721
EnvironmentProduct: OpenEdge
Version: 11.x
OS: Windows
Other:
Question/Problem Description
A .NET application creates a shared variable in a procedure that instantiates a modal form and in a procedure that instantiates a non-modal form. When the modal form is executed the shared variable is successfully accessed. When the non-modal for is executed, accessing of the shared variable fails with the following error message:

<program> Shared variable <variable> has not yet been created. (392)
 
Steps to Reproduce
Clarifying Information
The modal form is waiting on a wait-for.
The non-modal form immediately returns.
Error Message<program> Shared variable <variable> has not yet been created. (392)
Defect/Enhancement Number
Cause
This is expected behavior.

In the case of the non-modal form, the form is displayed using the show method of the form.
In the case of the modal form, the form is displayed with a wait-for and the ShowDialog method.
In the case of the show method, the method immediately returns, causing a race condition and the shared variable going out of scope.
In the case of the ShowDialog method, the wait-for causes the variable to stay in scope.
Resolution
Workaround
Move the DEFINE NEW SHARED VARIABLE <var_name> AS <TYPE> higher in the call stack so that the shared variable does not go out of scope.
Notes
References to other Documentation:
https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvref/define-variable-statement.html 

Progress article(s):
000016557, Error 392 referencing shared variable
000078055, How to determine if a shared variable has been defined NEW?

The attached .zip file (repro_projects.zip) contains two zip files as follows:
TestSharedVars.zip contains the failing project. Unzip it and run start.p. Push each button and see one succeed and one fail as described above.
TestSharedVarsFixed.zip contains the same projected but fixed as described above. Unzip it and run start.p. Both buttons execute successfully.
Last Modified Date4/30/2018 7:45 PM
Disclaimer

The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.



Feedback
 
Was this article helpful?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025