OpenNETCF.WinApi.Core.TIME_ZONE_INFORMATION

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!
 
P

Paul G. Tobey [eMVP]

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top