开发者

InternalSubStringWithChecks Exception

开发者 https://www.devze.com 2023-01-06 16:29 出处:网络
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 re

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号