3 回答

TA貢獻1848條經驗 獲得超10個贊
我看到的最常見的錯誤和“池崩潰”是循環調用。
public string sMyText
{
get {return sMyText;}
set {sMyText = value;}
}
只需調用sMyText ...

TA貢獻1828條經驗 獲得超3個贊
為了做到這一點,您需要做的就是從請求的上下文外部拋出任何異常(當然不處理它)。
例如,在另一個線程上引發的某些異常應該做到這一點:
protected void Page_Load(object sender, EventArgs e)
{
// Create a thread to throw an exception
var thread = new Thread(() => { throw new ArgumentException(); });
// Start the thread to throw the exception
thread.Start();
// Wait a short while to give the thread time to start and throw
Thread.Sleep(50);
}
可以在MS知識庫中找到更多信息。

TA貢獻1817條經驗 獲得超6個贊
亞里士多德的回答是好的。當有人在不更改基調用的情況下將重寫方法從OnInit更改為OnLoad時,也曾在頁面生命周期中使用愚蠢的重寫來完成此操作,因此它在整個生命周期中都會循環出現:即
protected override void OnLoad(EventArgs e)
{
//some other most likely rubbish code
base.OnInit(e);
}
- 3 回答
- 0 關注
- 506 瀏覽
添加回答
舉報