Jump to content
Mark Nicholson

Exception thrown when title begins or end with space character

Recommended Posts

If you try and set the title to a note to a string that has beginning or trailing spaces you get the following exception:

System.ArgumentOutOfRangeException 

If you take the sample C# cloud SDK program and modify the text of one of the titles of the new notes to add a trailing space and run it you will get the following:

System.ArgumentOutOfRangeException occurred
  HResult=0x80131502
  Message=Index and length must refer to a location within the string.
Parameter name: length
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at System.String.Substring(Int32 startIndex, Int32 length)
   at EvernoteSDK.String_ENScrubbing.EnScrubUsingRegex(String s, String regexPattern, Int32 minLength, Int32 maxLength, String invalidCharacterReplacement)
   at EvernoteSDK.ENNote.set_Title(String value)
   at TestEvernote.Program.Main(String[] args) in C:\Users\mark_\documents\visual studio 2017\Projects\TestEvernote\TestEvernote\Program.cs:line 37

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...