Error loading workflow in VS 2005

Topics: User Forum
Jan 25, 2007 at 9:35 PM
I can compile and run PageFlowQuickStart solution in VS 2005, but when I try to open CustomerApprovalPageFlow workflow in VS design mode, it throws exception:

-------------------------------------------
Error 95 The type initializer for 'Microsoft.Practices.PageFlow.WorkflowFoundation.Activities.PageFlow' threw an exception.
-------------------------------------------

Could you tell me how to solve the problem?

Thanks a lot in advance!
Jan 26, 2007 at 12:29 AM
Hi!.
The only workaround which helps me get rid of this annoying error is as follows: just rebuild a PageFlow.WorkflowFoundation project and a project that contains the workflow itself, then reopen the workflow.
Jan 26, 2007 at 5:34 PM
I changed the format of CustomersApprovalPageFlow.layout (by just breaking long lines) and tried to rebuild the solution. Then somehow the workflow appeared in design mode. :)
Feb 2, 2007 at 3:43 AM
AHrrrrrrrrrrrrrrrrrrr this is p!$$ing me off..... happened the other day and couldn't figure it out, had to back out my changes and re do them... now its happening again. I think its something solution specific as I've found out you can open the project with the problem WF on its own its all works sweet...

... more investigating ... ahrrrr

seems crazy but this seemed to fix it by switching some setting in the .sln around. I was comparing the previous, working .sln with the broken one, changed this:

GlobalSection(ExtensibilityGlobals) = postSolution
RootNamespace = Fer.Server.PaymentsWebSite
IsWCSFSolution = True
EndGlobalSection

to this:
GlobalSection(ExtensibilityGlobals) = postSolution
IsWCSFSolution = True
RootNamespace = Fer.Server.PaymentsWebSite
EndGlobalSection

seems totally nuts, and probably is actually something else that fixed it (wonder if this is affecting the solutions .gpState file and somehow that’s to blame?).

Seems to be one of those, stand on your head, hold your nose with your left hand and then its all starts working.


Feb 3, 2007 at 11:52 PM
Had the same problem (same solution) on a different computer, as I suspected above the mod to the solution file does nothing but my suspicions about the .gpState grown stronger :)

When I close the solution delete the .gpState file, reopen the solution, do a clean and a rebuild the WF appears in the designer.
Feb 3, 2007 at 11:57 PM
pity i didn't actually look in the gpstate before i deleted it, not much in the new one. Well im sure its going to happen again, will repost here if any further info.
Feb 4, 2007 at 1:08 AM
I get the same problem often and it is quite the pain. I haven't figured out the exact cause yet, but it usually happens when I have multiple instances of Visual Studio running and/or going back and forth between different solutions that use workflow.

I have never had to delete or change any files. The process below always works for me-

1) Close down all instances of Visual Studio.
2) Open the desired solution.
3) Re-Build the Solution.

after that I don't get any problems in that solution opening workflows.

However, I can't open another Visual Studio instance simultaneously and look at another workflow. I can only have 1 instance running at a time and I always have to go back and do the process again each time I want to work on another application.

It makes for learning this stuff and utter nightmare.

Regards,

Dave

_____________________

David Hayden
Microsoft MVP C#
Feb 4, 2007 at 9:43 PM
I am having the same problem re Workflow designer crashing with an error.

To fix it I got through the same steps as mentioned above.

However I can have multiple solutions with the Workflow designer open and swithc back and forth between them.

I am using VS2005 sp1.

