"Add View (with presenter)" throws exception

Topics: User Forum
Jan 12, 2007 at 1:33 AM
Hi I'm getting the following exception when I click the "Add View (with presenter) button:

Microsoft.Practices.RecipeFramework.ValueProviderException: An exception occurred during the binding of reference or execution of recipe CreateView. Error was: An error happened while calling the value provider or evaluating the default value of argument ModuleInfos..
You can remove the reference to this recipe through the Guidance Package Manager. ---> System.ArgumentException: Value Microsoft.Practices.CompositeWeb.Configuration.DependantModuleInfo[] specified for argument ModuleInfos can't be converted to the argument type Microsoft.Practices.CompositeWeb.Configuration.DependantModuleInfo[].
at Microsoft.Practices.RecipeFramework.Services.DictionaryService.SetValue(Object key, Object value)
at Microsoft.Practices.RecipeFramework.Recipe.CallProviders(IDictionary providers, IDictionaryService readonlyArguments, IDictionaryService arguments, Boolean isBefore)
--- End of inner exception stack trace ---
at Microsoft.Practices.RecipeFramework.Recipe.CallProviders(IDictionary providers, IDictionaryService readonlyArguments, IDictionaryService arguments, Boolean isBefore)
at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)
at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)
at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(IAssetReference reference)
at Microsoft.Practices.RecipeFramework.RecipeReference.OnExecute()
at Microsoft.Practices.RecipeFramework.AssetReference.Execute()
at Microsoft.Practices.RecipeFramework.VisualStudio.RecipeMenuCommand.OnExec()
at Microsoft.Practices.RecipeFramework.VisualStudio.AssetMenuCommand.Invoke()

I'm using the latest drop (15) and the solution I'm getting this in is brand new. Any suggestions?
Jan 12, 2007 at 1:45 AM
Hmm, after restarting VS it worked but it might be a minor issue.
Jan 12, 2007 at 1:48 AM
Can't recreate... ignore for now.
Jan 18, 2007 at 12:51 AM
FYI: I just got exactly the same exception in the RTM version. Restarting Visual Studio also solved it for me.
Jan 18, 2007 at 2:09 PM
Hi

I am getting the same error message. Unfortunately neither restarting VS or rebooting fixed the problem. I also reinstalled the package with the same result. Any hints on how to solv this would be apriciated :)

TAG
Jan 21, 2007 at 10:46 AM
I have the same probleme.
Reboot and restart didn't change anything ...

Please Help
Jan 21, 2007 at 12:44 PM
The statement "DependantModuleInfo[] specified for argument ModuleInfos can't be converted to the argument type DependantModuleInfo[]" sounds to me like it is referencing the same DLL in two different places - i.e. they are exactly the same type, but for some reason the compiler thinks they are different.

Have you tried an uninstall and manual clean-up of anything and everything relating to beta and release versions of the factory? Remove the recipes, uninstall, clean up anything on the file system, registry, GAC, etc - I'm sure the p&p guys can advise best on where and when. Then reboot, reinstall, and retry? I know this sounds like the "have you tried rebooting sir?" default answer you get from a lot of helpdesks, but I still think it is worth a try :-)

Has anyone got anymore info on it - event log entries, assembly binding logs, etc, etc?
Jan 26, 2007 at 9:37 PM
OK, I've just had this error, and it is pretty wierd. I've done quite a lot of investigation, so I'll try and summarise;

- No amount of restarts of Visual Studio or recompiles sort the issue
- Rebooting the machine fixes it
- I have a suspicion it all started when there was a compile error in the solution I was using the "Add View (with presenter)" recipe in
- I fixed the compile error but it hasn't sorted the issue; I still get the exception as soon as I try to start the recipe in this "dodgy" solution
- If I restart my machine and create a new WCSF solution, the recipe works fine. The minute I open the dodgy solution that started all this and try and run the recipe, I get the error. Then the recipe won't work in any solution until I reboot.
- I've tried repairing, uninstalling, and reinstalling the whole factory
- I've tried creating modules with the same name in case it was a reserved word clash (does that smell of desperation?!)... doesn't seem to be


This makes me think something about the "dodgy" solution has caused the problem - perhaps the compile error, perhaps something else. Anyway, I'll package it up and send it to the p&p guys to see if they can find anything wrong with it.


