Debug a custom solution for Sharepoint 2010 in visual studio - sharepoint

I built the WSP file manually (using CAB utility) and uploaded them to the sharepoint 2010 server. I want to debug the dll that was packaged in that WSP file to test if the events are caught by the listener. I attached to w3wp.exe (all instances that appears). however I find that the symbols are not loaded for any break point to be hit and the thread is getting exited with some run time exception.
what Am I missing here ? Do I have to copy my PDB files at any particular location ?
thanks

you have the answer in your question. yes you have to upload your pdb file to GAC using command prompt and copy statement
which would be available under
C:\WINDOWS\assembly\GAC_MSIL> in directory form open it and copy your pdb thier
or easier option is compile your wsp in debug format

You don't need to copy the PDB symbols file into the GAC if Visual Studio is configured correctly :-
Fortunately, it's just as easy to
debug in the GAC as it is in BIN if
you configure the development
environment correctly.
Unfortunately,
few know how to do this because the
internet is polluted with pages full
of bad information that is a held over
from previous versions of .Net.
You
can spot these easily because they
will say you need to copy the debug
symbols (.pdb file) to the GAC. In and
of itself, that will not work. These
days it is also completely
unnecessary.
To configure VS ... to debug the
assemblies properly, do the following:

You mention the Sandbox tag in your question, so you have to attach to SPUCWorkerProcess.exe and not w3wp.exe, the sandbox code runs in an isolated worker.

Related

How can I Get visual studio to use source server in preference to local files when debugging?

I have just started experimenting with the Microsoft tools to set up a symbol and source server.
I have successfully indexed my source files using p4index, updated the .pdb files and updated the symbol server.
I have set visual studio to use the my symbol server.
All works fine: when I step debug through my exe as a standalone exe the pdb's are loaded and the correct version of the source code is exported from perforce to temp location and displayed within visual studio.
Whats the problem then? If I try to debug on the machine on which I built my exe then visual studio finds the source code locally. The trouble is that this is a modified file and not the correct version of the source corresponding to when exe was built. VStudio even knows this and pops up a requester saying "the source file is different from when the module was built. Would you like the debugger to use it anyway?"
If I click no then I just get a file dialog to manually locate the source.
Is there a way to get vstudio to fall back to using source server or preferably to use the source server first before looking looking locally?
I'm using visual studio 2012 and perforce
After having encountered the same issue, I finally narrowed it down to the fact that Visual Studio won't run the P4 PRINT command if there is already a file at the place where the pdb/debugger expects to find it.
For example, if the indexed source file was in C:\Toto\Source.cpp, the sole presence of this file when Visual is looking for it will prevent the P4 PRINT.
If i rename it, Visual is correctly printing the file in another unrelated folder (the symbol cache pass).
It's not a fix, it's only a reason, but I'm still investigating.
This behavior is not present in windbg.
In case anyone else finds this thread and has the same problem, the solution in my case was to Enable "Require source files to exactly match the original version" in Options -> Debugging -> General.
It will still prefer the local copies, but only if they are identical, in which case it is the same version it would otherwise grab from the source control server. And if it isn't the right one, it will now display the proper one from the source control server.

could not load assembly or one of its dependencies. The system cannot find the file specified

I am working on a windows application and I am using another dll with name diffplex. I have stored it in the bin folder of my solution. in properties I have set it as copy local = false.
When I am running the program from visual studio it is working fine. But when I copy exe from bin to some other location and try to use this application I am getting this error - "could not load assembly or one of its dependencies. The system cannot find the file specified"
Please find the screen shot attached. But I want to give my client only exe file not the dll file. What can I do.
Hi Finally the issue has been fixed. A tool MS ILmerge is used which on post build event makes both exe and dll as one file

Visual Studio 2012 Web Publish keeps overwriting existing files with same version

Just installed VS2012 and run across a strange behavior by the one click publish feature.
I'm publishing via FTP and everything works fine except it seems that VS insists on overwriting some files over and over even though nothing's changed.
In VS2010 clicking the "publish" button over and over just runs through the steps and finishes in a few seconds, in VS2012 it takes about two minutes as it keeps copying a 5mb dll and some other stuff too.
P.S the "delete all existing files prior to publish" is off
It's an absolute pain. I've resorted to keeping the solution open in VS2010 alongside the VS2012 and using VS2010 to publish, it's annoying, but it's faster...
Unfortunately there's no option for only changed files in VS 2012. Not sure why they took it out, other than maybe too many people complained that VS wasn't synching properly when their FTP servers were the problem. FTP servers are notorious for not giving back correct file info.
This is real too slow on large amount of files.
My best experience is to remove unused folders not containing assemblies (scripts, css, etc...) this way <ExcludeFoldersFromDeployment>Content;Scripts;Views</ExcludeFoldersFromDeployment>
.
Publish these files straight when you change them . Otherwise publish assemblies from profile .
https://msdn.microsoft.com/en-us/library/ee942158.aspx#can_i_exclude_specific_files_or_folders_from_deployment

Unable to debug workflow

I am trying debug a workflow code and it always shows that the breakpoint cannot be hit. I have made sure that I deploy the recent code.
Also I have tried to load the PDB symbols using windows->debug->modules but I don't see the dll of my project there.
I am not not understanding how to proceed further. I am using vs2010 and sharepoint 2010
In order to debug workflows you have to attach to owstimer.exe and w3wp.exe (try all of them if there a several). And of course you have to have the same code both in studio and deployed.

debugging a sharepoint baselayoutpage

is it impossible to debug? I am running 64-bit Windows Server Enterprise, and trying to debug my solution on Sharepoint which includes a dll that has baselayoutpage pages. When I try to atttach the process to the Visual Studio debugger (VS2008) it says break points will not be hit. I have been pulling my hair out on this one, I have tried manually locating the module in debug and specifying the pdb file, but that doesn't work. i have even tried redeploying several times. There is the VSeWSS DebugReDeploy configuration I use to reploy the assembly onto the Sharepoint site.But always ends up that I am unable to debug, I have tried many things! If anyone would know why please let me know?
I have found the answer, I had to goto the project properties in solution explorer and goto the build options and click advanced from there select all configurations and select debug info as All... I hope I told it correctly, I am saying it from my memory

Resources