Troubleshooting ILM Group Populator Language Dependencies

 

Introduction

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.

Regional settings dependency

 

When you use the en-us regional settings, you'll probably never have a problem with the group populator setup.

But when you change the serer regional settings, code page, language settings, the group populator might crash.
(I've running deployments with EN-UK,  NL-BE, NL-NL, FR-BE combinations...
Except for some non-critical warnings, the solution will rebuild without problems.

But running the group populator might result 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.

https://uyl8dg.bay.livefilestore.com/y1m6qRP5jBb9GTxAsIN-UE_sF8Dr0BO7ZcXWZAuSo0wVXrbm6l6cpaY1jwJ1h0gGMh2djSCox3DtwR0JBMbLjmM0rXuUZ0ht6vxB2DPCyUDbNVRSanbZtkc4GRe-QIFewMvN_yUYa7u4ec/image_thumb%5B2%5D.png
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 to solve this?

 

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

 /../'/////////////////////////////////////////////////////////////////////////////Imports System.Data.SqlClient ImportsSystem.Diagnostics Imports System.Globalization Namespace gp  /../ 

2. Change the date.now code definition to  Date.Now.ToString(CultureInfo.CurrentUICulture), when it's used to compose SQL statements, like

 

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), because you can't put a string in a date type variable...

But you should add the string conversion for that variable when it's used in the SQL statement composition.
eg. theCurrentTime -> theCurrentTime.ToString(CultureInfo.CurrentUICulture)

http://c.statcounter.com/6407957/0/1d35c305/1/