I have ran into an issue and I'm having troubles troubleshooting. I am using Prism and have created a CustomDialogService which will add a view to a dialogRegion dynamically through code.
In the shell I have a dialogRegion defined with an explicit name. I've verified that everywhere in xaml the regions have a regionName that isn't null or empty. When I add a view into the region I am providing a name (unique name via guid.NewGuid().ToString) each time.
My question is this... based on the below exception, how can I verify/validate which Region has a RegionName coming back null and what is the DelayedRegionCreationBehavior doing?
I would pre-emptively create this region if I knew what region its blowing up on.
Thanks for any debugging/troubleshooting tips:
-Daniel
When I call the dialog service I get an error on DelayedRegionCreationBehavior:
{"An exception occurred while trying to create region objects.
at Microsoft.Practices.Prism.Regions.RegionAdapterBase
at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName). ---> System.ArgumentNullException: Value cannot be null.
Parameter name: regionName
at Microsoft.Practices.Prism.Regions.RegionAdapterBase
at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName)
--- End of inner exception stack trace ---
at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName)
at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.TryCreateRegion()
at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.OnUpdatingRegions(Object sender, EventArgs e)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at Microsoft.Practices.Prism.Events.WeakDelegatesManager.Raise(Object[] args)
at Microsoft.Practices.Prism.Regions.RegionManager.UpdateRegions()'.
{"An exception occurred while creating a region with name ''. The exception was: System.ArgumentNullException: Value cannot be null.
Parameter name: regionName
at Microsoft.Practices.Prism.Regions.RegionAdapterBase
at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName). "}
Inner Exception -->
{"Value cannot be null.
Parameter name: regionName"}
In the shell I have a dialogRegion defined with an explicit name. I've verified that everywhere in xaml the regions have a regionName that isn't null or empty. When I add a view into the region I am providing a name (unique name via guid.NewGuid().ToString) each time.
My question is this... based on the below exception, how can I verify/validate which Region has a RegionName coming back null and what is the DelayedRegionCreationBehavior doing?
I would pre-emptively create this region if I knew what region its blowing up on.
Thanks for any debugging/troubleshooting tips:
-Daniel
When I call the dialog service I get an error on DelayedRegionCreationBehavior:
{"An exception occurred while trying to create region objects.
- The most likely causing exception was: 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Practices.Prism.Regions.Behaviors.RegionCreationException: An exception occurred while creating a region with name ''. The exception was: System.ArgumentNullException: Value cannot be null.
Parameter name: regionNameat Microsoft.Practices.Prism.Regions.RegionAdapterBase
1.Initialize(T regionTarget, String regionName)
at Microsoft.Practices.Prism.Regions.RegionAdapterBase
1.Microsoft.Practices.Prism.Regions.IRegionAdapter.Initialize(Object regionTarget, String regionName)at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName). ---> System.ArgumentNullException: Value cannot be null.
Parameter name: regionName
at Microsoft.Practices.Prism.Regions.RegionAdapterBase
1.Initialize(T regionTarget, String regionName)
at Microsoft.Practices.Prism.Regions.RegionAdapterBase
1.Microsoft.Practices.Prism.Regions.IRegionAdapter.Initialize(Object regionTarget, String regionName)at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName)
--- End of inner exception stack trace ---
at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName)
at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.TryCreateRegion()
at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.OnUpdatingRegions(Object sender, EventArgs e)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at Microsoft.Practices.Prism.Events.WeakDelegatesManager.Raise(Object[] args)
at Microsoft.Practices.Prism.Regions.RegionManager.UpdateRegions()'.
But also check the InnerExceptions for more detail or call .GetRootException(). "}
Inner Exception -->{"An exception occurred while creating a region with name ''. The exception was: System.ArgumentNullException: Value cannot be null.
Parameter name: regionName
at Microsoft.Practices.Prism.Regions.RegionAdapterBase
1.Initialize(T regionTarget, String regionName)
at Microsoft.Practices.Prism.Regions.RegionAdapterBase
1.Microsoft.Practices.Prism.Regions.IRegionAdapter.Initialize(Object regionTarget, String regionName)at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName). "}
Inner Exception -->
{"Value cannot be null.
Parameter name: regionName"}