Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delphi 10.3 IntrraWeb 15.2.36 failure within IWBaseForm
#1
Hello, 

I'm debugging an application that has an unhandled exception stemming from InternalInitInheritedComponent in IWBaseForm, I can see that it raises an exception within CreateComponent proc witihin System.Classes. Is there anything I can do on my end to circumvent, or could this be a bug?  I tried IW 15.2.50 but the problem persists. This issues was not noted in version 15.2.24, attached is the stack trace.


Attached Files Thumbnail(s)
   
Reply
#2
You will need to provide more info or a reproducible demo. The error occurs because some component on the page is giving an error when the VCL tries to create it.

What needs to be done to reproduce this? Look closely at the page that this occurs on and which components are on it.
Reply
#3
I suspect that there is some invalid property in your DFM file... Can you please share it?
Reply
#4
Hello, attached is a reproducible demo. In the demo, 2 forms are being created. One thing noticed was that the error no longer occurs when a grid component is not in the form. We noticed that when there are no grids in the form, the form will create without error. The error is found in both 15.2.36 and 15.2.50.


Attached Files
.zip   replicateerror30032022.zip (Size: 57.98 KB / Downloads: 2)
Reply
#5
Wait, this project is a VCL project, not a IW one.

You are creating IWForms from VCL Forms events??? Whatever you are trying to do, I'm sure this is not even slightly supported...

I suggest that you create a new application using IntraWeb Application Wizard (From File -> New -> Other -> IntraWeb -> IntraWeb Application Wizard) and add your forms to it.
Reply
#6
(04-04-2022, 01:41 AM)Alexandre Machado Wrote: Wait, this project is a VCL project, not a IW one.

You are creating IWForms from VCL Forms events??? Whatever you are trying to do, I'm sure this is not even slightly supported...

I suggest that you create a new application using IntraWeb Application Wizard (From File -> New -> Other -> IntraWeb -> IntraWeb Application Wizard) and add your forms to it.

We want to take the literals from all the forms in our main application and add them to a database. We were able to do it since before version 15.2.24, but between .24 and .36 just fine, but there was the addition of the InternalInitInheritedComponent & InternalReadComponentRes functions in IWBaseForm which I see to be causing the issue. Would that process still be possible to do within an Intraweb App?
Reply
#7
This is not what I said...

I asked for a sample application showing what you are experiencing. You gave me a project that I simply can't run because it is not a IntraWeb application.

If you created a mixed VCL + IW project, this is completely out of the scope here (and frankly I would never do that myself).

If you want me to have a look at your problem, I need an *IntraWeb* project which shows the problem that you are having.
Reply
#8
(04-12-2022, 10:48 PM)Alexandre Machado Wrote: This is not what I said...

I asked for a sample application showing what you are experiencing. You gave me a project that I simply can't run because it is not a IntraWeb application.

If you created a mixed VCL + IW project, this is completely out of the scope here (and frankly I would never do that myself).

If you want me to have a look at your problem, I need an *IntraWeb* project which shows the problem that you are having.

Attached is a sample IntraWeb application with the error occurring.


Attached Files
.zip   sampleapp.zip (Size: 400.75 KB / Downloads: 1)
Reply
#9
Thanks. I'll have a look
Reply
#10
I've tested your application. There are many reasons why it is failing but none is IntraWeb's fault. 

Seems that you deliberately wanted it to fail because your code is definitely wrong.

Let's start with the project file sampleapp.dpr. 

Code:
var
  sample : TIWForm1;
begin
//  Unit1.TIWForm1.SetAsMainForm;
  sample.FormActivate();
//  TIWStart.Execute(True);
end.

This is wrong. You just can't remove the IntraWeb application initialization code represented by

IWStart.Execute() method.

This call is not optional, so you can't just comment it out.


More:

you are calling 

sample.FormActivate();

But sample is obviously nil, this form instance hasn't been created and hasn't been assigned to sample variable. This will obviously raise an AV.

I'm not even considering that you are declaring a global var (sample) as TIWForm1. Global vars are a no-no in multithreaded applications, including IntraWeb. This kind of thing is a recipe for errors that will only happen when you have multiple users. In short: Don't use global vars.

Moving to your IWForm1:

Code:
  var
  frmVerifyCust: TfrmVerifyCust;
  frmP: TfrmPlanBalanceInqVerifyCust;
implementation
{$R *.dfm}
procedure TIWForm1.FormActivate;
  begin
    Run;
  end;

procedure TIWForm1.Run;
begin
        try
      frmVerifyCust:= TfrmVerifyCust.Create(Nil);
   finally
      frmVerifyCust.Free; {always free object}
   end;
//two forms that fail...

   try
      frmP:= TfrmPlanBalanceInqVerifyCust.Create(Nil);
   finally
      frmP.Free; {always free object}
   end;
end;

Again you are using global vars when creating instance of other forms. This is wrong. Use local vars or no var at all (you don't need a variable to create a form).

Also, IW forms must be owned by TIWApplication instance. You must create them as:

TfrmVerifyCust.Create(WebApplication);

WebApplication (TIWApplication object) contains better methods to create and show IWForms, for instance:

WebApplication.ShowForm(TIWForm1);'

And finally: 

Code:
procedure TIWForm1.FormActivate;
  begin
    Run;
  end;

You created a publish method FormActivate() but you are calling it without first creating the TIWForm1 instance (from the DPR file). This is wrong.

I don't know why you created such strange code... IntraWeb applications have many similarities with a normal VCL Forms application, but they are *very* different and the way you create and deal with IWForms is not the same as you create VCL Forms.

I strongly suggest that you pick one of our demos and start from it. 

This demo, although a little older, shows many important concepts:

https://github.com/Atozed/IntraWeb/tree/...i/Features
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)