Hi
this code gives System.StackOverflow.Exception at the bold line. Can anyone explain me how come?
Thanks
V
using System;
namespace test
{
public partial class WebForm1 : System.Web.UI.Page
{
public Test ts = new Test();
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "ok";
}
}
public class Test : WebForm1
{
string x;
}
}
aspx file:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="test.WebForm1" %>
....

Sachin SinghRank #66 · 26.2K reputationPosted Jan 1, 2023, 2:54 AM EST
Absolutely correct you are, it is indeed an infinite loop.
Valerie MeunierRank #1,527 · 1K reputationPosted Dec 31, 2022, 9:49 AM EST
I think i found the reason and that is the inheritance public class Test : WebForm1 which causes a infinite loop.