Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the common language runtime was unable to set the breakpoint

This is actually another part of this question.

Error settings breakpoints but only on some lines while debugging

I'm remote debugging a CRM 2011 plugin in vs 2010.

I'n one of my source files I can set breakpoint all throughout the code except in a few places.

When I try to set a breakpoint I get this error "The following breakpoint cannot be set:" and "The Common Language Runtime was unable to set the breakpoint."

protected override void ExecutePlugin() {     SetStateResponse response = new SetStateResponse(); // Breakpoint works      // Message switch     switch (_crmMessage) // Breakpoint error     {         case CrmPluginMessageEnum.Create:          Entity pimage = null; // Breakpoint error         if (_context.PostEntityImages.ContainsKey("postcreate")) // Breakpoint works             pimage = _context.PostEntityImages["postcreate"]; // Breakpoint error          break; // Breakpoint error         } } // Breakpoint error 

UPDATE Also, in the modules window it shows the dll as Optimized: No User Code: Yes Symbol Status: Symbols Loaded

like image 900
user1231231412 Avatar asked Dec 20 '11 19:12

user1231231412


People also ask

How do you set a breakpoint in C++?

To set a data breakpoint: In a C++ project, start debugging, and wait until a breakpoint is reached. On the Debug menu, choose New Breakpoint > Data Breakpoint.

How do you create a breakpoint in Prolog?

SWI-Prolog support breakpoints. Breakpoints can be manipulated with the library library(prolog_breakpoints) . Setting a breakpoint replaces a virtual machine instruction with the D_BREAK instruction. If the virtual machine executes a D_BREAK , it performs a callback to decide on the action to perform.


2 Answers

Two possibilities, already kind of referenced by the other answers:

  1. Make sure you are using the Debug build of the assembly instead of the Release build, because the Release build will remove or optimize your code.
  2. Make sure you are updating the version each time you deploy the assemblies in Visual Studio (on project properties tab). When you increment the version, CRM will be sure to unload the old assembly version and reload the new one without an IIS reset.
like image 178
Josh Painter Avatar answered Oct 06 '22 02:10

Josh Painter


I had this same issue when I had the project open in two instances of Visual Studio. The project which I was not debugging had a lock on the file and notifying me "This file has been modified outside of the source editor." After accepting the changes in my non-debugging solution, I no longer received the error and my breakpoints were hit in my solution I was debugging.

It sounds like there is a lot of possible causes to this error, but this did it for me.

like image 22
Brian G Avatar answered Oct 06 '22 02:10

Brian G