Groups | Blog | Home
all groups > dotnet compact framework > may 2007 >

dotnet compact framework : Opennetcf DeleteSubKey "bug"?


dbgrick
5/23/2007 7:53:00 PM
You might want to reconsider the OpenNETCF key stuff and just use the
Microsoft.Win32 Registry classes directly. There are some good examples of
their use on MSDN, and you reduce all of the OpenNetCF overhead.

Rick D.
Contractor

[quoted text, click to view]
ctacke/
5/23/2007 8:44:18 PM
A few things:

1. You might log this as a bug in our issue database
(bugzilla.opennetcf.com) - probably far greater chance of support if it's
there.

2. If you open the key with more that read access does the behavior change?

3. If you flush the key before delete does the behavior change?

4. What kind of device is this? Does it have a hive-based registry?


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com



[quoted text, click to view]

James Caan
5/24/2007 2:29:38 AM
Hello

I have problem deleting a subkey which I've create some seconds before:

Dim x As OpenNETCF.Win32.RegistryKey
x = OpenNETCF.Win32.Registry.LocalMachine.OpenSubKey("Software")
x.CreateSubKey("Test")
System.Threading.Thread.Sleep(10000)
x.DeleteSubKey("Test")

This is throwing an error "The specified subkey is not a valid reference to
a registry key"

The interesting thing is, if I wait several minutes, I can delete the
subkey...

Why?

Thanks

James
James Caan
5/24/2007 2:54:06 AM
Hi and thanks for your reply

I have now the following code:

Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem1.Click
Dim y As OpenNETCF.Win32.RegistryKey
y = OpenNETCF.Win32.Registry.LocalMachine.OpenSubKey("Software",
True)
y.DeleteSubKey("Test")
y.Flush()
y.Close()
MsgBox("Done")
End Sub

Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem2.Click
Dim x As OpenNETCF.Win32.RegistryKey
x = OpenNETCF.Win32.Registry.LocalMachine.OpenSubKey("Software",
True)
x.CreateSubKey("Test")
x.Flush()
x.Close()
MsgBox("Done")
End Sub

The interesting thing is: If I use MenuItem2_Click to create the subkey, and
then MenuItem1_Click to delete it, I get the error message. But if I close
my application after creating the SubKey, and then restart it and directly
use MenuItem1_Click, it is deleting the Subkey without any problems...

Devices ar HTC Artemis and HTC Universal, both with WM 5.0

<ctacke/>" <ctacke[at]opennetcf[dot]com> schrieb im Newsbeitrag
news:%23uEY0yZnHHA.3888@TK2MSFTNGP03.phx.gbl...
[quoted text, click to view]
James Caan
5/24/2007 2:54:52 AM
Btw. Setting Writeable to True while opening the Key doesnt solve the
problem...


"<ctacke/>" <ctacke[at]opennetcf[dot]com> schrieb im Newsbeitrag
news:%23uEY0yZnHHA.3888@TK2MSFTNGP03.phx.gbl...
[quoted text, click to view]
ctacke/
5/24/2007 9:17:50 AM
A good idea if you're on CF 2.0. If you're using CF 1.0 then the registry
stuff isn't there.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com


[quoted text, click to view]

AddThis Social Bookmark Button