InternalSubStringWithChecks Exception
We're getting this InternalSubStringWithChecks exception with our application's healthMonitoring.
This exception is like the Padding is invalid and cannot be removed exception where it's being recorded and we're getting a notification email but the end user is unaware that an actual error has happened. Though we don't want our event log filled开发者_高级运维 up with this rubbish!
The stack trace is:
Event message: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I can't find any useful info on what causes this and how to fix it via Google. Has anyone else encountered/fixed this?
You are calling the Substring() method with incorrect arguments. For example:
string a = "test";
a.Substring(0,100)
will throw an exception.
精彩评论