Categories
NETCF

Bug in OpenNETCF.VisualBasic GetSetting

A fairly obvious bug managed to go unnoticed in the GetSetting method for about 18 months. The problem is fairly straight-forward – the method will never return a value if one is found (if not present it returns the default value you supply).


I’ve fixed it for the next version, but what are you options for working around the issue with current code:-



  • Use the RegistryKey directly instead – OpenNETCF.Win32.RegistryKey directly matches the .NET v2.0 version so any code you write against this is very portable.

  • Use the attached updated OpenNETCF.VisualBasic.dll. However in order for this method to work you will have to manually copy the dll to your program folder, and make sure your reference points to this version of the dll – 1.4.51101 OpenNETCF.VisualBasic.zip (3.61 KB)

  • Grab the updated code from the Vault and build the code into your own dll/executable and call that instead of the OpenNETCF.VisualBasic version.

It would be interesting to get some feedback on whether people are actually using this VB specific functionality, and if so how useful you find it, and what else you would like to see in future versions…

By Peter Foot

Microsoft Windows Development MVP

2 replies on “Bug in OpenNETCF.VisualBasic GetSetting”

Hi Peter,

I’ve done what you said in your Blog and now get an error. Please see
below.

An unhandled exception of type ‘System.TypeLoadException’ occurred in
Pandora4.exe

Additional information: Could not load type
OpenNETCF.VisualBasic.Interaction from assembly OpenNETCF.VisualBasic,
Version=1.4.51101.0, Culture=neutral, PublicKeyToken=null.

Sorry I’m a bit new with some of this stuff.

Does that mean anything to you ?

Regarding comments for the vb related stuff in sdf I have found it useful as Iampretty new to .Net and the compact framework so this has/will help me as I am very familiar with vb v6.0

Thanks

Anbeyon

You’ll need to manually copy the OpenNETCF.VisualBasic.dll to your output folder, a quick and easy way is to right click your project, select add existing item, select "all files" from the filter and then browse to where you put this dll. Once you’ve added it to the project click it in the solution tree and check the Properties window and make sure BuildAction is set to "Content" – this will ensure it’s copied to the same folder as your exe

Peter

Comments are closed.