OpenNETCF.WinApi.Core.TIME_ZONE_INFORMATION

  • Thread starter Thread starter Daniel Moth
  • Start date Start date
D

Daniel Moth

Hi

I was playing with the TimeZoneCollection and always got an
ArgumentException (emulator and CE device).. Turns out the value passed to
the DaylightName has loads of trailing nulls so the BlockCopy method throws
the exception... Inserting 1 line of code fixes it (for me anyway)...


public string DaylightName
set
{
value=value.TrimEnd(new char[]{(char)0});// FIXES ARGUMENT EXCEPTION

byte[] bytes = System.Text.Encoding.Unicode.GetBytes( value );
Buffer.BlockCopy(bytes, 0, flatStruct, daylightNameOffset, bytes.Length );
}

Cheers
Daniel

PS By the way, good work guys!
 
In fact, it's already fixed. Unfortunately, I fixed it just after the last
release went live (hours later)!

Paul T.

Neil Cowburn said:
Thanks for the heads-up, Daniel. We'll fix this ASAP.

--Neil


Daniel Moth said:
Hi

I was playing with the TimeZoneCollection and always got an
ArgumentException (emulator and CE device).. Turns out the value passed to
the DaylightName has loads of trailing nulls so the BlockCopy method throws
the exception... Inserting 1 line of code fixes it (for me anyway)...


public string DaylightName
set
{
value=value.TrimEnd(new char[]{(char)0});// FIXES ARGUMENT EXCEPTION

byte[] bytes = System.Text.Encoding.Unicode.GetBytes( value );
Buffer.BlockCopy(bytes, 0, flatStruct, daylightNameOffset, bytes.Length );
}

Cheers
Daniel

PS By the way, good work guys!
 
Back
Top