I did try uninstalling the factory, and registering the Guidance Package from source, then attempting a debug. This showed that the code that the error sounds like it is referring to (ModuleInfoListProvider.OnBeginRecipe - or one of the methods it calls) is actually completing successfully - so my best guess is that is it what the Recipe framework is doing with the result of this method. Complete stab in the dark: is it that the list of dependant modules doesn't match the expected list? Such that the two arrays referred to in the above error are two different sizes? Hence the odd error message that two arrays of the same type are different types?


Hope that gets you somewhere. In the mean time, I'll avoid my suspect solution!

Simon
http://www.dotnetblogs.co.uk/
Jan 27, 2007 at 12:27 PM
Update to this; I've slept on it and had another go. These are the steps I've taken and observations;

1. Today I have had two solutions open concurrently; the "broken" one and another one that was created since the problem started occuring, but has never suffered from it itself. The broken solution still failed, the other never had a problem. This is contrary to my observation last night that stated once the broken one had caused the error all solutions fail - I don't know if I was tired and wrong or if this is just inconsistent behaviour!!

2. I decided that removing bits from the broken solution until it worked could be a useful approach... see following points.

3. I started out by copying the broken solution and opening it, then checking Add View still didn't work in the copy - it didn't.

4. I closed the solution and Visual Studio and opened the solution file in Notepad. I removed references to all the modules I had added, and reopened the solution in Visual Studio. It still failed with Add View. The only elements in this solution were the Shell module and the Dev Web Site (I deleted all module stuff from the web site too).

5. I then started comparing Web.config in the broken solution with web.config in the working solution, and found that the broken one still had references to page flow sections - I removed them. I then restarted Visual Studio, and tried the broken solution... it worked!!!

6. This made me think I knew what the problem was, so I made another copy of the broken solution, with all the original modules included.

7. I checked the problem still occurs in the copy - it did. I then removed the Page Flow settings from Web.config (including the connection string definition and http module entry), restarted Visual Studio, and retried. The problem was still there.

8. This means that it must be two things; the web.config settings and a module that I removed in my first experiment but hadn't in my second. So the likely culprit seemed to be the Page Flow module I had in the solution - so I removed it, restarted Visual Studio, tried again... it worked again.

OK, so apologies for the long winded explanation, but basically it boils down to this;

The problem can be resolved by removing a Page Flow project and the Page Flow settings in web.config (including connection string and http modules).

What you'll be pleased to know is that I then added my page flow module and configuration back into the solution and it still works :-)

Hope that gives you a temporary workaround (please let me know if it works for you) and the p&p guys a line of investigation.

Simon
http://www.dotnetblogs.co.uk/
Jan 27, 2007 at 7:55 PM
Simon,

Thanks for the update - you rock!

(This has definitely been a strange one.)

Tim
Coordinator
Jan 27, 2007 at 8:45 PM
Simon,
Thanks for the help narrowing this down. It should help us find a permanent fix.

As Tim said, you rock!
Jan 31, 2007 at 5:18 PM
I have been able to recreate this issue in following scenario. I have an other pc where I have not faced this issue.

I installed the Web Client factory for new clean XP development PC. I installed this under Administrator user-id (accidently) and created a new developer user-id in XP after installation, which I would use daily development purposes.

While logged in to new user-id, I noticed that the Program folder was not populated for newly created XP user-id. These only exist in original user (Administrator) I used to install the Web Client Factory.

I reinstalled the web client factory and was hoping that it will repair the missing program link. I was thinking maybe all necessary information is not available but didn’t check my visual studio.

Anyhow, I was surprised when I was able to get the new installation completed again in same machine by different user-id. Anyhow I was happy that I saw the Web Client Factory in Program Folder and I didn’t worry this that much.

Now, after creating an initial solution and trying add a new view I am getting Receipt Framework ErrorAn Error happend while calling the value provider or evaluating the default value of agument ModuleInfos..

I will try now to uninstall the version in both users and try to install it again with primary developer user.

Will post the outcome later…
Jan 31, 2007 at 6:09 PM
Edited Jan 31, 2007 at 6:17 PM
I was able to fix this problem in scenario I described above as following:

1. I uninstalled the Web Client Factory 2007 by using the Control Panel Add/Remove Program. This un-installation was carried by the newly created developer user-id that was holding an administrator rights.

