Consultor Eletrônico



Kbase P157003: RaiseEvent statement in .NET User Control causes JIT error in ABL
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   19/04/2010
Status: Unverified

SYMPTOM(s):

RaiseEvent statement in .NET User Control causes JIT error in ABL

System.InvalidProgramException: JIT Compiler encountered an internal limitation.

.NET StackTrace:

--> at testnetcontrolTestNETControlButtonClickedReceiver.OnButtonClicked()
at testnetcontrol.TestNETControl.Button1_Click(Object sender, EventArgs e) in TestNETControl.vb:line 5
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)

Code for .NET User Control:

Public Class TestNETControl
Public Event ButtonClicked()

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
RaiseEvent ButtonClicked()
End Sub
End Class

FACT(s) (Environment):

User Control works as expected in Visual Studio
User Control Button1_Click event works as expected once the RaiseEvent statement has been removed
OpenEdge 10.2A
OpenEdge 10.2B
Windows

CAUSE:

The ABL does not support .NET events that do not have the two standard parameters:

ByVal sender As Object, ByVal e As System.EventArgs

When we subscribe to the event in the ABL, we have to emit a real subscriber in .NET for the control to call, which then calls back to the ABL. We generate this with the 2 standard parameters.

FIX:

Define events in the .NET user control so that they have the sender object and event arguments parameters. Instead of:

Public Event ButtonClicked()

Use:

Public Event ButtonClicked(ByVal sender As Object, ByVal e As System.EventArgs)