Re: bug found in Microsoft.Win32.RegistryValueKind.DWord conversio
- From: José Manuel Agüero <chema012 en hotmail.com>
- Date: Fri, 3 Mar 2006 16:28:05 +0100
I think you shouldn't be able, as long as UInt32 is not CLS compliant (it's only my opinion).
Why don't you use bitconverter to convert it to Int32 and then save it to the registry?
Regards.
"Ben Wilson" <BenWilson@xxxxxxxxxxxxxxxxxxxxxxxxx> escribió en el mensaje news:8C32C515-4933-4B3D-84CE-38D5B2B42F4C@xxxxxxxxxxxxxxxx
| The registry DWORD can store values up to 0xFFFFFFFF or 4294967295, yet there
| is no way to assign this, and this is the bug.
|
| Using an int or uint works, however it will not accept values higher than
| 0x7FFFFFFF or 2147483647, which is the maximum positive value of an int.
|
| I believe it is impossible to to successfully assign a registry dword value
| > 2147483647 programmaticlly through the Registry.LocalMachine.SetValue
| method, and this is the bug, as you *should* be able to do this.
|
| "José Manuel Agüero" wrote:
|
| > Hello Ben,
| >
| > You are trying to store an Int32 that is grater than Int32.MaxValue.
| > The registry do not store UInt32 values; you have to convert it before writing and after reading from the registry to a supported type.
| > For a list of supported types, see:
| > RegistryValueKind Enumeration
| > http://msdn2.microsoft.com/en-us/library/microsoft.win32.registryvaluekind(VS.80).aspx
| >
| > Regards.
| >
| >
| > "Ben Wilson" <BenWilson@xxxxxxxxxxxxxxxxxxxxxxxxx> escribió en el mensaje news:AD3D0BF7-8CEA-4AAD-91B4-111B6C5B54CB@xxxxxxxxxxxxxxxx
| > |I have found what I can only conclude to be a bug in .net after days of
| > | messing around. I am trying to assign a large value to a registry dword
| > | entry close to it's limit of 4294967295 or 0xFFFFFFFF
| > |
| > | I have tried making the call through vb.net and c# and it produces the same
| > | result. I am assigning the value like so:
| > |
| > | uint myVar = 4294967295
| > | Microsoft.Win32.Registry.LocalMachine.SetValue(VideoSettingsKey &
| > | "RecordingSoftPostPadding",myVar,Microsoft.Win32.RegistryValueKind.DWord)
| > |
| > | which fails with a conversion failure, I SHOULD be able to assign a uint
| > | value though. I can successfully assign an int value (smaller of course)
| > | without a problem, but int does not cover the range of values which can be
| > | contained in a regisry dword, only a uint can cover that range.
| >
.
- References:
- Re: bug found in Microsoft.Win32.RegistryValueKind.DWord conversion
- From: José Manuel Agüero
- Re: bug found in Microsoft.Win32.RegistryValueKind.DWord conversion
- Prev by Date: Differences in 2.0 depending on OS
- Next by Date: Re: VS 2005: where is the snippet manager ?
- Previous by thread: Re: bug found in Microsoft.Win32.RegistryValueKind.DWord conversion
- Next by thread: Re: How can I know all data has been received?
- Index(es):
Relevant Pages
|