Cheers
Rainer
Feb 5, 2007 at 12:26 AM
yeah for some reason that whole shut down VS, reopen and rebuild doesn’t work for me. I even go silly and shut down delete the bin and obj folders (ah powershell: ls -Recurse -Include bin| Remove-Item -Force -ErrorAction Continue -Recurse), repoen and rebuild and was still getting the error. Not sure if I had any other vs instances open, but will keep it in mind for next time (c;
Feb 5, 2007 at 2:19 PM
I was having this problem with my own projects as well as the quick start.

For me, rebuilding the PageFlow and PageFlow.WorkflowFoundation assemblies fixes the problem. I added these projects from the WCSF source to my solution so I can clean and rebuild them easily. Then I reference these projects rather than the pre-built assemblies.


Ben
Coordinator
Feb 5, 2007 at 8:14 PM
Edited Feb 6, 2007 at 2:36 AM
Believe it or not, we feel your pain. I know no one from p&p has posted in this thread. For that, I apologize. The reason for the delay is that we are working with the Product Group that owns the designer to find a solution.

I have a question for folks though: Does this only happen with PageFlows? Meaning if you create a new blank solution, and add a Workflow State Machine project to it, do you see the problems in the state machine designer?

Thanks for your answers and you patience.
Mike
Feb 5, 2007 at 11:06 PM
Problem just keeps coming back, none of the above works for certain (including deleting temporary files from\Documents and Settings\...\Local Settings\Application Data\Microsoft\VisualStudio\8.0\ProjectAssemblies, which wasn’t mentioned above but was done in a last bid effort).

The only thing I can confirm (well at the moment anyway :)) is that if I open my problem solution which contains a particular business module project (project file contains <UserProperties IsModuleProject="True" />) that contains my workflow (I brought the WF into the business module rather than leaving it in a separate project), it doesn’t work. But if I open the business module project on its own by double clicking on it in explorer, do a build (VS will ask you to save a new .sln for the build to proceed) then the workflow opens fine in the designer. It seems to be something related to the solution, perhaps some metadata somewhere??

Also tried to read-add the Microsoft.Practices.PageFlow.WorkflowFoundation.dll to the toolbox in case there were some issues there but no luck.

I’m using VSTS with SP1 (problem also happened without SP1) and release 1 of the WCSF (the dll’s that came out of the box)

At least for now if I need to edit the WF I can do it in the separate solution.
Coordinator
Feb 6, 2007 at 2:44 AM
KeithW,
Here is a completely crazy idea that I have seen work when all else failed on one computer: Open up the PageFlow's CSProj file in notepad while VS is running with the solution open. Add a few carraige returns to the end of the file, and save it. Flip over to VS, and when it asks if it should re-load the project, say yes. Rebuild and see if the designer works.

Note: This worked before VS-SP1 was available on the released bits of VS.


Feb 6, 2007 at 3:22 AM
"its crazy, but it just might work"

unfortunately it didn't, but thanks for the suggestion :)

just for the hell of it I fired up filemon to see what the ide was doing when it opens the WF. Noticed these 2 entries in relation to the WF file that looked a bit dodgy, but bit over my head at this point :)

56 1:12:56 PM devenv.exe:4100 IRPMJQUERY_INFORMATION C:\VSTS\.....PageFlows\CaseAndTTPPaymentProcessingPageFlow.cs BUFFER OVERFLOW FileAllInformation

...

76 1:12:56 PM devenv.exe:4100 IRPMJQUERY_INFORMATION C:\VSTS\.....PageFlows\CaseAndTTPPaymentProcessingPageFlow.Designer.cs BUFFER OVERFLOW FileAllInformation
Feb 6, 2007 at 3:30 AM
Should have clarified exactly what I did so as not to misinterpret your suggestion. I opened the project file that contains the problem WF files and added a few lines to the end and then, selected reload and then rebuild the project in VS. Then tried to open the WF in the designer.

If you were referring to touching the PageFlow Blocks’s project file, I’m only referencing the DLL’s that came with the v1 WCSF install. I was initially referencing the PageFlow project but once I got the transitions working I went back to the binary reference.
Coordinator
Feb 6, 2007 at 3:08 PM
KeithW,
I did mean the csproj fil with your workflows in it, not the PageFlow AB project file.

Sorry that did not help.

We are still working with the folks in the VS team who "own" the designer to find a workable solution.
Feb 7, 2007 at 11:48 PM
Edited Feb 7, 2007 at 11:49 PM
some more info re this problem.

- Worked with the designer yesterday without much problems. If it didn't load rebuilding the solution and/or restarting VS 2 005 always restored the designer.

- Today the designer refused to load. Tried everything: exit VS2005/rebuilding, rebuilding/existing vs2005, reboot/rebuild, nothing would work.

- Looking at the error it complains about a type in Microsoft.Practices.Pageflow.WorkflowFoundation.Activities, so I removed the assembly from the Pageflow project and re added it and surprise, surprise the designer works again.

Hope this helps tracking down the problem.

