Search code examples
azurevisual-studio-debuggingazure-worker-rolesdebug-symbols

How can I make sure my Azure worker role is run in Release (and not Debug) configuration?


I am suspecting my Azure worker role is deployed as Debug and not Release.

If I Trace log exceptions in the Azure production environment, the Exception Message contains the actual line of code and the path on my local hard drive, just as if it was run in Debug.

However, my .azurePubXml file (and the corresponding display in Visual Studio upon deployment) has the line <AzureSolutionConfiguration>Release</AzureSolutionConfiguration>.

What can be the problem here? Can a Release configuration contain the debug information I am seeing? For performance reason, I'd like the code to be deployed in its Release configuration.


Solution

  • By default, with a Release assembly, you will still get the file and line number where the exception was unhandled. If you are seeing the full stack trace, you either have a Debug build or a customized Release build.

    To check what configuration your bits were deployed as, you could put some code in your app's startup that would only run on a debug build (e.g. Debug.Trace or some logging inside of a #if DEBUG block)