Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Friday, November 28, 2008

Workflows general debugging issues

VisualStudio crashes while attaching the w3wp.exe process.
While trying to attach the w3wp.exe process related to workflow, visual studio will take more time during the attach process then it will crash and reopen because of some issues. I am not sure yet why the visual studio is crashing with out giving any error. But i was able to resolve the problem by selecting only the "WorkflowCode" option from the "Attach To" select button.

There are more than one w3wp.exe. which one i should use?
The other issue generally we face is there will be more than on w3wp.exe processes will be showing and it will be confusing which one we should choose. We need to select the process which is showing "Workflow" in the Type section. If none of the processes are displaying "Workflow" in the Type section then it means that the appropriate process is not running. We can't debug by attaching to other w3wp.exe processes.

Couldn't find the process to attach the worflow.
The correct w3wp.exe process to attach the workflow will be showing "Workflow" in the Type column. But some times this will not be displaying due to various reasons. If we want to get the process again in the Attach window , We need to start a workflow manually. Then, the process related to the workflow will be available.

BreakPoints specified in the code file will not work (will not be hit during debug mode).
After specifying the break points in the code, the break points will not be enabled to debug and it will be showing the error "No symbols have been loaded for this document". The issue will be happening because of the following general mistakes.
  • Correct version of the DLL is not deployed to GAC
  • Correct version of the file is not specified in the config files like workflow.xml
  • The Project is build again after the deploying the DLL to GAC
  • There are some modifications done in the code file after the deployment

There is one more issue happening while attaching the process. The break points will be still showing like they will not be hit. (with the "No symbols have been loaded for this document". warning). But if we start debugging after attaching the process with the above error, this error will disappear once the workflow started running and our break points will be hit.

Failed on start - workflow error

I was trying to create a basic workflow with one single "LogtoHistory" activity. But when i tried to start that workflow after associating it with a List. It was failing with the error message "Failed on start"

I tried to debug it after attaching it with the w3wp.exe process. But it was not hitting the break points and the break points were saying the error message
"No symbols have been loaded for this document."
This gave me a clue about the error. I checked the assembly information in the workflow.xml file and found that schema i used to create the workflow.xml put the version of the assembly as 3.0.0.0 . I changed it to correct version and executed the workflow again. It worked fine.

So, If the workflow is failing with "Failed on start" it means there is some mismatch in the assembly information. But if the workflow is giving the error "Failed on Start (Retrying)" there may be some other issues.

Tuesday, October 7, 2008

Create feature.xml for workflows using Code Snippet feature

While creating feature.xml or other XMLs from scratch, many people will be feeling a kind of difficulty. Well, this may not be applicable for people who live with visualstudio :). However while starting from scratch i noticed many of the developers are looking for a copy of feature.xml in features folder or somewhere else.

There is a very easy way to get your code snippet using visualstudio Code Snippet Manager.

1.Open your project in Visualstudio and add a new xml file

2.Press Ctrl K, Ctrl B. It should open Code Snippets Manager. We can also open this from Tools--> Code Snippets Manager menu.

3.Select XML from the Language drop down. Click on the Add button.

4.Select "C:\Program Files\Microsoft Visual Studio 8\Xml\1033\Snippets\Windows SharePoint Services Workflow" folder and "C:\Program Files\Microsoft Visual Studio 8\Xml\1033\Snippets\SharePoint Server Workflow"
Note: The second one is bit descriptive and it will come up with tags related to InfoPath forms and details about receiver class and assembly.




5.Right click in editor and select "Insert Snippet" from the context menu.


6.Select the feature.xml snippet. It will give us the Feature.xml we just need to fill up the template.

Friday, October 3, 2008

XML intellisense support for feature.xml file

This might be a well known point for developers who are already familiar in visual studio development environment. I am just putting this point for the beginners.

This is not specific to feature.xml file. We can use the same technique to get the intellisense support for other XML format files, the point is we need to select the appropriate schema files.

For feature.xml we need to do the following steps to get the intellisense support.

1.Add a blank XML file to your existing visual studio project and save it as feature.xml.

2.Select the properties of the feature.xml file.(F4) and click on the "schemas" property. a dialog box should open.

3.Click on the Add button.

4.Select the wss.xsd file from the Share Point schema location "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\wss.xsd"

5. Make sure the wss.xsd is selected in the "XSD Schema" window. Click on OK.


Now you should be able to use the Intellisense support for feature.xml file and other WSS related XML files