Cheers
Rainer
Feb 8, 2007 at 4:25 AM
Edited Feb 8, 2007 at 4:26 AM
humm deleting the solutions .suo file seemed to work today. Time to stop posting and wait for the designer team to come up with the correct answer i think... (c;
Coordinator
Feb 8, 2007 at 10:40 PM
Thanks again for the continued input, help, ideas, and patience. We appreciate all of it.

Just so you guys can understand how much we feel your pain, I want to share a quick story:
Yesterday, I was a speaker at an international, internal Microsoft conference, and I spoke about the Web Client Software Factory. Before the talk, I ran through all my demos, including looking at two different pageflows at different times during the talk. Everything worked fine. Then I got to the talk. There was a good sized audience, not huge, bug fair sized for this session. I did the first demo, and everything worked, including the designer. The second demo, (where I was going to add a break point to the PageFlow and step through, showing how you can debug these things), popped up the type initializer error message. Talk about annoying.

But we are trying to find a good answer so this does not happen again.
Feb 8, 2007 at 10:53 PM
You obviously didn’t pray to the demo gods
Coordinator
Feb 13, 2007 at 12:14 AM
Edited Feb 13, 2007 at 4:10 AM
Can one of you that experienced this issue, contact PSS and log the issue with them. That will help our cause to get a fix to the problem. Once you logged an issue let the others know. If you can get the bug ID that would be helpful.

Thanks for your help and patience on this issue.

blaine
Feb 16, 2007 at 11:19 AM
Edited Feb 16, 2007 at 11:22 AM
Any progress with this problem ?
Has the problem been logged with PSS ? If not I could do so, I'm currently working for MS MCS on a project for a big Customer in Belgium, and trying to 'sell' this...

It surely must have something to do with the solution a PageFlow project is living in.
If I open the project in VS (without a solution) is seems to work.

kr,
Michel.
Feb 16, 2007 at 11:35 PM
Edited Feb 19, 2007 at 3:29 PM
I have logged the issue with PSS. Issue Number 1-961342901 'Workflow Designer Bug - error opening workflow'

CASE Number: SRX070219600792

Daren
Coordinator
Feb 16, 2007 at 11:40 PM
Thanks DarenM for contacting PSS with this bug.

Just to be clear to everyone, this is a Microsoft bug. The Web Client Software Factory team is working with the appropriate product groups to get a fix for this bug. Once we have information that we can share regarding the bug, we will post it on this site.

blaine
Mar 10, 2007 at 3:10 AM
It really sounds crazy but the "add a carriage return to he end of the project file" that Michael suggested works for me (VS2005, SP1 + Vista Update, Vista Ultimate).
Mar 10, 2007 at 7:59 AM
Well for me it is not.
The only thing that always works is to never open the project in a solution, but open it by double-clicking the project file itself, and have it live it its own VS instance.
A hotfix is pending at MS, only its priority got changed from Urgent to Important...
Mar 17, 2007 at 4:43 PM
I think this issue might be similar to the other one related to the add view with presenter wizard. Bottom line, it's really not easy to plug in the code for the enterprise library. I just gave up, and I'm using a solution that only has the PageFlow extension projects and links to the signed binaries of the Enterprise Library for everything else.
With this setup, whereas before I could't get rid of this issue, now it appears every once in a while, but if I recompile the PageFlow project and try to open the flow again, it works.
Moral is, again, it's not easy to have access to the source code for project references done by the wizard, perhaps that aspect deserves a second look, have an option of linking projects instead of straight dll's.
Coordinator
Mar 20, 2007 at 1:13 AM
If anyone is still having issues, and can do so, please contact PSS and log the issue with them. The more folks who do this, the more we can push for a fix with the right group internally.

Thanks
Mar 26, 2007 at 12:22 PM
I am still having an issue in this. It's not working whatever i do. I tried all suggestions and nothing worked. The designer only opens if i open it in a separate project. I don't know what happened but everything was working fine and suddenly the designer stopped working although i didn't touch the project.
Apr 12, 2007 at 8:07 AM
Hi,

any update on this issue. I am facing the same issue even today. Any new release from Microsoft to sort out this bug?
Apr 12, 2007 at 8:42 AM
Incident SRQ070411601831 has been created, a fix should be on its way.
Apr 17, 2007 at 11:15 AM
Edited Apr 17, 2007 at 11:17 AM
Hi,

"If I open the project in VS (without a solution) is seems to work." solution by Michel helped me. Thanks for it. This atleast allows me to work further.

Can you please tell me what is PSS website to log issue?

Thanks

Apr 19, 2007 at 5:52 PM
Hi,

Came across this thread just now and this sounds familiar to a problem i was having ith my workflows (State Machine). My problems seemed to be when i was using multiple projects in a solution and i made a change to a project whose assembly was referenced by the workflow project.

My workaround is after any chnages to a project simply rebuild all, delete the referenced projects in the workflow project, re-link the projects/dlls again and rebuild the workflow project.

Voila!

Works for me.

Im not infront of my work machine so cant re-create to get an exact error message but what you guys are reporting sounds similar.

Hope it sorts you out if it is the same problem.

Cheers
Damian
Apr 19, 2007 at 11:15 PM
Hello,

If you are still having problems with this issue of Workflow models not loading in the Visual Studio designer please report your problem to Microsoft. This issue is logged at https://connect.microsoft.com/wf/feedback/ViewFeedback.aspx?FeedbackID=272081 and you can vote for the issue or add comments. Microsoft passport signin is required.

Regards,
Paul http://blogs.msdn.com/pandrew
Technical Product Manager, .NET Framework, Microsoft
Apr 20, 2007 at 9:35 AM
Edited Apr 20, 2007 at 9:53 AM
Thanks Paul,

I voted for issue. I wish everyone who found this issue; vote for the same so that we can get this issue sorted out soon!!

Thanks again.
Apr 22, 2007 at 8:27 AM
Hi,

MS found the cause of the problem. It is VS not being able to locate Microsoft.Practices.Pageflow.dll. A fix will be made.
In the mean time either strong name the assembly and put it in the GAC, or copy it unmodified to %ProgramFiles%\Microsoft Visual Studio 8\Common\IDE.

I did the latter and it worked like a charm.

kr,
Michel.
Apr 24, 2007 at 6:38 AM
Dear Michel,

Thanks a lot. It is working fine now.

Jayesh Chudasama
Apr 25, 2007 at 1:17 PM
I modified reference property of PageFlow.WorkflowFoundation.dll and set copy local to false. I assumed that VS is finding multiple references of this DLL. One from installation location and one in the project. This seemed to work for me. Will test more.
Hemant Sathe
May 2, 2007 at 12:56 AM
mliesmons thanks for the fix, appears to be working fine
May 3, 2007 at 6:03 PM
I tried copying the Microsoft.Practices.Pageflow.dll to the %ProgramFiles%\Microsoft Visual Studio 8\Common\IDE folder. A couple of interesting notes are:

I don't have a %ProgramFiles%\Microsoft Visual Studio 8\Common\IDE folder. I do have a %ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE folder. I copied the dll here and it didn't work.

I do have a %ProgramFiles%\Microsoft Visual Studio\COMMON\IDE folder. I tried copying the dll here and it didn't work.

I created a Common\IDE folder in %ProgramFiles%\Microsoft Visual Studio 8 and copyed the dll there but that didn't work either.

I tried setting copy local to false for the PageFlow.WorkflowFoundation.dll reference but that didn't work either.

Will WCSF 1.1. have a fix for this and is there an ETA?
May 3, 2007 at 7:24 PM
Roy,

My mistake, ofcourse it is common7.
It should definitely work (see other comments).

We received a private fix eliminating the need for this workaround, but the dlls are still partially signed.
The official fix is on its way, but my guess is it will remain private, i.e. you have to apply for it through your MS support guy.

kr,
Michel.
May 3, 2007 at 10:27 PM
Hi Michel,

No problem. I figured I'd post about the difference in case someone else found this post. I've had a very long running SSIS package runnig through VS.NET so I haven't been able to shut down all of my instances. I'm hoping once the SSIS package is done and I can shut down all of my VS.NET instances your fix above will work.

Is the fix a VS.NET fix or a WCSF fix? Would we have to get the fix from MS support because it is a VS.NET hotfix?

Thanks,

Roy
May 4, 2007 at 2:57 PM
Roy,

Both, it's a patch for Microsoft.Workflow.VSDesigner.dll and Microsoft.VisualStudio.Design.dll

kr,
Michel.
May 5, 2007 at 9:46 PM
Hi,

Currently there is a Next() available at Page level.
Does anyone know how to implement a Previous()?
As this does not exist in the Page properties, I tried by inspecting the page/flow definitions, but I can not seem to find a way.
My flow is constrained, so SetCurrentPage() will not work.
I think I need to Navigate to an activity pointing to a page with its default activity pointing to the CurrentPage.

Thanks for any input on this matter.

Michel.
May 5, 2007 at 10:03 PM
Sorry, previous was meant to be in a separate discussion, and I saw too late discussion was already there, anyway, a Previous() would be useful.
Aug 9, 2007 at 3:59 AM

I would appreciate someone helping me asap. I really need the fixed EFT.Module.csproj and PageFlow.WorkflowFoundation.csproj files.
I have tried everything to open the projects and rebuild them but with VS2005 sp1 I get a message saying the csproj files are not supported.
Please send them to me at mgregory at gt.com.au
I will appreciate your assistance.
regards
Mark
Aug 16, 2007 at 9:48 AM
unreference the pageflow.dlls from the project, and then add them again, these is one of the method

second method is, delete the pageflow dlls from ur project folder. and rebuild the project again, it would copy the dll from sys into ur proj folder again(default)

btw, is this problem fixed?

regards,
martin
Sep 17, 2007 at 11:35 AM
Hi,

I just installed the http://support.microsoft.com/kb/936123 hotfix that should have updated the "Microsoft.VisualStudio.Design.dll" and the "Microsoft.Workflow.VSDesigner.dll" but didn't. The problem is still the same. When I try opening a PageFlow I get the "The type initializer for 'Microsoft.Practices.PageFlow.WorkflowFoundation.Activities.PageFlow' threw an exception." error message.

any help would be appreciated

thanks,
bjorgvin
Sep 23, 2007 at 10:05 PM
Hi,

I did not know about this public fix, we installed 2 private fixes and they work.
312196 and 314175.

kr,
Michel.


bjorgvin wrote:
Hi,

I just installed the http://support.microsoft.com/kb/936123 hotfix that should have updated the "Microsoft.VisualStudio.Design.dll" and the "Microsoft.Workflow.VSDesigner.dll" but didn't. The problem is still the same. When I try opening a PageFlow I get the "The type initializer for 'Microsoft.Practices.PageFlow.WorkflowFoundation.Activities.PageFlow' threw an exception." error message.

any help would be appreciated

thanks,
bjorgvin

Sep 26, 2007 at 7:21 PM
Here's a workaround that works. Add a new key to the registry to tell the VS Designer where to find your WCSF assemblies. Create a .reg file like the one below.

Windows Registry Editor Version 5.00

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\WCSF
@="C:\\Program Files\\Reference Assemblies\\WCSF\\"

Change the value of the "@" (Defualt) key to the directory where your WCSF assebmlies are located. Save the file. Close all VS instances. Apply the .reg file. Open VS and try to open a pageflow now.

Hope this helps ...
Feb 21, 2008 at 3:59 PM

junmeng wrote:
I can compile and run PageFlowQuickStart solution in VS 2005, but when I try to open CustomerApprovalPageFlow workflow in VS design mode, it throws exception:

-------------------------------------------
Error 95 The type initializer for 'Microsoft.Practices.PageFlow.WorkflowFoundation.Activities.PageFlow' threw an exception.
-------------------------------------------

Could you tell me how to solve the problem?

Thanks a lot in advance!


I've found a {kinda rough} way to fix this effin' problem...

Just remove your PageFlow project of yor solution, then add it again.... it worked wonders for me :D
Coordinator
Feb 29, 2008 at 4:58 AM
Edited Feb 29, 2008 at 4:58 AM
There is a bug in the Workflow designer in VS2005. There is a fix available (sorry, I can't remember the link address off the top of my head, but it has been posted here in the Discussions before).
Once you install it, you should be much better off.

Michael Puleio - patterns & practices
Webhttp://msdn.microsoft.com/practices/
Bloghttp://blogs.msdn.com/mpuleio/