Troubleshooting ILM Group Populator language dependencies

Within the scope of Provisioning and Workflow, group management makes part of the Microsoft Identity & Access Management Series solution accelerator. At the same page you’ll find a download link.

Originally the solution was shipped to support MIIS 2003 (.NET Framework 1.1).

With the upgrade/update to ILM 2007 (MIIS 2003 SP2) the Group management solution had to be upgraded to .NET Framework 2 before it could be used.

Keith Crosby documented the procedure very well on his blog (The Crosby Blog: Using the Group Populator application with ILM 2007 FP1).

An important addition to Keith’s procedure is that you better add the Web designer component to Visual Studio before you start converting and compiling the solution.

Never had a problem with the group populator in other setups.
Until suddenly a demo setup crashed on a malicious combination of regional settings, code page, language settings…

I changed the default regional settings en-uk to Dutch/Belgian, Dutch/Dutch, French/Belgian. 😉

Except for some non-critical warnings, the solution did rebuild without problems.

But running the group populator resulted in an error message: “Error btnAddRow_Click: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The statement has been terminated.

image

Also other buttons and selections, resulted in the same error:

  • Error btnSave_Click:
  • Error btnAddRow_Click:
  • Error dgGroupDefinitions_DeleteCommand:

Every time with the same error body : “The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The statement has been terminated”.

After some intensive troubleshooting, the error seemed to be coming from the underlying SQL Server, which had a problem with the time format that was written into the database.

But finally, the group management web application itself was the source of the trouble and the key to the solution.

 

In different places of the code, a time stamp is written to the database using the (VB.NET) date.now function.

But without formatting the result of that function can vary depending the system settings….

And if that format doesn’t match the date/time format SQL expects, you’re in trouble.

How did we solve this?

1. In every page within the solution, using the date.now statement: add the “Imports System.Globalization” call on top. That allows to use the culture info.

2. Change the date.now code definition to  Date.Now.ToString(CultureInfo.CurrentUICulture).

More info on CultureInfo.CurrentCulture and CultureInfo.CurrentUICulture.

Repeat this procedure for the GroupPopulator.exe solution.

But be careful. Only replace the date references in the composition of the SQL statements.

The grouppopulator.exe solution also uses a date variable (theCurrentTime) to store the date.now.
Leave the original declaration (Dim theCurrentTime As Date = Date.Now), you can’t put a string in a date variable…

You must add the string conversion for that variable when used in the SQL statement composition.

eg. theCurrentTime -> theCurrentTime.ToString(CultureInfo.CurrentUICulture)

AND LAST BUT NOT LEAST :

THANK YOU, PIETER, collegue of mine, for your great expertise helping me out on troubleshooting the VB.NET code…

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s