13

I have an excel addin that works fine in debug and release mode when I build / run from VS2010. However, when I deploy it using a windows installer it doesn't operate properly.

I'm not sure what the problem is or even if "debugging" the release code will help.

Any tips on how I might find what the problem is?

EDIT

What I mean by "doesn't operate properly" is that when i hit buttons etc nothing happens and it just hangs.

Thanks

Pat Mustard
  • 1,852
  • 9
  • 31
  • 58
  • 2
    Try to be more specific: in what way it doesn't operate properly? – vgru Oct 11 '13 at 07:48
  • May be some of the dependency in missing in your installer.. – jiten Oct 11 '13 at 07:48
  • What I do when releasing a C# application is create a logger, when an error occurs it writes the errors to a text file, so say you stick some try - catches in your program; if you catch an error, it will log it to the textbox. –  Oct 11 '13 at 07:50
  • It could alse be some settings that is not correct, e.g. connection strings to databases – Casperah Oct 11 '13 at 08:00

3 Answers3

28

In higher version of Visual Studio, debug release build enabled, when I uncheck "enable just my code" in following menu "tools -> options-> debugging -> general"

fat
  • 6,435
  • 5
  • 44
  • 70
s.c
  • 768
  • 6
  • 15
8

you also need to ensure the Optimize code is unchecked enter image description here

Moustafa Khalil
  • 116
  • 1
  • 3
  • Thanks a lot. Visual Studio 2019 has both checked off in release by default in all csproj files. I've found "allow own code" but somehow this one slipped. – Florian Straub Dec 11 '20 at 15:42
0

Given you have configured your release build to emit debug symbols then yes you should be able to simply attach a debugger to the process and step through it.

James
  • 80,725
  • 18
  • 167
  • 237
  • When I try to attache to process I get an error telling me that the module was bult either iwth optimizations enabled or without debug info. Is it possible to build debug into into a release build? – Pat Mustard Oct 11 '13 at 08:15
  • Also, it seems to hang whenever I reference Properties.Settings – Pat Mustard Oct 11 '13 at 08:17
  • 1
    @PatMustard again, yes but you have to make sure you have debug information - Project Properties > Build > Advanced > Debug Info = full. Hanging could be a result of many issues...most probably you have an infinite loop somewhere. – James Oct 11 '13 at 08:19
  • Thanks, James. In my solution, I have three dlls, the add-in, an rtdserver and a shared one. All of these have debugging info = full but I still get the error about debug info from VS when I go tools -> attach to process. Am I forgetting something? – Pat Mustard Oct 11 '13 at 08:35
  • It it really a 'release' build if you're emitting debug symbols and not optimizing it? Just because you call the configuration 'release' doesn't mean it is. – Triynko May 19 '21 at 16:38
  • https://devblogs.microsoft.com/devops/debugging-optimized-code/ – Triynko May 19 '21 at 19:53
  • https://learn.microsoft.com/en-us/visualstudio/debugger/how-to-debug-optimized-code?view=vs-2019 – Triynko May 19 '21 at 19:54