Fatal Error after EPC Install

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Fatal Error after EPC Install

Post by jyoung »

Another issue after the EPC update.

I am getting a fatal error in my default command when it tries to execute.
fatal_error.PNG
fatal_error.PNG (21.32 KiB) Viewed 7472 times
First of all the line numbers make no sense. Here you are telling me the error occurred in CMGCCPSummaryCommand line 26.
command.PNG
command.PNG (26.09 KiB) Viewed 7472 times
The only "unique" thing I am doing here is that I do have an inheritance chain defined.
Basically its like this:
CMCCCPSummaryCommand extends CMGCommand extends VLFCommand

Each component has its own responsibility, for example VLFCommand listens for design changes and invoke the appropriate methods that are implemented down the chain as well as providing some convince methods for ALL commands in the system.

The error "Reported By" shows VLFCMDHLR which is the VLFCommand. Its line 26 shows the avFrameworkManager.

For some reason now, the avFrameworkManager is no longer being set even though it was before the EPC update.

Here is my VLFCommand for reference.

Code: Select all

function options(*DIRECT)
begin_com role(*EXTENDS #VF_AC010O) height(270) width(500) designmanager(#Design1)

define_com class(#PRIM_VS.Style) name(#Subtle) italic(True) fontsize(10) fontunits(Pixel) foregroundbrush(#Brush1)
define_com class(#PRIM_VS.SolidBrush) name(#Brush1) color(Silver)

define_com class(#PRIM_VS.Style) name(#Error) backgroundbrush(#Brush2) borderbottom(1) borderbrush(#Brush3) borderleft(1) borderright(1) bordertop(1) foregroundbrush(#Brush4)
define_com class(#PRIM_VS.SolidBrush) name(#Brush4) color(255:8:2)
define_com class(#PRIM_VS.SolidBrush) name(#Brush3) color(255:6:0)
define_com class(#PRIM_VS.SolidBrush) name(#Brush2) color(255:215:215)

define_com class(#PRIM_DESN) name(#Design1)
define_com class(#PRIM_DESN.Design) name(#Thin) designmanager(#Design1) width(500)
define_com class(#PRIM_DESN.Design) name(#Narrow) designmanager(#Design1) width(800)
define_com class(#PRIM_DESN.Design) name(#Wide) designmanager(#Design1) width(1100)

evtroutine handling(#COM_OWNER.DesignChanged) design(#design)

if (#design *Is *NULL)
* default to Wide
#avFrameworkManager.avRecordTraceAValue component(#COM_OWNER) event("Design Changed but is NULL")
#COM_SELF.DesignChangedToWide
return
endif

#avFrameworkManager.avRecordTraceAValue component(#COM_OWNER) event("Design Changed") avalue(#design.Name)

case of_field(#design.Name.UpperCase)
when (= THIN)
#COM_SELF.DesignChangedToThin
when (= NARROW)
#COM_SELF.DesignChangedToNarrow
when (= WIDE)
#COM_SELF.DesignChangedToWide
otherwise
#COM_SELF.DesignChangedToWide
endcase

endroutine

mthroutine name(DesignChangedToNarrow) access(*PROTECT)
* do nothing, should be redefined in child
endroutine

mthroutine name(DesignChangedToThin) access(*PROTECT)
* do nothing, should be redefined in child
endroutine

mthroutine name(DesignChangedToWide) access(*PROTECT)
* do nothing, should be redefined in child
endroutine

mthroutine name(HighlightProblems) desc('Highlight problems in all panel fields') help('Highlight a problem by adding NAME:MESSGAGE to the message queue. Panel fields will be search by NAME and error style and hint added if found')
define_map for(*INPUT) class(#PRIM_KCOL<#PRIM_EVP #STD_STRNG>) name(#fields) pass(*BY_REFERENCE)

define field(#control) type(*STRING)
define field(#errorMessage) type(*STRING)
define field(#separatorIndex) type(*INT)

#avFrameworkManager.avRecordTrace component(#COM_OWNER) event("Highlighting Problems")

#avFrameworkManager.avRecordTrace component(#COM_OWNER) event(("&1 Messages In Queue").Substitute( #SYS_MSGQ.Messages.ItemCount.AsString ))

for each(#message) in(#SYS_MSGQ.Messages)

if (#message.Text.Contains( ":" ))

#separatorIndex := #message.Text.LastPositionOf( ":" )
#control := #message.Text.Substring( 1 (#separatorIndex - 1) )
#errorMessage := #message.Text.Substring( (#separatorIndex + 1) #message.Text.CurChars )

if (#fields<#control> *IsNot *NULL)
#fields<#control>.Styles.Add( #Error )
#fields<#control>.Hint := #errorMessage
endif
else
* even though we don't have a seperator, we should still display the message
#avFrameworkManager.avIssueMessage text(#message.Text) requester(#COM_OWNER) tomainform(False) clearexistingmessages(False) type(W)
endif

endfor
endroutine

mthroutine name(HightlightProblem) desc('Highlight a single problem control') help('')
define_map for(*INPUT) class(#PRIM_EVP) name(#field) pass(*BY_REFERENCE)
define_map for(*INPUT) class(#STD_STRNG) name(#message)

#field.Styles.Add( #Error )
#field.Hint := #message

#avFrameworkManager.avIssueMessage requester(#COM_OWNER) text(#message) type(W)
endroutine


mthroutine name(ClearProblemHighlights) desc('Clear problem highlights in panel fields') help('Clear all problem highlights in panel fields by removing the hint and error style')
define_map for(*INPUT) class(#PRIM_KCOL<#PRIM_EVP #STD_STRNG>) name(#fields) pass(*BY_REFERENCE)

#avFrameworkManager.avRecordTrace component(#COM_OWNER) event("Clearing Problem Hightlights")

for each(#field) in(#fields)
#field.Styles.Remove( #Error )
#field.Hint := *BLANKS
endfor

#avFrameworkManager.avClearMessages requester(#COM_OWNER)
* this may be redundant
#SYS_MSGQ.ClearAll
endroutine

mthroutine name(ClearProblemHightlight)
define_map for(*INPUT) class(#PRIM_EVP) name(#field) pass(*BY_REFERENCE)

#field.Styles.Remove( #Error )
#field.Hint := *BLANKS
endroutine
end_com
Edit
I should mention that CMGCCPSummaryCommand is invoked from a custom instance list using the #DataItem.avExecuteDefaultCommand which is new I believe. See https://vlforum.lansa.com.au/viewtopic.php?f=3&t=1483.

Edit
My Filters work the same way. CMGCCPOfficeNumberFilter extends CMGFilter etc.They don't have this problem. They have access to the avFrameworkManager. This makes me think this may be an issue with the new #DataItem.avExecuteDefaultCommand.
MarkD
Posts: 692
Joined: Wed Dec 02, 2015 9:56 am

Re: Fatal Error after EPC Install

Post by MarkD »

If #avFrameworkManager is null then it means code is firing up in your ancestor chain before it gets set.

It might be that the new ExecuteDefaultCommand method has changed something so let's try reverting the code to use the old way with the new method names:

Code: Select all

* #DataItem.avExecuteDefaultCommand /* Temporarily remove potential source of problem */

#DataItem.avBusinessObjectReference.zInt_ExecuteDefaultCommand Atreferencelevel(1) Usebusypanel(#avListManager.RootVF_FR003Owner.CurrentVF_UM010O.BusyPanel) Withinstancereferencekey(#DataItem.avGetCompositeKeyString) Ignoreenablement(False)
MarkD
Posts: 692
Joined: Wed Dec 02, 2015 9:56 am

Re: Fatal Error after EPC Install

Post by MarkD »

I am guessing that reverting the code to the old default command execution will not correct this issue.
That means finding out what is happening may be more complex.
The code below is how a command handler gets instantiated (1). It has not been changed since the last release.
You can see at (2) that the framework manager (which is null for you) is the third property to be set after the command handler is instantiated.
It is also done before the uInitialize method gets run at (3).
The error you are getting seems to indicate that code is running in your command handler sometime before the uInitialize method has been executed (4).
Capture.PNG
Capture.PNG (91.99 KiB) Viewed 7451 times
MarkD
Posts: 692
Joined: Wed Dec 02, 2015 9:56 am

Re: Fatal Error after EPC Install

Post by MarkD »

So I think the first step would be to determine that your #COM_OWNER.DesignChanged event handler is executing before the uInitialize method is run by putting alerts into both routines.
MarkD
Posts: 692
Joined: Wed Dec 02, 2015 9:56 am

Re: Fatal Error after EPC Install

Post by MarkD »

See http://www.lansa.com/support/notes/epc/epc141030.htm item 0157434.
This looks to be when the DesignChanged event timing was changed, or even when it began even firing in your code.

I suspect that it is now firing at reusable part initialization - which happens before the command handler is fully initialized.

Can you try changing your DesignChanged event handler to start with ...

if (#avFrameworkManager *is *null) /* Ignore event fired before command handler fully initialized */
return
endif
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Fatal Error after EPC Install

Post by jyoung »

Ok, adding the *Is *NULL check worked.

You are right, the DesignChanged event is firing before uInitialize gets called.

So basically I was exploiting a bug that I was not aware of as my commands are "responsive" adjusting to the size of their window.

This did not affect my filters because they are not responsive, so they had the avFrameworkManager initialized by the time it was getting used.

I'm a little confused by item 0157434 because I've been using the design in this base command for a while now to get response commands.

As always thank you so much for your help.

Joe
Post Reply