Type information for class 'test.cls' is not availab

Posted by ojfoggin on 22-Mar-2012 06:57

Hi All,

I've just installed Architect as a test (moving on from AppBuilder) and wanted to test out the ABL Forms.

I've created my project and everything seems to be working OK.  I can write, compile, open stuff in the AppBUilder perspective etc...

However, when I try to create and run an ABL form I get an error.

I've created a for called test.cls.  I haven't added any controls into it and I tried to run it but I get an error...

"Exception occurred during launch

Reason:

Type information for class 'text/cls' is not available."

When I click OK I'm back with the editor.

Can anyone shed any light on this please?

Thanks very much.

Oliver

(Architect 10.2B - Windows 7)

All Replies

Posted by Thomas Mercer-Hursh on 22-Mar-2012 11:21

Are you trying to run the class directly?  One still has to launch a .p that news the class.

Posted by ojfoggin on 22-Mar-2012 11:26

Thanks

Giving it a try now

Posted by egarcia on 22-Mar-2012 16:11

Hello,

When you select Run or Debug in OpenEdge Architect for a .cls file, OpenEdge Architect checks the type information associated with the class and generates a temporary program that can instance the class. (If the class has a public default constructor.)

The program looks like the ABL code below.

The error message that you getting indicates that OpenEdge Architect was able to find the r-code associated with the .cls file but failed to find the type information in the class cache.

Did you save the form before trying to run it?

I hope this helps.


=====================

USING System.Windows.Forms.Application FROM ASSEMBLY.

DEFINE VARIABLE rTemp AS CLASS TestForm1 NO-UNDO.

DO ON ERROR  UNDO, LEAVE

    ON ENDKEY UNDO, LEAVE

    ON STOP   UNDO, LEAVE

    ON QUIT   UNDO, LEAVE:

    rTemp = NEW TestForm1 ( ) .

    WAIT-FOR System.Windows.Forms.Application:Run ( rTemp ).

    DEFINE VARIABLE i AS INTEGER NO-UNDO.

    CATCH e1 AS Progress.Lang.AppError:

    DO i = 1 TO e1:NumMessages:

        MESSAGE e1:GetMessage(i) VIEW-AS ALERT-BOX BUTTONS OK TITLE "Error".

    END.

    IF e1:ReturnValue > "" THEN

        MESSAGE e1:ReturnValue VIEW-AS ALERT-BOX BUTTONS OK TITLE "Return Value".

    END CATCH.

    CATCH e2 AS Progress.Lang.Error:

        DO i = 1 TO e2:NumMessages:

            MESSAGE e2:GetMessage(i) VIEW-AS ALERT-BOX BUTTONS OK TITLE "Error".

        END.

    END CATCH.

END.

FINALLY.

IF VALID-OBJECT(rTemp) THEN DELETE OBJECT rTemp NO-ERROR.

END FINALLY.

Posted by Thomas Mercer-Hursh on 22-Mar-2012 16:41

Interesting ... what version did this get added, Edsel?   I'm not sure it is much help in general.  It certainly doesn't handle any constructor that requires an argument and would only do anything meaningful for a class which did all its work in the constructor ... which seems itself a dubious practice.

Why would the type information be missing, then?

Posted by Matt Baker on 22-Mar-2012 20:10

It certainly doesn't handle any constructor that requires an argument
and would only do anything meaningful for a class which did all its work
in the constructor ... which seems itself a dubious practice.

You are right.  It is simply a convenience for running forms; at least those that have a default constructor, which they all do out of the box.

Its been in place for several versions.  It was definitely in 10.2A when .Net forms were introduced but I'm thinking it was there in 10.1C when the run config support and the class browser was introduced.

In general if you're app is even slightly complex you will probably only have a few entry points that you run when launching your app, and of course those will be .p files.

Posted by Admin on 23-Mar-2012 03:16

It certainly doesn't handle any constructor that requires an argument and would only do anything meaningful for a class which did all its work in the constructor ... which seems itself a dubious practice.

Don't forget that some :-) classes build an UI in the constructor and then wait for the user to play the active role. That's the nature of event driven (UI) programming. You don't need do to all the work in the constructor - just prepare the ground for event handling. OpenEdge Architect will NEW the class with the basic constructor and execute the WAIT-FOR until the user closes the Form.

Posted by Peter Judge on 23-Mar-2012 08:02

It certainly doesn't handle any constructor that requires an argument and would only do anything meaningful for a class which did all its work in the constructor ... which seems itself a dubious practice.

The visual designer requires a no-argument public constructor that calls InitializeCompoent, so you have one always, allegedly dubious practice or otherwise.

And also don't forget that the 'real' app will require a .P to start anyway. Furthermore, there's likely to be some infrastructure around the app too, which may need starting prior to the UI starting. You don't (currently and no I have no idea whether that will change) get to cusomise the procedure the IDE uses to launch the form.

I prefer to always use a separate/custom .P to launch my UI: this way I get to test things in the application context, which can have significant differences to the environment in the IDE.

-- peter

Posted by egarcia on 23-Mar-2012 08:53

Hello Thomas,

The option to "run" a .cls file was available in 10.1C. In 10.2A, there were several enhancements to the Debugger: support for launch configurations, the option to expand object references and other variables in the Expressions view. The option to use a class file as a starting program was also added.

http://community.progress.com/technicalusers/w/openedgegeneral/1323.10-2a-openedge-getting-started-new-and-revised-features.aspx

As it has been mentioned, this option is a convenience. This is particularly useful for forms.

I think that being able to see the program (when debugging) makes it clear how the class is instantiated.

Why would the type information be missing, then?

This could be a timing thing.

The class is saved and the Run button is hit while the cache is being updated or refreshed (perhaps, by changing the scope of the class cache from Workspace to PROPATH).

The r-code would be found but the information in the class cache would not be available... 1 second later the type information would be available in the class cache. (There may be something in the Progress view regarding this.)

I do not think that you should generally see this. If this continues happening then it would help to bring this issue up to Customer Support.

I hope this helps.

Posted by Thomas Mercer-Hursh on 23-Mar-2012 11:33

There are those who would say Don't Do That!™ to building a UI inside a constructor.  This position is that the job of the constructor is to instantiate the class and do only such minimal instantiation as is required to have an instance of the class.  Any actual work should be done in one or other methods which can have appropriate names so that one has some idea of what work is being done by the method.  There is nothing about NEW which suggests that work is going to be done.

This thread is closed