2. I try to log in to original (out of the box) Administrator but it was not in the log in screen. So I needed to log in to Windows Safe mode and disable the new developer user-id in order to get access again in original Administrator User-id. I try to uninstall it in safe mode, but I fail there for the message indicating that safe mode can be used to uninstall this software.

3. Once I got back to original Administrator, and checked out the program list and I saw the Web Client Factory 2007 in the program list. (Comment:It should not be here anymore as I uninstall it by developer userid...)

4. I try to uninstall the Web Client Factory 2007, but I got two installation errors.

4.1 InstallUtilLib.DLL Unknown Error
4.2 Fatal error during the installation.

5. So, I reinstalled the Web Client Factory 2007 again although it was still in program list. This installation process didn’t even ask if I want to repair the existing one.

6. After installing successfully the Web Client Factory 2007 I try to uninstall it by using the Control Panel Add/Remove Program. I did manage to remove it normally.

7. I enable the developer user-id and log out from the original administrator.

8. I reinstall the Web Client Factory 2007 by using the Developer user-id which has Administrator rights.

9. I created a new Solution and added successfully a new view (with Presenter)...


Hope this help on this issue...

Alexander
Mar 6, 2007 at 2:28 PM

simonince wrote:
Update to this; I've slept on it and had another go. These are the steps I've taken and observations;

1. Today I have had two solutions open concurrently; the "broken" one and another one that was created since the problem started occuring, but has never suffered from it itself. The broken solution still failed, the other never had a problem. This is contrary to my observation last night that stated once the broken one had caused the error all solutions fail - I don't know if I was tired and wrong or if this is just inconsistent behaviour!!

2. I decided that removing bits from the broken solution until it worked could be a useful approach... see following points.

3. I started out by copying the broken solution and opening it, then checking Add View still didn't work in the copy - it didn't.

4. I closed the solution and Visual Studio and opened the solution file in Notepad. I removed references to all the modules I had added, and reopened the solution in Visual Studio. It still failed with Add View. The only elements in this solution were the Shell module and the Dev Web Site (I deleted all module stuff from the web site too).

5. I then started comparing Web.config in the broken solution with web.config in the working solution, and found that the broken one still had references to page flow sections - I removed them. I then restarted Visual Studio, and tried the broken solution... it worked!!!

6. This made me think I knew what the problem was, so I made another copy of the broken solution, with all the original modules included.

7. I checked the problem still occurs in the copy - it did. I then removed the Page Flow settings from Web.config (including the connection string definition and http module entry), restarted Visual Studio, and retried. The problem was still there.

8. This means that it must be two things; the web.config settings and a module that I removed in my first experiment but hadn't in my second. So the likely culprit seemed to be the Page Flow module I had in the solution - so I removed it, restarted Visual Studio, tried again... it worked again.

OK, so apologies for the long winded explanation, but basically it boils down to this;

The problem can be resolved by removing a Page Flow project and the Page Flow settings in web.config (including connection string and http modules).

What you'll be pleased to know is that I then added my page flow module and configuration back into the solution and it still works :-)

Hope that gives you a temporary workaround (please let me know if it works for you) and the p&p guys a line of investigation.

Simon
http://www.dotnetblogs.co.uk/



FYI: This solution worked for me as well. I had to remove the page flow project restart Visual Studio, add the view, and then add the page flow project back.
Mar 7, 2007 at 11:35 PM
I just installed the Guidance Package and got the same exception.

The solution created had no reference to page flow in the web project's web.config and no page flow project.

After adding a page flow project, there's still no page flow in the web project's web.config and I still get the exception.
Mar 12, 2007 at 2:07 PM
I had the same problem.

I just removed the pageflow project from the solution.
I had it again in the solution. (Restart before and after this)

And it works
Coordinator
Mar 13, 2007 at 3:08 PM
Hi all, I'm glad to tell you that we've found a fix for this issue.
I'd like to thank Simon Ince, his attached solution was of great help for debugging purposes.

Follow this link to get the solution to the issue: http://www.codeplex.com/Wiki/View.aspx?ProjectName=websf&title=AddViewPresenterException

If you know what what happening behind the scenes, read my blog post: http://staff.southworks.net/blogs/jdominguez/archive/2007/03/13/WCSF_3A00_-Add-View-_2800_with-Presenter_2900_-fix.aspx

