Feb 17, 2012 at 4:40 PM
Edited Feb 17, 2012 at 5:21 PM
I am attempting to zero in on an issue I am certain is mine, but can't figure it out. The issue happens when I am removing items that are in regions. Its a complex scenario so rather than get into the steps all I know is that prior to my issue
I can execute this
... which I use as my test.
As a test I sprinkle this line throughout my code until it throws an exception. The exception is an UpdateRegion Exception and I can see that it likely surfaces from PRISM Region manager's ContainsRegionWithName method within the call to UpdateRegions
... As I said, it is more than likely something that I am doing to cause this so I thought, why not add the PRISM project to my SilverLight project and attempt to debug through PRISM to trace through the issue. As you will read, I can't seem to add the
necessary PRISM source projects to my solution that would allow me to debug through this scenario.
To further understand my root-issue, the exception I am receiving relates to adding a Region, however at this point in my code, I am only removing a view from an existing region. The test I added was because later on in my logic, I remove that same
region and I was getting this same PRISM exception, again elluding to an error adding a region, when in fact I was removing a region. I looked at the PRISM source and notice that both Remove() and ContainsRegionWithName both call UpdateRegions() which
is why I decided to use the line "ContainsRegionWithName ..." as a test to see if I could narrow that scope down. I am not exactly sure what is causing my exception and so I am wanting to debug through PRISM to see.
The actual PRISM exception message is
Region with the given name is already registered:
Which seems to orginate from RegionManager.Add. Just prior to removing the view, I was able to excute my test line (i.e. call into RegionManager and test for whether or not ContainsRegionWithName returns true, which it always does, as that region is there).
I see it under debug watch. Also in the past when I have a situation such as this, I normally see an exception within Debug Watch but I do not see that here, all appears to be very normal. Again, I am certain this me but find it very odd that prior to removing
a view, that I do not receive any exception through this test, but only after a remove the view do I get it.
Further, why is UpdateRegions() calling through RegionManager.Add as a result of me sucessfully removing a view from a known region?
This seems a bit weird which is why I am keen to debug through the PRISM libraries to see what is causing the call to Add..
Unfortunately when I add the PRISM.SilverLight project to my solution I can sucessfully compile it and reference through my existing projects however when I attempt to compile my SilverLight applications I receive the following compile time error.
'Microsoft.Practices.Prism.Bootstrapper' is defined in an assembly that is not referenced
Many times in the past year I wanted to do the same, but always I hit this same issue, so I end up spending many hours/days debuging around PRISM when I know I'd get quickly to my error if I could debug through the PRISM assemblies.
Is there any guidance out there that illustrates what bits to include in my solution to allow me to debug the PRISM libraries?
I thank you in advance.