Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6666665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:51:08+00:00 2026-05-26T02:51:08+00:00

I have a legacy (I didn’t build it) application running on an x64 environment

  • 0

I have a legacy (I didn’t build it) application running on an x64 environment (Win7). I have a sneaking suspicion it was run on a 32-bit environment before.

Anyway, I see calls to Registry.GetValue(key, value, default).

It seems like the default value is ignored.

Check out this crazy code:

// Up above the sky, so high
using Microsoft.Win32;
// ...
string location = "HKEY_LOCAL_MACHINE\SOFTWARE\..."; // ...
// ...

string registryValue = (string)Registry.GetValue(location, "Uri", "http://localhost/");
if (string.isNullOrEmpty(registryValue) {
  throw new Exception("What the ... ?!");
}

In a comparable example, the exception is seriously being thrown. (Actually, a null-reference exception appears despite the default value).

And I checked that I have the registry keys all the way up to the last level; they’re all in my registry.

This works for someone, but not for me.

Is this a bug? What’s going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:51:09+00:00Added an answer on May 26, 2026 at 2:51 am

    Most likely you are being caught out by registry redirection. You have a 32 bit process running on a 64 bit system. So HKLM\Software is redirected to HKLM\Software\Wow6432Node.

    When the key does not exist, the Registry.GetValue returns null rather than the default value and so the exception is thrown.

    If the name is not found in the specified key, returns a default value that you provide, or null if the specified key does not exist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a legacy forms application that runs a bunch of 32 bit C++
I have a legacy application that I am trying to run under an Azure
We have a legacy VB6 application from which we have migrated the licencing code
I have legacy code which I need to improve for performance reasons. My application
I have legacy win.forms application written in pretty straightforward approach where forms communicate with
I'm not entirely sure this is possible. I have a legacy GUI application written
I've searched and didn't find an answer yet, I have a legacy VB6 service
We have a legacy VB6 application which has worked just fine on Windows XP
I am fixing some problems with a legacy system and have run into a
Have a legacy LAMP application that I'm in the process of converting over to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.