Debugging and managing exceptions after protection
Shield offers the necessary solutions for you to use and manipulate a protected application just like the original one.
To give some context, this section of the documentation aims to answer the following questions:
- I have protected my application, but when it reports an exception everything is encrypted and I have no way of knowing where the error comes from.
- After protecting my application with Shield, no attacker can debug it, but... How do I debug my own protected application?
- I am using a service to manage and report the exceptions of my application, but it only receives obfuscated code.
- I have a .pdb file of my original application, but it does not work with the one protected with Shield.
If the renaming protection is not used, none of this is necessary, since the .PDB and application names will remain original.
Resolving exceptions from a protected application
For detailed information on resolving exceptions and decoding stack traces from protected applications, see Exception Decoding and Stack Trace Resolution. Here you'll find how to decode obfuscated stack traces and manage exception messages in protected apps.
Finding the ProtectionSecret
The ProtectionSecret
is now set by you in the Shield configuration file (see the configuration documentation for details). This secret is used to enable advanced debugging and exception decoding features.
- Set the ProtectionSecret in your configuration: Add the
ProtectionSecret
property to your Shield configuration file. - If you do not set a secret: You can obtain the secret for your protected application directly from the ByteHide web panel.
Debugging a Shield-protected application
If you want to debug your application (which may contain anti-debugger protections), follow these steps:
Obtaining the magic file
To learn how to obtain the magic file required for debugging and exception decoding, see Obtaining the Magic File.
Debugging your application
With the previously exported magic file, follow these steps:
- Place the bytehide.shield.magic file next to the folder (same directory) where your protected application is running.
- You will automatically be able to debug your application from Visual Studio or another debugging software.
Do not share your ProtectionSecret
or bytehide.shield.magic file with anyone, keep it in a safe place, and do not publish or deploy your application along with this file.
.PDB files
If you provide the original .pdb file when protecting your application, the .pdb file generated by Shield will be automatically exported to the directory where your protected application is saved or included in the web panel download.
For more information on PDB file handling and best practices, see PDB File Protection.