DNN7 module cannot debug due to break point not hit - c#

When i using the Default DNN7 create modules (DotNetNuke Compiled Module), i want try to debug on Page_load
CustomModuleController objCustomModules = new CustomModuleController();
and make and breakpoint on the line, or anyline on Page_load, it given the error.
The breakpoint will not currently be hit. No symbols have been loaded for this document.

I would recommend that you check out the templates at http://christoctemplate.codeplex.com the templates in the visual studio starter kit frankly don't work.
That being said, if you want to make sure that the current template will work, check the following
What is the build location of the DLL (right click on the project, choose properties, check the build tab)
Do you have debugging enabled in the web.config file?
Are you building in DEBUG or RELEASE mode?

What if you want to develop dynamic modules (non-compiled), in separate project, other than the website proj?
The Christoc Templates are all compiled, right?

Related

How can I debug something inside a dll after a $.get?

I am working on a solution that makes a $.get call to a controller (in a different solution in a different module) inside of a dll. How can I put a break point in the original code of the external project, and actually hit that break point?
Please explain this like you were explaining it to a six year old because im still pretty new to programming.
Make sure Visual Studio is attached to your server process. (if you hit F5, it will be)
Click Debug, Modules, and make sure symbols are loaded for the other DLL.
If they aren't, right-click it, Load Symbols
Open the original source file.
Set a breakpoint.

visual studio source stepping

not sure what else to try, but i am not able to step through the .net source code.
In the debugging options
Enable just my code is unchecked.
enable source server support is checked.
Enable source server support is checked.
In the debugging symbols
1. Microsoft symbol servers is checked.
2. cache symbol directory is set.
when i try to step through some system.servicemodel.dll stack trace,
in the modules windows, i can right click and load symbols for servicemodel dll
it flashes the cancel dialog, like its doing something
the stack becomes black from grayed out
but when i click on the method it shows no source code available
any other ideas ?
I suspect Visual Studio could not find the appropriate code for your DLL. Perhaps the easiest way is to re-build the DLL, and reference the DLL with the code in the expected directory. Let's try that first, and see what we can learn from your testing.

Conditional Compilation in Visual Studio(C#)

I am attempting to make it so that we can have our application to behave differently based on the presence of a preprocessor directive. I've read that you can create build configurations to define different preprocessor directives based on which build you do. Well, I am not seeing anything in Visual Studio to do this.. I know how to do it from the command line, but not how to do it within the automated environment of VS 2008.
Can someone tell me how to create a new build configuration which has preprocessor directives set in it?
Also, not sure if it has anything to do with it, but our project is an ASP.Net website
I do not even see a way to control the
DEBUG symbol, and it is an ASP.Net
website
Ok, there's the problem. The ASP.net web site option gives you a lot less control over builds, etc as it doesn't even use a project file.
If it is at all feasible for you to switch, switch over to an ASP.net web application. A web app will behave much more like a typical C# project (you have a project file, and the contents of the csproj file control what is in the app instead of just the directory structure, etc.
After you have converted, you should see the options that you are expecting.
Here's a link with directions for converting: How To Convert ASP.NET Website to ASP.NET Web Application
If you right-click the project and select "Properties", then select the Build tab, you can enter custom compilation symbols in "Conditional compilation symbols".
For example, if your code looks like this:
#if DEBUG
// do something
#else
// do something else
#end
You can set "DEBUG" as a Conditional compilation symbol.
You can set different values for different build configurations, by changing the "Configuration" drop-down.

break point is not hitting while debugging

Possible exact duplicates:
Reason for VS.NET ‘current breakpoint will not be hit’ warning?
Why does Visual Studio sometimes not go to my breakpoints?
Why would the debugger not be stopping at a breakpoint in my ASP.NET application?
while debugging,the modified source code the break point is not hitted for a particular aspx page and the following error is shown in the break point
"the break point will not be currently hit.the source code is different from the original version"
but for other page it is working fine.
It worked for me. Try this.
First try rebuilding your project by right mouse click the project > Rebuild If that doesn't work, try a clean of the project (right mouse click on the project > clean)
If that didn't work check this:
1- Right mouse click your project
2- select [Properties]
3- select [Build] tab
4- make sure [Define DEBUG constant] and [Define TRACE constant] are checked
5- Click the [Advanced] button at the bottom of the Build tab page
6- Make sure that [Debug Info:] is set to [full]
7- Click [OK] and rebuild the project ;-)
Hope that works for you! (step 6 generates the .pdb files, these are the debugging symbols)
Some times this occurs if the sourcecode is been copied from the network folder, it messes up the symbol settings. Below solution works for me everytime
In debug mode, select debug->windows->modules
Check your dll symbolStatus . Make sure that it is loaded into
the project (i am sure now the status
is not loaded )
Right click your dll, click symbol settings.
And manually add your symbol path (.pdb file path)
And again right click the dll, and click load symbols
Hope this helps
That suggests the build that's running doesn't match with your code.
Try performing a "clean", make sure that you've stopped any previous debugger sessions etc, then rebuild and retry.
make sure there are not instances of w3wp.exe running. I had several and closing them fixed it for me.
Visual studio repair solved the problem for me
search for visual studio installer in start
select more option for the version you are using and click repair.
In my i changed the connection string but in the browser it was referring to old string so i just did 'empty cache and hard reload in chrome browser' and it worked
This problem occurred to me when I had copied the project. In fact, by opening the old code file if breakPoint is inserted, you will see that it will work. So learn the correct copying method.

