really wierd error

really wierd error

Old forum URL:

BunnyStrider posted on Friday, November 19, 2010


I have an error and I cannot figure it out.  The problem is that the error is happening on a substring called from the CSLA code base.

I think I'm working with CSLA 

The error is a screenshot of a messagebox of the error.ToString() and then truncated to fit on screen.  I cannot get the program to error out on my development machine only on the demo box.  


If you can't read this, basically System.Substring is getting passed an index value that is bigger than the string being substringed on.  The CSLA code is line 489 of CSLA\Core\BusinessBase

the code that's supposed to be calling that is:


      public new void Add(NoteNursingCarePlanInterventionChild child) {
            child.NursingCarePlanDiagnosisId = ForeignKey;


the main wierd thing is that this isn't happening on my dev box but the exact same error will happen every time on the demo box.  I'm just at a loss...if you can't help with the problem is there an easy way to debug on a client machine?  I guess that's my next step

Marjon1 replied on Friday, November 19, 2010

What is the syntax of your PropertyHasChanged() call within NursingCarePlanDiagnosisId?

When I've had obscure problems like this in the past, where it didn't occur for me on a dev box but did on the client, it was generally due to a difference in debug vs release build modes and the above call.

JonnyBee replied on Saturday, November 20, 2010

You need to look at the CanWriteProperty implementation and why you get a ArgumentOutOfRange exception there.

The implementation of property NursingCarePlanDiagnosisId is certainly calling CanWriteProperty(true) to check if the user is allowed to set the property value. So take a look at the code in CanWriteProperty.


BunnyStrider replied on Monday, November 22, 2010

I "fixed" this by setting the Add call when initially building the list to base.Add and only calling my implementation of .Add on additions made by the user through the UI implementation.  The CanWriteProperty implementation is CSLA code, I didn't override it or anything so...


Copyright (c) Marimer LLC