Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4565724
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:41:04+00:00 2026-05-21T18:41:04+00:00

I use a standard error handling routine in my methods that looks like the

  • 0

I use a standard error handling routine in my methods that looks like the following:

Try
    Cursor.Current = Cursors.WaitCursor



    Cursor.Current = Cursors.Default
Catch ex As Exception
    MyAssembly.SystemError(MethodBase.GetCurrentMethod().Name, ex.Message, MsgBoxStyle.Exclamation)
End Try

The MyAssembly.SystemError function logs the error to file and show a message box.

This works fine until I run my code through obfuscation because it renames the method name to some unintelligible chars (as it should do) so the reflected method name returned by MethodBase.GetCurrentMethod().Name is similarly unintelligible.

I have started replacing the MethodBase.GetCurrentMethod().Name with the name of the method but then if I rename the method I can (and do) forget to change the error handling name.

Does anyone have any good ideas to work with all of this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T18:41:05+00:00Added an answer on May 21, 2026 at 6:41 pm

    This is unfortunately one of the pitfalls of obfuscation, with no real workaround (the whole point of obfuscation is to hide and obfuscate the very information that you are attempting to show here).

    From a usability perspective you should be constructing error messages from meaningful wherever possible anyway, such as “The file {0} could not be found”. If you obfuscate your code then you definitely can’t rely on method names (or other reflected information) to construct your error messages.

    BTW, embedding the method name as a string in your method this way is essentially undoing the work of the obfuscator anyway. My advice would be:

    1. Firstly Change your error handling to predict what error scenarios might happen (such as file IO or DB access failing) and handle it in a sensible way on a per-situation basis, which should prevent the need from using method names in error messages.
    2. Failing that, if you genuinely rely on this information in your application then just don’t obfuscate (I’ve never really been in favor of obfuscation anyway).

    Finally, the sort of error handling that you are doing should probably be done in the ThreadException event anyway, but that’s another topic entirely! 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just noticed that you can not use standard math operators on an enum
If for example I should not use standard library functions like printf() , putchar()
I would like to override the use of the standard app.config by passing a
I would like to use a custom version of the standard disclosure accessory image
Most code I have ever read uses a int for standard error handling (return
We're planning to use standard ASP.NET user authentication for our application. However, by default
For those of us who use standard shared hosting packages, such as GoDaddy or
You can use a standard dot notation or a method call in Objective-C to
How can I use the standard Edit menu in my Palm OS application, instead
I used to use the standard mysql_connect(), mysql_query(), etc statements for doing MySQL stuff

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.