Click here to Skip to main content
15,877,246 members
Home / Discussions / C#
   

C#

 
GeneralRe: Nuget Dependency Problem (NServiceBus) Pin
Richard MacCutchan15-Feb-24 20:54
mveRichard MacCutchan15-Feb-24 20:54 
GeneralRe: Nuget Dependency Problem (NServiceBus) Pin
jschell16-Feb-24 7:15
jschell16-Feb-24 7:15 
QuestionGracefully exit a .net 8 based windows service [SOLVED] Pin
Richard Andrew x6410-Feb-24 13:01
professionalRichard Andrew x6410-Feb-24 13:01 
AnswerRe: Gracefully exit a .net 8 based windows service Pin
OriginalGriff10-Feb-24 19:53
mveOriginalGriff10-Feb-24 19:53 
GeneralRe: Gracefully exit a .net 8 based windows service Pin
Richard Andrew x6411-Feb-24 4:47
professionalRichard Andrew x6411-Feb-24 4:47 
AnswerRe: Gracefully exit a .net 8 based windows service Pin
Gerry Schmitz11-Feb-24 9:03
mveGerry Schmitz11-Feb-24 9:03 
AnswerRe: Gracefully exit a .net 8 based windows service [SOLVED] Pin
jschell13-Feb-24 4:50
jschell13-Feb-24 4:50 
QuestionHaving trouble opening a registry key Pin
Richard Andrew x648-Feb-24 14:57
professionalRichard Andrew x648-Feb-24 14:57 
I have some simple code that worked when it was running on the .NET Framework 4.8, but after converting the project to .NET 8.0, the code is unable to open a subkey under HKLM because of an "UnauthorizedAccess Exception".

try
{
    using (RegistryKey BaseKey =
           RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) // Does not throw any exception
    {
        using (RegistryKey SubKey =
            BaseKey.CreateSubKey("Software\\CompanyName\\ProductName")) // The code fails here with an UnauthorizedAccessException.
        {
            DatabasePath = SubKey.GetValue("DBPath") as string;

            SubKey.Close();
            BaseKey.Close();

            return Result.Success();
        }
    }
}


FACTS:

The registry key already exists when this code runs.
The code is running under the LocalSystem account as a Windows Service.
The initial open of the base key, HKLM apparently succeeds, but the BaseKey.Handle member is null immediately after the call to OpenBaseKey and before CreateSubKey.
Please ask for more details.
The difficult we do right away...
...the impossible takes slightly longer.

AnswerRe: Having trouble opening a registry key Pin
Dave Kreskowiak8-Feb-24 16:27
mveDave Kreskowiak8-Feb-24 16:27 
AnswerRe: Having trouble opening a registry key Pin
OriginalGriff8-Feb-24 20:02
mveOriginalGriff8-Feb-24 20:02 
GeneralRe: Having trouble opening a registry key Pin
jochance13-Feb-24 9:30
jochance13-Feb-24 9:30 
GeneralRe: Having trouble opening a registry key Pin
OriginalGriff13-Feb-24 19:56
mveOriginalGriff13-Feb-24 19:56 
AnswerRe: Having trouble opening a registry key Pin
Richard Deeming8-Feb-24 22:47
mveRichard Deeming8-Feb-24 22:47 
AnswerRe: Having trouble opening a registry key Pin
Eddy Vluggen12-Feb-24 12:36
professionalEddy Vluggen12-Feb-24 12:36 
RantGlobal using? Pin
jschell8-Feb-24 4:42
jschell8-Feb-24 4:42 
GeneralRe: Global using? Pin
Richard Deeming8-Feb-24 5:19
mveRichard Deeming8-Feb-24 5:19 
GeneralRe: Global using? Pin
jochance13-Feb-24 9:34
jochance13-Feb-24 9:34 
QuestionHow to set up a Using..? Pin
glennPattonWork38-Feb-24 1:32
professionalglennPattonWork38-Feb-24 1:32 
AnswerRe: How to set up a Using..? Pin
Richard Andrew x648-Feb-24 1:38
professionalRichard Andrew x648-Feb-24 1:38 
GeneralRe: How to set up a Using..? Pin
glennPattonWork38-Feb-24 2:24
professionalglennPattonWork38-Feb-24 2:24 
GeneralRe: How to set up a Using..? Pin
Richard Andrew x648-Feb-24 2:33
professionalRichard Andrew x648-Feb-24 2:33 
GeneralRe: How to set up a Using..? Pin
glennPattonWork38-Feb-24 3:11
professionalglennPattonWork38-Feb-24 3:11 
AnswerRe: How to set up a Using..? Pin
Richard Deeming8-Feb-24 2:51
mveRichard Deeming8-Feb-24 2:51 
GeneralRe: How to set up a Using..? Pin
glennPattonWork38-Feb-24 3:10
professionalglennPattonWork38-Feb-24 3:10 
QuestionSystem.ServiceProcess.ServiceController.dll [SOLVED] Pin
Richard Andrew x643-Feb-24 2:38
professionalRichard Andrew x643-Feb-24 2:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.