Let me know how this works for all of you,
http://staff.southworks.net/blogs/jdominguez
Mar 13, 2007 at 7:21 PM
Fantastic news - good work guys!

Thanks for the credit - but to be honest all I did was zip up the solution I couldn't fix and let the p&p team do the hard work :-)
Apr 20, 2007 at 11:17 PM
Hi,

I have applied the patch but am still getting this error. I am using the WAP version of the WCSF. With that in mind I also applied this fix to the CreateWebClientFactoryView.xml in all the directories that it appeared in, namely under the WebClientFactorWAPSupport.

And the error is still occurring. Do I need to recompile and reregister?
Apr 21, 2007 at 10:05 AM
Here is some more pertinent info.

Using the WAP block, it creates a strong named reference to the CompositeWeb.dll in the module and in the web client. But yet the fix lists the CreateWebClientFactoryView.xml as having a "NULL". These references are in the "MyProject .. \Library folder. Somehow the dll's in this directory are strong named. Perhaps a compile of the WAP block with strong named DLLs??

So I'm guessing the NULL in the CreateWebClientFactory.xml is not jiving with the strong named DLL's references of the project. And poof we are back to the original problem. I'm just not sure of the fix. Re-add the reference to non strong named DLLs or do I sign everything.

Or does my theory fall apart completely...wouldn't be the first time.

Apr 22, 2007 at 8:30 PM
I was unable to get this fix to work. The same symptoms occurred. However, when I edited the CreateWebClientFactory.xml using the public key token (31bf3856ad364e35) instead of "null" it worked flawlessly. In other words, use the following line
Microsoft.Practices.CompositeWeb.Configuration.DependantModuleInfo[], Microsoft.Practices.CompositeWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

If the problem really is related to the inability to find the correct assembly, using a null for public key token will not resolve the issue.
Apr 23, 2007 at 4:39 PM
I've applied the fix you suggested and am still getting the same error, even after rebooting. I changed the xml file in the following locations:

C:\Program Files\Microsoft Web Client Factory\WCSF Guidance Package\Recipes
C:\Program Files\Microsoft Web Client Factory\Source Code\GP\WebClientFactory\WebClientFactoryPackage\Recipes
C:\Program Files\Microsoft Web Client Factory\Source Code\GP\WebClientFactoryWAPSupport\WebClientFactoryPackage\Recipes
C:\Program Files\Microsoft Web Client Factory\Source Code\GP\WebClientFactoryWAPSupport\WebClientFactoryPackage\bin\Debug\Recipes

At this point, I'm not sure what else to try. Thinking maybe I need to change the xml back to "null" and add references to this dll that are not strong named.
Coordinator
Apr 23, 2007 at 6:40 PM
Hi mwaldrop,
you should change them back to null, because the GP does not use the strong named assemblies in the source code. Then register the package again and it should work. Be sure to reference the strong named assemblies in your target solution (the ones that comes in the C:\Program Files\Microsoft Web Client Factory\Microsoft Practices Library folder should be in your solution's Library folder).

As a side note, this issue will be fixed for good in the upcoming WCSF 1.1 release without the need of this temporary workaround.

Let me know if this helps,
Julián Domínguez
http://staff.southworks.net/blogs/jdominguez
Apr 23, 2007 at 7:01 PM
I put them all back as null, rebuilt/registered the package. I made sure that all the references are pointing at the strong named dll's in the library folder of my solution. But I am still getting this error.

I guess I will have to wait til version 1.1 comes out. Thanks for everyone's help on this. But I don't seem to be getting anywhere with this. I guess I could write the prenter/view manually but that kinda defeats the purpose. I will keep playing with it. Maybe I'm missing something really/really simple.
Apr 23, 2007 at 7:20 PM
Well, I created a brand new WAP solution and the "add view/presenter" seems to be working with this new one. Wonder why it doesn't work with the existing one. Interesting. I will have to delete and redo the project that I have been working with but as long as it's working I guess.

Thanks for your help.
Apr 23, 2007 at 9:45 PM
I have had the same problem on a couple of projects. It is almost as if the problem can be project specific.

I was thinking it might have something to do with the .gpState file associated with projects or perhaps in the .csproj file itself, but I haven't had the time to explore.

Regards,

Dave

____________________

David Hayden
Microsoft MVP C#
Apr 23, 2007 at 10:07 PM
You might be right. I deleted my project and redid the whole thing again. I added 5 different view/presenters to it with no problem. A couple of hours later I went to add another view/presenter and now the problem is back again.

Frustrating to say the least.
Coordinator
Apr 30, 2007 at 5:09 PM
I posted a working fix for this issue, please check out my blog post here WCSF: Add View (with Presenter) definite fix

Please let me know if this helps,
Julián Domínguez
http://staff.southworks.net/blogs/jdominguez
May 1, 2007 at 5:36 PM
My experience in installing the fix provided by Julian is that you should try to compile the WCSF and resolve any compilation errors before installing the fix. I had an issue where the GAT/GAX referenced by WCSF were older than what was installed.

Also, after registering the new package, remove any .gpstate files in the project directories.
May 23, 2008 at 1:24 PM
Edited May 23, 2008 at 1:34 PM

I am experiencing the same issue:

The following error I get when I want to add a view with presenter to a project:
Error:

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Practices.CompositeWeb, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Practices.CompositeWeb, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase)
   at Microsoft.Practices.Common.Services.TypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
   at Microsoft.Practices.Common.Services.AliasResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
   at Microsoft.Practices.Common.Services.TypeResolutionService.GetType(String typeName, Boolean throwOnError)
   at Microsoft.Practices.RecipeFramework.GuidancePackage.EnsureInitializeMetadataForCurrentRecipe()
   at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)
   at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(IAssetReference reference)
   at Microsoft.Practices.RecipeFramework.RecipeReference.OnExecute()
   at Microsoft.Practices.RecipeFramework.AssetReference.Execute()
   at Microsoft.Practices.RecipeFramework.VisualStudio.RecipeMenuCommand.OnExec()
   at Microsoft.Practices.RecipeFramework.VisualStudio.AssetMenuCommand.Invoke()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

