I am working on Sharepoint 2010 projects in Visual Studio 2010 and i am trying to attach to the w3wp.exe process. I attach fine and a few of my assemblies show up in the Modules pane, but the main assembly i want to debug does not. I have done everything to specifying the place to look for the pdb and even copying the pdb to a folder and pointing VS to look at that folder for the symblos but it still hasn't helped.
i have retracted and deployed
I have Cleaned all projs in the solution and then REBUILT and deployeed
I have rebooted
deleted bin and obj directories, cleaned, rebuilt and deployed
I don't know what else to try. I have tried things from posts all over the web, anyone have anything else to try. keep in mind this is a SHarePoint 2010 server with Visual Studio 2010 on it.
As Alex implied, it's not always intuitive to figure out when to attach to w3wp.exe, but as a general rule of thumb, if you're not actually watching the content getting rendered (that is, it's not in a web part or an application page), you almost always want to attach to the SharePoint Timer Service (owstimer.exe) instead. This is obviously true with stuff like timer jobs but it's equally the case with workflows and event receivers where you haven't explicitly called them as synchronous.
Alex's links are great for this too. I will add that when in doubt, and you're debugging out of your own dev environment, it's not always the worst thing in the world to attach to both owstimer and your application pool's version of w3wp.
in the end, someone over wrote the web.config changes required for the module so the code was never executed. It never had anything to do with the symbols. Thanks ULS for showing me the way ;)
Thanks for the responses.....
Related
I am not able to debug the Sharepoint project in Visual studio solution even after attaching W3workerprocess. please help me on this.
I cheked project properties, website URL is also correct. but still i am not able to debug the solution
Have you made any changes that's not deployed/copied to GAC/BIN? If not, copy to GAC/BIN using CKSDev (VS tool) and then do a IIS reset (I think that CKSDev handles this also). Then refresh your page and then attach the process again. Also there's often multiple w3wp.exe you can attach to. I usually select all those.
I have a solution with several projects that have Register for COM Interop checked.
I have a Visual Basic 6 project that references the resulting TLBs. One issue with VB6 is when it references a dll/tlb, it puts a lock on that file.
Using Visual Studio 2010, unless I'm doing a rebuild or have made a change to one of these interop projects, I can build/run the solution (with the VB6 project open) without it barking that one or more of the assemblies is locked.
However, using Visual Studio 2012, even on a simple build where nothing has changed, apparently it always does the regasm, which makes it impossible for me to debug my VB6 project.
Is this new feature of Visual Studio of running regasm on build something that I can turn off?
EDIT: Allow me to simplify:
Using Visual Studio 2010, I hit Build-->Build Solution and check the output for one of my assemblies that is marked as Register for COM Interop and the file has not changed.
Using Visual Studio 2012, I do Build-->Build Solution and check the same assembly, it has been updated, and does so every time I hit Build Solution.
I want the behavior in Visual Studio 2012 to work the same as it did in 2010.
EDIT (again):
I posted this to Microsoft Connect. If someone answers it there or posts a workaround, I'll urge them to also post the answer here.
I've always encountered problems like this when running VB6 and VS20XX, but I always did a rebuild. My suggestion is to stop using VB6 for testing purposes. I found it was far easier to simply create a testing project and do all of my testing in .NET on my .NET code. This should only require a small amount of set up, but it is well worth it in my opinion.
I know this isn't an answer to your specific question, but it offers an alternative. As far as the problem you are describing, I can't duplicate a change in behavior. I start off with only VS201X open, full solution rebuild, open VB6 and add a reference to an exposed COM DLL. I didn't notice anything unexpected.
Build works fine as long as I haven't changed anything in the COM DLL
Build fails if I changed the COM DLL's code as the file is locked
Rebuild fails as the file is locked
I have a command line app that uses a certain assembly. The assembly is sitting in the root of the project, and set to "Copy Always."
I add a reference to that assembly, and Visual Studio 2010 is happy -- Intellisense highlights everything correctly, and no errors are reported.
But as soon as I actually build, I get compilation errors like I haven't added the reference, and Intellisense suddenly gives me red squigglies as if the reference was never added.
But the reference is still there.
If I delete the reference and then re-add it, Visual Studio gets happy again, and the red squigglies go away. Then I build, and the same thing happens again.
So, Visual Studio agrees that the reference is there. Until I build. Then it claims its not. Even though it is.
And this only happens with a specific DLL (NLog, if it matters). Another DLL (HtmlAgilityPack) works fine, and it's set up and configured the exact same way.
With a little search I found a problem with the .NET client profile. Try looking at that link and see if it resolves the issue.
There's also some posts on it at the microsoft connect website if you're interested in further reading.
I have a periodically occurring problem when building with Visual Studio 2010.
Sometimes it refuses to build with an error message like:
Error 102 Unable to copy file "xxxxx\Debug\Services.dll" to "bin\Debug\Services.dll". The process cannot access the file 'bin\Debug\Services.dll' because it is being used by another process.
The only remedy I have found is to restart Visual Studio. Closing the solution is not enough.
I have tried to find the culprit with Process Explorer since I suspected that one of my own threads didn't close down as it should. However the process is devenv.exe, i.e. Visual Studio itself. Also I get this symptom only with VS 2010 even when building upgraded VS 2008 projects. I never experienced this problem with the same projects under VS 2008.
I have a lot of custom made WPF user controls and I have a theory that it is the WPF designer that sometimes hold on to the control's dependent dll's when it should be releasing them for a build. The theory is not well established since this is a periodic problem and sometimes it occurs without the designed being open. I also have the same problem for a windows forms project. Sometimes I get through a day without a locked dll. Sometimes it is every other build or so.
I have asked Microsoft about the problem and they told me to make a dump of Visual Studio and debug the dump. I didn't find that to be sound advice.
Have anybody experienced something similar? It is really annoying.
Update 1
Since this appears to be a Visual Studio bug and Microsoft has responded that they do not intend to do anything about it I would like to encourage everybody who works with custom user controls to up-vote this bug at connect.microsoft.com.
The bug is both reported here: https://connect.microsoft.com/VisualStudio/feedback/details/587281 and by me here https://connect.microsoft.com/VisualStudio/feedback/details/568672
Update 2
I have hacked together a simple Visual Studio macro that closes down all .XAML files before building. So far I have not experienced the lockup with this macro.
Add the following macro in Visual Studio and assigned to your favorite build short cut. Maybe / maybe not that will fix the problem.
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Public Module CloseXamlAndBuildModule
Sub CloseXamlAndBuild()
For Each myDocument As EnvDTE.Document In DTE.Documents
If myDocument.Name.EndsWith(".xaml") Then
myDocument.Close()
End If
Next
DTE.Solution.SolutionBuild.Build()
End Sub
End Module
I finally found a stable working solution. I realized that the source of the problems were initializing code in the constructors of WCF services and WPF controls. After cleaning the constructors from any dependencies to other assemblies everything has been fine.
Try using VSCommands plugin.
It has option to 'Apply Fix' that will allow you to close any process which keeps the file locked (most often than not it is vshost process which can be killed).
This is a fairly persistent complaint about VS2010 although it is not wide-spread. I haven't seen a good diagnosis for it yet. The feedback item to watch is this one, it seems to be the collector for most duplicates. Getting it resolved quicker probably is going to require opening a case at Microsoft Support.
I actually reported this problem to Microsoft Connect a while ago, but had not checked up on the issue in a while.
My original report to Microsoft is here.
Among the comments is a way to reproduce the issue with custom user controls (as I suspected).
Microsoft just replied with a standard "thank you for your feedback, your suggestion does not meet the criteria to be addressed". Thank you Microsoft. I guess I will just have to live with restarting Visual Studio a couple of times every hour.
When trying to execute from within Visual Studio 2008 your application and you get the (uninformative) message "The operation could not be completed".
The solution to this is to turn off the "Visual Studio Hosting Process".
The problem with turning off this "hosting process" is that all the "run and rewrite" functionality is no longer available. OK, so this isn't a big deal, but I'm always getting this message no matter what machine I use (and it might be nice once in a while to use the rewrite and execute functionality).
Am I doing something wrong? How come this "feature" within VS seems to complain so readily? Do other people have success with enabling the hosting process and making use of it?
The problem with turning off this "hosting process" is that all the "run and rewrite" functionality is no longer available.
The Visual Studio Hosting Process is not needed to allow Edit and Continue. It is used for "Design time expression Evalutation" in the case where the project is a dll rather than an EXE. It is also used to provide debugging for partial trust scenarios. See the documentation for everything it does.
It is highly unlikely it does anything you need, so don't feel bad turning it off.
Is your project output folder set to a network share?
If so, try changing it to a local folder and see what happens. It appears that VS is not always able to terminate the process if the host exe is running from a share.
The other possibility is that the project is open and running in debug mode on another instance of Visual Studio - although I suspect you will allready have ensured this is not the case.
I honestly have never seen this message and I work with Visual Studio for at least 8 hours a day. Is this reproducible on other machines? If so is there anything weird or abnormal in your code that could cause this to crash?
I use 4 different machines and have got this situation on all of them. I understand what is causing the problem - it is that the VS hosting process isn't terminating after the first debug session ends, which means that the next time that you try to compile the exe the hosting process is locking the exe and preventing compilation. Another solution therefore is to use Task Manager to kill the VS hosting process and compile and debug as normal but thats even more of a hassle!
I can't think that its anything in my code that would be causing this - its probably a VS issue itself isn't it?
Here's the anwser: disable "Enable he Visual Studio hosting process" in he debug tab of your projects properties.
I found it here:
http://social.msdn.microsoft.com/Forums/en-US/vbide/thread/40d2d241-a0c0-4137-9da9-e40611972c0e/
There are several causes and workarounds regarding to this problem and you might try the following ones that are useful most of the time:
Delete the "Your_Solution_FileName.suo" file and restart Visual Studio.
or
Right click on the project and select Unload Project and then click Reload Project by right clicking on the project again might also fix it.