Enable and disable "Step into" debugging on certain project in a Visual Studio solution

I have a Visual Studio solution with four C# projects in it. I want to step into the code of a supporting project in the solution from my main project, but when I use the "Step into" key, it just skips over the call into that other project. I've set breakpoints in the supporting project, and they're ignored, and I can't for the life of me get it to step into any references to that project.
Everything is set to compile as "Debug", and I've seen Visual Studio warn me that my breakpoints won't be hit before - it doesn't do that in this case. It's as though it looks as though my code will debug, but then at run-time, there's a setting somewhere that tells Visual Studio not to step through the code in that project. All the other projects in my solutions debug without problems.
What box have I checked to cause this behavior?
UPDATE FOR CLARITY: The "Just my code" option is currently disabled. Also, since the code belongs to a project in my same solution, I don't think the "Just my code" option applies here. I thought it only applied to pre-compiled code that I didn't have the source for, but since I have the source in my project, I don't think this option has any effect.
Not sure if this is it, but "Tools>Options>Debugging>General:Enable Just My Code" is a possibility. (I prefer to always leave this unchecked.)
It turns out that the assembly needed to be copied into the GAC before it could be debugged. Under the debugging option "Just my code", there's an option to suppress an error if you don't have any user code, and it was suppressing the following error:
The Following mobile was built either
with optimizations enabled or without
debug information. (Module name and
path) To debug this module, change its
build configuration to Debug mode.
Since I was building it in Debug configuration, I searched on that error message and got this:
http://claytonj.wordpress.com/2008/01/04/the-following-module-was-built-either-with-optimizations-enabled-or-without-debug-information/
Problem solved. I don't know why it needs to be in the GAC in order for me to step into the project, but it does. I don't ask why, I just ask how, and then I do it...
One thing to check for is that your supporting project assembly has not been installed in the GAC. Open a command prompt and run the following to make sure...
gacutil /l assemblyName
You need to ensure the supporting projects have pdb files or else Visual Studio will not have the necessary information to step through the code.
If you have the source code for the dll's into which you are trying to step into, do the following:
Click on the project in which these dll's are added as reference and remove them.
Add the Project(s) corresponding to the dll(s) to the solution
Right click on the project -> Add Reference -> Choose the newly added Project(s).
Now set the break point and debug the code.. You will be able to step into the code.
The reason for the issue is because you program is still referencing the old dll (without the source code) as it has been added to your project as a reference. Once you remove that dll and add the Project (Source code of the dll) of the dll, Visual studio will be able to step into your code.
A couple of possibilities:
There is a check box to step into "just my code". Its intent is to make it so you can't step into Microsoft's Framework code (unless you choose to by unchecking the box).
You might try recompiling the supporting code to make sure the code you're debugging exactly matches the code file you're looking at. VS does care about this and will disable a breakpoint if you put it in the code file whose version doesn't match. Also, make sure the PDB file is in the same directory as the DLL.
In Visual Studio 2013 one way to cause this behaviour is to set build configuration to Release.
Put it back to Debug and see if that helps.

Categories

Resources