# Cannot Instantiate New Instance of A Web Page

**URL:** <https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580>\
**Category:** Web\
**Created:** [December 19, 2023, 5:00pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580 "2023-12-19T17:00:07Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hanif\_Saad](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@Hanif\_Saad](https://forum.xojo.com/u/Hanif_Saad)\
**Post date:** [December 19, 2023, 5:00pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/1 "2023-12-19T17:00:07Z")

</div>

I am experiencing a very weird problem  
There are certain web pages in my application that i cannot instantiate.  
The compiler doesn’t flag any errors.  
The program just stuck at the instruction and would never move to the next line.

The line is as below:

` Session.thisMainPage = new wpMainPage`

Xojo would stuck at that line and wont move to the next instruction.  
If i replace any other page, it would work ok.  
But i dont see any error and my debugger wont go into the web page

Can anybody point to any kind of mistake?  
This actually has happened even in XOJO 2023 R3

TIA

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [December 19, 2023, 5:15pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/2 "2023-12-19T17:15:42Z")

</div>

Do you have something in the WepPage.Opening event that could be hanging or creating a circular stack? Xojo is supposed to catch `StackOverflowException` but that would be my first guess.

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [December 19, 2023, 6:00pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/3 "2023-12-19T18:00:13Z")

</div>

If you can create a sample project with this problem, you can open an [Issue](https://xojo.com/issues) with that for Xojo to review.

---

<div class="post-metadata">

**Author:** ![Hanif\_Saad](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@Hanif\_Saad](https://forum.xojo.com/u/Hanif_Saad)\
**Post date:** [December 20, 2023, 12:31am UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/4 "2023-12-20T00:31:14Z")

</div>

I have emptied the weppage.opening event ( and all other events )  
Still this happens.

The project was earlier written in R3 and it works in R3.1.  
The latest version of R3.1 , when loaded into R4 , wont run and stuck at the said page.

---

<div class="post-metadata">

**Author:** ![Hanif\_Saad](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@Hanif\_Saad](https://forum.xojo.com/u/Hanif_Saad)\
**Post date:** [December 20, 2023, 1:52am UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/6 "2023-12-20T01:52:57Z")

</div>

I change this to non-implicit instance and it also gave the same result.  
The instruction is stuck there. No error. No flag by the compiler.

 ![image](https://forum.xojo.com/uploads/default/original/3X/2/3/230aa79de244cd1870580b8eca820d1361cb21d6.png)

Works in R2.  
Wont work in R3  
Wont work in R4

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [December 20, 2023, 1:53am UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/7 "2023-12-20T01:53:23Z")

</div>

Make sure you have Implicit Instance **unchecked** for the page.

---

<div class="post-metadata">

**Author:** ![Hanif\_Saad](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@Hanif\_Saad](https://forum.xojo.com/u/Hanif_Saad)\
**Post date:** [December 20, 2023, 1:56am UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/8 "2023-12-20T01:56:41Z")

</div>

i did greg

---

<div class="post-metadata">

**Author:** ![Hanif\_Saad](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@Hanif\_Saad](https://forum.xojo.com/u/Hanif_Saad)\
**Post date:** [December 20, 2023, 1:58am UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/9 "2023-12-20T01:58:23Z")

</div>

Just out of curiosity, i compiled it and run it from a real app. After 5 minutes it does move to the next screen. In R2 it does it instantenously

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [December 20, 2023, 2:33pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/10 "2023-12-20T14:33:51Z")

</div>

Well if nothing in your code changed from R2 to R3/R4 you could [submit a ticket](https://xojo.com/issues) and attach your project privately for Xojo to review. Anything we can offer here without a project to work with is going to be a guess.

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [December 20, 2023, 2:49pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/11 "2023-12-20T14:49:37Z")

</div>

![image](https://forum.xojo.com/uploads/default/original/3X/5/3/535d9d4de3181de2329a16ca53a23e1442583ec8.png)

You are doing a lot of (possibly unnecessary) work here, and I wonder if one of these lines is causing the issue:

Please try removing the calls to

```auto
.visible = true
.show
.visible = true
.updateBrowser

```

and see if any of those fix the problem?

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [December 20, 2023, 2:57pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/12 "2023-12-20T14:57:59Z")

</div>

For example, in my Web app, the login sequence is much simpler:

```auto
WebPage wLoginWindow
sub DoSuccessfulLogin()
    // this function is called when the user has successfully logged in with a valid username/password:
    wMainWindow.show // open the new window
    self.close // close the login screen
end sub

```

---

<div class="post-metadata">

**Author:** ![Hanif\_Saad](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@Hanif\_Saad](https://forum.xojo.com/u/Hanif_Saad)\
**Post date:** [December 20, 2023, 4:05pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/13 "2023-12-20T16:05:39Z")

</div>

Thanks Tim. I ll prepare this later

---

<div class="post-metadata">

**Author:** ![Hanif\_Saad](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@Hanif\_Saad](https://forum.xojo.com/u/Hanif_Saad)\
**Post date:** [December 20, 2023, 4:12pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/14 "2023-12-20T16:12:57Z")

</div>

I did all that in desperation to see how that can be resolved. Trust me its not that messy previously.

In the end, what i found out:

1. The same program that run well in 2023 R2 ( from login in landing page to main page instantly )
2. Will take a few minutes ( in compiled mode ) to move from login in landing page to the main page.  
It will take a lot longer in debug mode and stuck for a few minutes at instancing the main page (wpMainPage).

I ll prepare and submit ticket to issues later as this program is quite large and have a number of resources.

Thank you everyone for your assistance.

---

<div class="post-metadata">

**Author:** ![Hanif\_Saad](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@Hanif\_Saad](https://forum.xojo.com/u/Hanif_Saad)\
**Post date:** [December 27, 2023, 3:25am UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/15 "2023-12-27T03:25:42Z")

</div>

New development about this problem.

even instantiating plain dialog box now takes 10 minutes in this module.

Initially i thought it was because my main page has many items.  
now instantiating just simple dialog page from the landing page will take 10 minutes.

Previously

1. LandingPage : in login successful show main page. Takes 10 minutes to show.

Now,

1. LandingPage : while processing login ( while waiting for the 10 minutes to complete ),  
tried to show a simple dialog window like this  
 ![image](https://forum.xojo.com/uploads/default/original/3X/f/e/feff87168739c2491d64860c4792b29fa8d5d39b.png)

the code will stuck at instancing the new dialog for about 10 minutes as well.

 ![image](https://forum.xojo.com/uploads/default/original/3X/1/d/1dc2e3a0a169c503378882154bb68190dcfe635f.png)

It doesn’t happen in other pages.  
Just in this landing page.

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [December 27, 2023, 3:41pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/16 "2023-12-27T15:41:00Z")

</div>

Instead of doing `new WebDialog` how about just dragging an instance of the custom WebDialog to the WebPage and then just call `WebDialog1.Show` – it should be functionally equivalent, and if it works it may help you narrow down the bug.

If you can figure out a small test case, please submit a [https://tracker.xojo.com/xojoinc/xojo/-/issues](https://tracker.xojo.com/xojoinc/xojo/-/issues) ticket

---

<div class="post-metadata">

**Author:** ![Hanif\_Saad](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@Hanif\_Saad](https://forum.xojo.com/u/Hanif_Saad)\
**Post date:** [December 27, 2023, 4:04pm UTC](https://forum.xojo.com/t/cannot-instantiate-new-instance-of-a-web-page/78580/17 "2023-12-27T16:04:56Z")

</div>

Thanks Mike.

I resorted to recreating a new landing page altogether.  
I suspect it might have something to do with moving this page from the previous version.  
So far everything now works acceptable ( still slow, but not as slow as before ).

I will try your proposed solution later.
