Unclear exception captured
Hi,
The exception captured is mentioning the error on 1st line of the event below. If I remark 1st line of the event, it will further mention the other parts that is after such "if part". I do not know why the exception is making the issue unclear to capture.
ASP.NET
C#
-
Lan Huang-MSFT 25,556 Reputation points • Microsoft Vendor
2024-03-25T05:58:14.33+00:00 Hi @Peter_1985,
What is your current exception message?
Do you want detailed error information?
Maybe you can try using try-catch to capture detailed error information.
protected void save_Click(object sender, EventArgs e) { try { if (tb_curr_code.Text.Trim() == "") { } } catch (Exception ex) { throw ex.InnerException; } }
-
Peter_1985 2,506 Reputation points
2024-03-25T06:55:25.97+00:00 I put one extra try ... Catch but the issue is still same.
-
Lan Huang-MSFT 25,556 Reputation points • Microsoft Vendor
2024-03-25T07:19:34.3333333+00:00 Hi @Peter_1985,
Can you describe your error message?
-
Peter_1985 2,506 Reputation points
2024-03-25T07:24:22.8766667+00:00 I get the stack trace like
???._Default.save_click(Object sender, EventArgs e) in C:??? \Default.aspx.cs:line 677
No change to the issue, after I put one extra try ... Catch, that is pointing to the if line (code of my original thread).
-
AgaveJoe 26,201 Reputation points
2024-03-25T10:43:50.01+00:00 We cannot see or run your code. If you need the community to find the bug then we need enough code to reproduce this error. You have a lot of posts on these forums and should know how to create a proper question.
-
Peter_1985 2,506 Reputation points
2024-03-26T04:49:57.11+00:00 Any other reason to it?
-
Lan Huang-MSFT 25,556 Reputation points • Microsoft Vendor
2024-03-26T05:25:55.9133333+00:00 Hi @Peter_1985,
The error message you provided does not reveal the problem at all. Is this all the error message?
As AgaveJoe said, it is best if you can provide a minimal example that can reproduce the problem so that we can better help you.
-
Peter_1985 2,506 Reputation points
2024-03-26T06:53:02.5566667+00:00 Issue is on save_click event of the project.
-
Lan Huang-MSFT 25,556 Reputation points • Microsoft Vendor
2024-03-26T08:10:55.8033333+00:00 Hi @Peter_1985,
I tested your code but didn't reproduce your problem. Since there is no data information, I removed the database connection part and save_click works fine.
Maybe you can try removing Enabled="false" in the bt_save button and test it.
-
Peter_1985 2,506 Reputation points
2024-03-26T08:40:11.52+00:00 I removed Enabled="false" and re-deployed the project. But there was no improvement. You can use one testing record to get the issue if possible. Millions of thanks.
-
Lan Huang-MSFT 25,556 Reputation points • Microsoft Vendor
2024-03-27T06:46:42.6333333+00:00 Hi @Peter_1985,
If removing Enabled="false" still doesn't work, it probably has nothing to do with the data.
I suggest you check if other buttons work, or right-click the project and re-add a WebForm page, add buttons and see if you have the same problem.
-
Peter_1985 2,506 Reputation points
2024-03-27T06:58:30.09+00:00 Re-create the whole aspx page, do you mean this?
-
Lan Huang-MSFT 25,556 Reputation points • Microsoft Vendor
2024-03-27T07:10:06.7633333+00:00 Hi @Peter_1985,
Yes.
-
Peter_1985 2,506 Reputation points
2024-03-27T07:47:40.4066667+00:00 I created Default2.aspx but still get the same.
-
Peter_1985 2,506 Reputation points
2024-03-27T08:37:13.6766667+00:00 I added Default2.aspx but the issue persists.
-
Lan Huang-MSFT 25,556 Reputation points • Microsoft Vendor
2024-03-27T10:00:54.19+00:00 Hi @Peter_1985,
You don't understand what I mean. In the newly created page, you only need to add a test button, and there is no need to add all the code,like:
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
protected void Button1_Click(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('success');", true); }
-
AgaveJoe 26,201 Reputation points
2024-03-27T13:06:03.4066667+00:00 The symptom sounds like a syntax error in the code behind. I'm sure someone can find the problem if you share the actual code behind and ASPX markup. Lastly, are you working on a Web Site or a Web Application?
-
Peter_1985 2,506 Reputation points
2024-03-28T03:29:49.4233333+00:00 Thanks Lan. How to ensure the new page is called when the project is being run?
-
Lan Huang-MSFT 25,556 Reputation points • Microsoft Vendor
2024-03-28T06:11:55.15+00:00 Hi @Peter_1985,
You can change the url after running successfully.Change the circled part in the picture to new page name.
or Right-click directly on the newly created page, and then click where indicated in the picture.
-
Peter_1985 2,506 Reputation points
2024-03-28T07:26:18.02+00:00 Yes, the testing button is fine to work. How about the original issue?
-
Lan Huang-MSFT 25,556 Reputation points • Microsoft Vendor
2024-03-29T07:04:18.2866667+00:00 Hi @Peter_1985,
If the newly created page works, there is nothing wrong with your environment. I have tested that your original project can also run normally (as shown above).
I can't find your problem. My suggestion is that you can put the code from the original page onto the new page, but don't copy and paste it all at once. Copy and paste according to the function module.
-
Peter_1985 2,506 Reputation points
2024-04-02T08:26:44.77+00:00 Is there any other way to resolve it? Do you mean re-creating everything (item by item) of the whole web page, is the way to resolve the problem?
-
AgaveJoe 26,201 Reputation points
2024-04-02T10:15:40.2666667+00:00 Is there any other way to resolve it? Do you mean re-creating everything (item by item) of the whole web page, is the way to resolve the problem?
I'm guessing it is a compiler error. Maybe a missing a bracket or there's an extra bracket somewhere.
Keep in mind, you refuse to share the error or the code after being asked several times. If you are unable to find the syntax error by reviewing the code then adding one item at a time is a common troubleshooting approach.
-
Deleted
This comment has been deleted due to a violation of our Code of Conduct. The comment was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Sign in to comment