This error also has an impact when you do disable the Web Client Software Factory February 2008.
After that IT CANT BE ENABLED ANYMORE.

The following error occurs when I try to enable the WCSF February 2008 package right after I disabled it:
Error: 
Microsoft.Practices.RecipeFramework.ValueProviderException: An exception occurred during the binding of reference or execution of recipe BindingRecipe. Error was: Failed to load value providers..
You can remove the reference to this recipe through the Guidance Package Manager. ---> System.TypeLoadException: Could not load type 'Microsoft.Practices.WebClientFactory.ValueProviders.VBInstallationCheck' from assembly 'Microsoft.Practices.WebClientFactory.GuidancePackage, Version=1.0.2720.24284, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
   at System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase)
   at Microsoft.Practices.Common.Services.TypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
   at Microsoft.Practices.Common.Services.AliasResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
   at Microsoft.Practices.Common.Services.TypeResolutionService.GetType(String typeName, Boolean throwOnError)
   at Microsoft.Practices.RecipeFramework.Recipe.GetInstance[T](ITypeResolutionService resolution, String concreteType)
   at Microsoft.Practices.RecipeFramework.Recipe.LoadProviders(ITypeResolutionService resolution)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.RecipeFramework.Recipe.LoadProviders(ITypeResolutionService resolution)
   at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)
   at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)
   at Microsoft.Practices.RecipeFramework.RecipeManager.Add(IComponent component, String name)
   at System.ComponentModel.Container.Add(IComponent component)
   at Microsoft.Practices.RecipeFramework.RecipeManager.EnablePackage(XmlReader configuration)
   at Microsoft.Practices.RecipeFramework.RecipeManager.EnablePackage(String packageName)
   at Microsoft.Practices.RecipeFramework.PackageManagement.EnableDisablePackages.OnOkClick(Object sender, EventArgs e)


Closing and restarting Visual Studio sometimes works but not always.

This is what works for me now:
These are the steps I use when I want to make the ENABLING of the WCSF February 2008 package possible again:
- disable the package “Web Client Software Factory February 2008”
- unload all the projects in the solution except the Shell project (sometimes it is enough to unload the project where you want to add the presenter to)
- Do a Rebuild and Clean of the solution
- Close the visual studio instance
- Open a new visual studio and open the solution
- Enable the package “Web Client Software Factory February 2008”
- reload the unloaded projects


Additional info:
- I use Visual Studio 2008 RTM
- I have the Page Flow Guidance installed from wcsfcontrib


Kind regards,
Wim