Action CreateModel failed to execute

Topics: General Discussion Forum, July and December Releases Forum, Service Factory Modeling Edition Forum
Jun 24, 2009 at 12:02 AM

Hi,

I am making some minor changes in the WSSF and when I am testing the modified factory i am recieving an error that I can't seem to resolve.  The error happens when I try to create a Host Model.  Error is below:

Microsoft.Practices.RecipeFramework.ActionExecutionException: An exception occurred during the binding of reference or execution of recipe CreateModel. Error was: Action CreateModel failed to execute:
Object reference not set to an instance of an object..
You can remove the reference to this recipe through the Guidance Package Manager. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Practices.ServiceFactory.Recipes.CreateModel.CreateModelAction.Execute() in C:\REBARSupport_Project\REBAR\Main\AWSSF\Service Factory Guidance Package\Guidance Package\Recipes\CreateModel\CreateModelAction.cs:line 107
   at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName, Dictionary`2 inputValues)
   at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName)
   at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionCoordinationService.Run(Dictionary`2 declaredActions, XmlElement coordinationData)
   at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments, IDictionaryService arguments, ITypeResolutionService resolution)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.RecipeFramework.Recipe.UndoExecutedActionsAndRethrow(Exception ex)
   at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments, IDictionaryService arguments, 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.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 did not make any modfications to this recipe or the Host designer.  I can successfully create a service contract model and a data contract model.  I can't seem to figure out why the Host Model is acting like this, the error refers to the following line of code:

itemPath = action.NewItem.Document.FullName;

Has anyone encountered this problem or have any ideas what may be wrong?

Thanks,

Matt

Jun 24, 2009 at 12:24 PM

Hi Matt,

This error as you pointed out, is comming from a recipe used in many places and is executed when you create a new model (DC, SC or HM) and is used to unfold a VS text template (in case of the host template is located at: Items\HostDesignerModel.vstemplate.. I don't know what was exactly the modification that you did so here a coule of sugestions:

- Try reseting the experimental hive and rebuildind your solution, then Register the Guidance Package.

- Try running this recipe in a clean solution where you only added a previously created DC and SC models.

If you still get the same error, try debugging this recipe where you can open a VS instace with the WSSF source solution and attach to an instance of VS with your failing solution. Then add a breack point to the error line and execute that recipe (Create a new Host model). Check which is the value in action.NewItem and action.NewItem.Document.

Regards,

Hernan  

 

Jun 24, 2009 at 4:53 PM

Hi Hernan,

I have tried the suggestions you have listed but I am still receiving the error.  I debugged this recipe and found that the Action.NewItem.Document is NULL.  Do you have any idea why this would be happening or can you give me some direction on where to look?  I did not make any modfications to this recipe or any of its supporting components, so it's kind of wierd that it just broke.  Is there some configuration that is related to this recipe that I can check to make sure I didnt inadvertently change something?

Thanks,

Matt

Jun 24, 2009 at 6:53 PM

You can check if all the files under "Guidance Package\Templates\Items" are fine (same as the originals). You can also check if you did not change any other file under "Recipes" folder in the Guidance Package project.

Can you also check the value of "action.NewItem" please?

Thanks, Hernan

 

Jun 24, 2009 at 7:46 PM

The value for Action.NewItem is {Microsoft.VisualStudio.Package.Automation.OAFileItem}.

There is no difference in the files under "Guidance\Templates\Items" when compared to the original source.  The only files uder "Recipes" that are different are the ones that I intentionally changed (binding.xml and CreateService.xml).  I changed thses files becuase we are limiting the developer to only use WCF so I commented out the CreateASMXServiceRef and CreateASMXClientProxyRef actions.  I modified the CreateService.xml becuase we are removing the BusinessLogic project and the DataAccess project from the factory so I commented out the actions and arguments that reference those.  Just to be sure, I undid those changes to make sure that was not the cause and I still recieved the error.

Thanks,

Matt

Jun 24, 2009 at 8:51 PM

Matt,

When you undid the changes, did you REset the hive and Rebuilt(Sln) and re-register the GP?

BTW, I guess that you are working in a box with only the source version installed (not Bin+Src) right? Which OS version and VS are you using?

Thanks, Hernan

Jun 24, 2009 at 8:58 PM

Hernan,

Yeah, I reset the experimental hive, re-built solution and then re-gistered the GP.  I only have the source installed.  My machine is running Windows Server 2008 with Visual Studio 2008.

Thanks,

Matt

Jun 25, 2009 at 4:25 PM

I just debugged a clean build+registration of the WSSF source sln and got these values in CreateModelAction recipe:

modelProject: {Microsoft.Practices.ServiceFactory.VsPkg.ModelProject.OAModelProject} 

This should point to your model project file like "FullName "D:\\Temp\\ClassLibrary3\\Project1\\Project1.ssfproduct"

action.NewItem: {Microsoft.VisualStudio.Package.Automation.OAFileItem} 

In this case, this should point to your host model file like "myHost.host".

The action.NewItem.Document should point to your host file as well but the ProjectItem will be of type "{Microsoft.Practices.ServiceFactory.VsPkg.ModelProject.OAModelProjectFileNode}".

 

Another options may include running under an admin cmd "DEVENV /SETUP" that will reset the VS package registration settings.