I've encountered a problem while testing the network time validation. My test:
The license-file that I was testing was already expired
I've set my clock to a day before the license expire date
Loading the license and calling 'AssertValidLicense'
When I noticed that I didn't get any exception, I started digging..
I noticed that the exception gets lost in the sntp.BeginGetDate-thread. I don't know if i'm doing something wrong, but to continue my testing I've added a quick fix (I'm struggling with inserting code, but you'll get the point):
`
private void ValidateUsingNetworkTime()
{
if (!NetworkInterface.GetIsNetworkAvailable())
return;
bool isLicenseValid = true;
ManualResetEvent timeRequestDone = new ManualResetEvent(false);
var sntp = new SntpClient(GetTimeServers());
sntp.BeginGetDate(time =>
{
if (time > ExpirationDate)
isLicenseValid = true;
timeRequestDone.Set();
}
, () =>
{
/* ignored */
});
timeRequestDone.WaitOne();
if (!isLicenseValid)
RaiseLicenseInvalidated();
}`
I've encountered a problem while testing the network time validation. My test:
When I noticed that I didn't get any exception, I started digging.. I noticed that the exception gets lost in the sntp.BeginGetDate-thread. I don't know if i'm doing something wrong, but to continue my testing I've added a quick fix (I'm struggling with inserting code, but you'll get the point):
` private void ValidateUsingNetworkTime() { if (!NetworkInterface.GetIsNetworkAvailable()) return;