CSLA and watch window workaround

CSLA and watch window workaround

Old forum URL: forums.lhotka.net/forums/t/8596.aspx

cmay posted on Monday, March 01, 2010

It seems I'm the only one who has posted about this issue over the last couple years, so maybe no one else views this as a pain, but I figure I'll post my workaround here.

I wrote a post a while back about my issues:

So for example I have a simple list called "projects" which is of type ProjectList containing ProjectListItems.

If I put "projects" in the watch window, for Value I get:

"Count = {System.TypeLoadException}"

If I put "projects(0)" in the watch window, I get:

{"The generic type 'System.Collections.ObjectModel.Collection`1' was used with the wrong number of generic arguments in assembly 'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.":"System.Collections.ObjectModel.Collection`1"}

Rocky's response was:

This is a known issue. I've actually talked to the VS debugger team about this, and they didn't have a satisfactory answer - and certainly not a solution. This issue has existed since 2005 when generics were introduced into .NET.

Well, after doing some digging I think I have come across a few workarounds.  I haven't tested these in a wide range of situations, but they worked when I was trying them in my last debugging session.

If I were to use the Watch Window and put:


it would throw an error.  But if I put:


then I get the correct result.

Also when picking a specific item:


I get the same exception.  However, if I use:


I get the object as expected!

bniemyjski replied on Tuesday, March 02, 2010


Whats an easy way for me to reproduce this, what BO Types are you using?


-Blake Niemyjski

cmay replied on Friday, March 05, 2010


Any businesslist  that I have fails to work as I described above in my post in the watch window when debugging.

This is from CSLA 2.0 to 3.8.  I've always had this issue the watch window.

JoeFallon1 replied on Wednesday, March 03, 2010

I saw it as a pain for the last few years too.

Nice tips, I will have to keep them in mind.



Copyright (c) Marimer LLC