dasBlog 1.9 on Vista

I appreciate every keystroke of work that has gone into the development of this
blog engine. I also appreciate that moving forward with Windows is a fact of
life. I am not going to complain for a moment about the fact that a new OS caused
an error event. I will, however, use it as a warning to the rest of us.

If you try to run dasBlog on Vista you’ll get no joy. Because of this:


[NullReferenceException: Object reference not set to an instance of an object.]
newtelligence.DasBlog.Util.WindowsTimeZone.LoadTimeZonesFromRegistry() +283
newtelligence.DasBlog.Util.WindowsTimeZone..cctor() +

Developers, DO NOT access OS level resources in your applications
unless you want to see an error exactly like this one. Frameworks like the JDK
and CLR sufficiently abstract the OS upon which they are running, right up until you
call classes that start with namespaces like Microsoft.* and Sun.*.

Here is the offending code from dasBlog:

private static WindowsTimeZoneCollection
LoadTimeZonesFromRegistry() { WindowsTimeZoneCollection collection1 = new WindowsTimeZoneCollection();
RegistryKey key1 = Registry.LocalMachine.OpenSubKey(@"SOFTWAREMicrosoftWindows
NTCurrentVersionTime Zones", false); string[]
textArray1 = key1.GetSubKeyNames(); foreach (string text1 in textArray1)
{ RegistryKey key2 = key1.OpenSubKey(text1); WindowsTimeZone zone1 = new WindowsTimeZone(key2.GetValue("Display") as string,

key2.GetValue("Dlt") as string,
key2.GetValue("Std") as string,
(int)
key2.GetValue("Index"), key2.GetValue("TZI") as byte[]);
collection1.Add(zone1); } collection1.SortByTimeZoneBias(); return collection1;
}

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

The long form of the Registry class used in this method is: Microsoft.Win32.Registry

While the bad idea that is the registry persists in Vista, this registry key does not.
SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones

In parting, the Windows registry sucks, dasBlog does not. I have no doubt that
this port is already in progress. Right, Omar?

Proudly powered by WordPress | Theme: Code Blog by Crimson Themes.