Sudip1

Here's the situation.

I have a XAML only workflow in a C# project (A). The workflow references custom activities (derived from Activity etc) that are built in a separate project (B) in the same solution. The reference is via a namespace reference in the workflow XAML.

(......xmlns:ns0="http://ABC/ActivityLibrary....)

Project (A) has a reference to the dll generated by Project (B). It's a direct reference - the reference is created by pointing to ProjectB.dll in a common directory.

One of the types in (B) contains the following directive to map the namespace identifier to the assembly

[assembly: XmlnsDefinition("http://ABC/ActivityLibrary", "ABC.UI.ActivityLibrary")]

I open Visual Studio and build the solution. I try to open the workflow XAML in the designer and get the dreaded CreateInstance exception complaining about the custom activity. Then, I touch the file containing the custom activity in project (B) and build that project. Now, I can open the workflow XAML in the designer. This happens every time.

When I remove my custom type from XAML and use System.Workflow... types, then I don't run into this problem and the designer can load the workflow after opening Visual Studio - without building.

So, the question is - why can't Visual Studio resolve the custom type the first time. And what is it about building Project (B) that allows the type to be resolved.

Eagerly waiting for an answer.

Thanks.

Sudip



Re: Windows Workflow Foundation CreateInstance failed

Sudip1

Forgot to mention, I'm running the final release version of WF.



Re: Windows Workflow Foundation CreateInstance failed

kushals

Sudip -

Thanks for bringing this to our notice, We are investigating a similar issue and would surely like to take a look at your Project to understand to understand more about the issue. Can you share with us a stripped down version of your project

Thanks,

Kushal.






Re: Windows Workflow Foundation CreateInstance failed

kushals

Hi Sudip -

Could you figureout the problem If nto can you please send us some code/project

Thanks,

Kushal.






Re: Windows Workflow Foundation CreateInstance failed

Sudip1

Hi Kushal,

Where would you like me to send the project to

Sudip





Re: Windows Workflow Foundation CreateInstance failed

kushals

We cant post our email address at the community site. Send me yours and I will reply there...

Thanks,

Kushal.






Re: Windows Workflow Foundation CreateInstance failed

Sudip1

Email me at sudipcha@yahoo.com



Re: Windows Workflow Foundation CreateInstance failed

Dan_Mac

We are also having the same problem and it is driving us crazy. I see Angel Azcarraga has also been looking at this problem and it appears that this was a known issue as long as a year ago in the forums. I would appreciate receiving any information regarding a solution ofr this and hope it will be posted on the forum as well. Thanks, dkmcintyre1@mmm.com



Re: Windows Workflow Foundation CreateInstance failed

kushals

Have taken it offline with both the customers. As soon as they send me in their solutions we will look into it and try to get their issues resolved.

Thanks,

Kushal.






Re: Windows Workflow Foundation CreateInstance failed

Sudip1

Hi Kushal,

Please let me know if you've sent any email to sudipcha@yahoo.com. I can reply to it with a solution. Thanks.

Sudip





Re: Windows Workflow Foundation CreateInstance failed

kushals

Yes - I have.

Kushal.






Re: Windows Workflow Foundation CreateInstance failed

Sudip1

Kushal,

I think I've figured out why the problem is happening. When I created a stand alone version - with no dependencies on our application dll's - then I can't get the problem to occur.

So I opened fuslogvw and recorded assembly binding failures on my actual app - when I try to load the workflow in the designer. The problem is that - when Visual Studio tries to load the dependent assemblies for the workflow, it's probing directories that are under the VS installation. Naturally, it doesn't find the assembly there. When I copy all my assemblies to [VS InstallationDir]/Microsoft Visual Studio 8/Common7/IDE/PrivateAssemblies then the designer opens the workflow fine the first time.

Obviously, copying our private assemblies to VS installation - is not a workable solution. I tried adding the assemblies as references to the VS project which contains the workflow.xaml file, but that doesn't help either.

Sudip

===========================================================================

Here's a binding failure snippet for one dll from fuslogvw.

*** Assembly Binder Log Entry (2/2/2007 @ 11:16:54 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = METRATECH\schakraborty
LOG: DisplayName = AccountCredit.interop, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b52c5f0e359141dc
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe.Config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: AccountCredit.interop, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b52c5f0e359141dc
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/AccountCredit.interop.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/AccountCredit.interop/AccountCredit.interop.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/PublicAssemblies/AccountCredit.interop.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/PublicAssemblies/AccountCredit.interop/AccountCredit.interop.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/PrivateAssemblies/AccountCredit.interop.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/PrivateAssemblies/AccountCredit.interop/AccountCredit.interop.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/AccountCredit.interop.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/AccountCredit.interop/AccountCredit.interop.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/PublicAssemblies/AccountCredit.interop.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/PublicAssemblies/AccountCredit.interop/AccountCredit.interop.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/PrivateAssemblies/AccountCredit.interop.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/PrivateAssemblies/AccountCredit.interop/AccountCredit.interop.EXE.
LOG: All probing URLs attempted and failed.





Re: Windows Workflow Foundation CreateInstance failed

Sudip1

The other problem - while you guys are thinking about this - is that the designer locks the dll and they don't get unlocked even if you close the designer. The only way to update those dll's is to shut down VS. This could be solved by ShadowCopying the dll's.

Sudip





Re: Windows Workflow Foundation CreateInstance failed

Dan_Mac

Hello Kushal,

I tried creating a simple test workflow but could not create the problem. I also tried the suggestion in this thread to put the assembly in the VS private assembly directory and this did not help. Perhaps our problem is due to something in the activities themselves. When we do builds we sometimes see an error message which does not affect the build results.

We get this error in the build with no file indicated but with Column 6 and Line 418

System.Workflow.ComponentModel.Serialization.WorkflowMarkupSerializationException: CreateInstance failed for type 'Mmm.Mesa.Workflow.Mswf.Activities.GetItemGroupTemplateActivity'. Exception has been thrown by the target of an invocation..

The last part of this error message is what we see when we try to open the designer and fail to open due to a CreateInstance exception.

CreateInstance failed for type 'Mmm.Mesa.Workflow.Mswf.Activities.GetItemGroupTemplateActivity'. Exception has been thrown by the target of an invocation..

Are there any clues in this information which we should look into

Thanks,

Dan McIntyre