Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expiration date parsing exception not handled #26

Open
NoahStahl opened this issue Jul 19, 2015 · 4 comments
Open

Expiration date parsing exception not handled #26

NoahStahl opened this issue Jul 19, 2015 · 4 comments
Assignees

Comments

@NoahStahl
Copy link

When testing modifying the expiration date in the license file, it appears that the DateTime parsing exceptions are not handled and translated into a proper IValidationResult. Instead, an exception is thrown as soon as the result is accessed. An example exception: "String was not recognized as a valid DateTime because the day of week was incorrect."

I'm working around this by surrounding my validation check in a try block, but it would be nice for invalid expiration dates to trigger the normal "License signature validation error" message.

Great work, thanks for this!

@dnauck dnauck self-assigned this Jul 22, 2015
@dnauck
Copy link
Owner

dnauck commented Jul 22, 2015

Could you please post a complete stack trace of that exception?

@NoahStahl
Copy link
Author

Sure:

System.FormatException: String was not recognized as a valid DateTime because the day of week was incorrect.

Stack trace:

at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)
at System.DateTime.ParseExact(String s, String format, IFormatProvider provider, DateTimeStyles style)
at Portable.Licensing.License.get_Expiration()
at Portable.Licensing.Validation.LicenseValidationExtensions.b__1(License license)
at Portable.Licensing.Validation.ValidationChainBuilder.d__1.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

@sjdirect
Copy link

I'm having the same issue...

See related github issue here

<Expiration>Fri, 31 Dec 9999 23:59:59 GMT</Expiration>

This date blows up on just some of my customer's machines. I have not been able to repro on any environment. Below is a screenshot that one of them sent me.

c9129384-a70f-11e5-9b0e-774c8adc56ee
.

@sjdirect
Copy link

Looks like when you have a license with a expiration date of DateTime.MaxValue which is (Fri, 31 Dec 9999 23:59:59 GMT), some version of visual studio/.net fail. I was unable to replicate this on vs 2012, 2013, 2015 but other user's of my project were.

My solution was to generate a permanent license that expires in a 100 years instead of using DateTime.MaxValue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants