Plucking out some VB6 compatibility support from Microsoft.VisualBasic.Compatibility.dll noticed a bug or two withy PInvoke declarations:
Telerik:
[DllImport("oleaut32.dll", CharSet=CharSet.Unicode, ExactSpelling=true, SetLastError=true)]
internal static extern int VarFormat(IntPtr pvariant, ref string sFmt, int dow, int woy, int dwFlags, ref string sb);
Should be:
[DllImport("oleaut32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static extern int VarFormat(IntPtr pvariant, [MarshalAs(UnmanagedType.VBByRefStr)] ref string sFmt, int dow, int woy, int dwFlags, [MarshalAs(UnmanagedType.BStr)] ref string sb);
Telerik:
[DllImport("oleaut32.dll", CharSet=CharSet.Unicode, ExactSpelling=true, SetLastError=true)]
internal static extern int VarFormat(IntPtr pvariant, ref string sFmt, int dow, int woy, int dwFlags, ref string sb);
Should be:
[DllImport("oleaut32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static extern int VarFormat(IntPtr pvariant, [MarshalAs(UnmanagedType.VBByRefStr)] ref string sFmt, int dow, int woy, int dwFlags, [MarshalAs(UnmanagedType.BStr)] ref string sb);