RobThree / NUlid

.Net ULID implementation
MIT License
364 stars 25 forks source link

1.7.0 return error with generated Ulid #18

Closed singdavid closed 2 years ago

singdavid commented 2 years ago

Hello!

First, thanks for your job!

When using the latest version 1.7.0 of NUlid, we have this error when generate and then parse NUlid code

Example with this : "01FTX9NB2FVWG9MYN7ZEE03HX0"

'new Ulid("01FTX9NB2FVWG9MYN7ZEE03HX0")' threw an exception of type 'System.ArgumentOutOfRangeException' ActualValue: null Data: {System.Collections.ListDictionaryInternal} HResult: -2146233086 HelpLink: null InnerException: null Message: "Index and length must refer to a location within the string.\r\nParameter name: length" ParamName: "length" Source: "mscorlib" StackTrace: " at System.String.Substring(Int32 startIndex, Int32 length)\r\n at NUlid.Ulid.Parse(String s)\r\n at NUlid.Ulid..ctor(String ulid)" TargetSite: {System.String Substring(Int32, Int32)}

We are using framework .NET 4.7.1 project

Thanks for your help !

RobThree commented 2 years ago

Could you please try 1.5.0 and let me know if that works for you? I tried the ULID you showed and it seems to work for me?

Maybe @cyrusdargahi has a clue what could be going on?

singdavid commented 2 years ago

Hello,

Sorry for the late response

Yes, we had to downgrade version 1.5.0 to make things works.

Thank you for your help

symbiogenesis commented 2 years ago

I think I fixed this here:

https://github.com/RobThree/NUlid/pull/19

RobThree commented 2 years ago

Thanks. See dfe70d0ce2d89c0eeb824476c45438b15659fbba