Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft.Win32.Registry.Tests fail when run build.cmd #14031

Closed
cnblogs-dudu opened this issue Jan 30, 2015 · 7 comments
Closed

Microsoft.Win32.Registry.Tests fail when run build.cmd #14031

cnblogs-dudu opened this issue Jan 30, 2015 · 7 comments
Labels
help wanted [up-for-grabs] Good issue for external contributors test-bug Problem in test source code (most likely)
Milestone

Comments

@cnblogs-dudu
Copy link
Contributor

Error log:

  Starting:    System.Globalization.Extensions.Tests
  Discovering: Microsoft.Win32.Registry.Tests
  Discovered:  System.ComponentModel.Annotations.Tests
  Starting:    System.ComponentModel.Annotations.Tests
  Discovered:  Microsoft.Win32.Registry.Tests
  Starting:    Microsoft.Win32.Registry.Tests
     Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_regvalopt.Test01 [FAIL]
        Error Unexpected exception occured , got exc==Xunit.Sdk.FalseException: Error Key value is incorrect...
           at Xunit.Assert.False(Boolean condition, String userMessage)
           at Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_regvalopt.Test01() in e:\Dev\GitHub\DotNet\corefx\src\Microsoft.Win32.Registry\tests\RegistryKey\RegistryKey_GetValue_str_obj_regvalopt.cs:line 43
        Stack Trace:
           e:\Dev\GitHub\DotNet\corefx\src\Microsoft.Win32.Registry\tests\RegistryKey\RegistryKey_GetValue_str_obj_regvalopt.cs(48,0): at Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_regvalopt.Test01()
     Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_regvalopt.Test05 [FAIL]
        Error Unexpected exception occured.... exception message...:Xunit.Sdk.FalseException: Error null return expected
           at Xunit.Assert.False(Boolean condition, String userMessage)
           at Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_regvalopt.Test05() in e:\Dev\GitHub\DotNet\corefx\src\Microsoft.Win32.Registry\tests\RegistryKey\RegistryKey_GetValue_str_obj_regvalopt.cs:line 94
        Stack Trace:
           e:\Dev\GitHub\DotNet\corefx\src\Microsoft.Win32.Registry\tests\RegistryKey\RegistryKey_GetValue_str_obj_regvalopt.cs(99,0): at Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_regvalopt.Test05()
     Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_b.Test01 [FAIL]
        Error Unexpected exception occured , got exc==Xunit.Sdk.FalseException: Error Key value is incorrect...
           at Xunit.Assert.False(Boolean condition, String userMessage)
           at Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_b.Test01() in e:\Dev\GitHub\DotNet\corefx\src\Microsoft.Win32.Registry\tests\RegistryKey\RegistryKey_GetValue_str_obj_b.cs:line 47
        Stack Trace:
           e:\Dev\GitHub\DotNet\corefx\src\Microsoft.Win32.Registry\tests\RegistryKey\RegistryKey_GetValue_str_obj_b.cs(52,0): at Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_b.Test01()
     Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_b.Test03 [FAIL]
        Error Unexpected exception occured.... exception message...:Xunit.Sdk.FalseException: Error null return expected
           at Xunit.Assert.False(Boolean condition, String userMessage)
           at Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_b.Test03() in e:\Dev\GitHub\DotNet\corefx\src\Microsoft.Win32.Registry\tests\RegistryKey\RegistryKey_GetValue_str_obj_b.cs:line 86
        Stack Trace:
           e:\Dev\GitHub\DotNet\corefx\src\Microsoft.Win32.Registry\tests\RegistryKey\RegistryKey_GetValue_str_obj_b.cs(91,0): at Microsoft.Win32.RegistryTests.RegistryKey_GetValue_str_obj_b.Test03()
  xUnit.net console test runner (32-bit .NET Core)
  Copyright (C) 2014 Outercurve Foundation.

  Finished:    System.ComponentModel.Annotations.Tests
@krwq krwq assigned krwq and pallavit and unassigned krwq Jan 30, 2015
@krwq
Copy link
Member

krwq commented Jan 30, 2015

@pallavit, is it known issue? On the first glance it looks like a product bug or some concurrency problem.

@cnblogs-dudu, does it repro all the time?

@cnblogs-dudu
Copy link
Contributor Author

@krwq
all the time

@cnblogs-dudu
Copy link
Contributor Author

@krwq

Object obj = _rk1.GetValue(null, null, RegistryValueOptions.DoNotExpandEnvironmentNames);
if (obj != null)
{
    Assert.False(true, "Error Key value is incorrect...");
}

obj value is 0.

@stephentoub
Copy link
Member

@cnblogs-dudu, if you open regedit and click on HKEY_CURRENT_USER, in the right pane you should see an entry for "(DEFAULT)". For that row, under the Data column, do you see "(value not set)" or do you see something else, like "0"?

I ask because the four tests you're seeing fail are verifying that no default value is set for HKEY_CURRENT_USER. Doesn't seem like a valid assumption for the test to be making, but nevertheless...

@cnblogs-dudu
Copy link
Contributor Author

@stephentoub
Yes, found "0".
screen shot 2015-02-01 at 22 50 58
After deleted the "(Default)" entry, the tests were passed.

@cnblogs-dudu
Copy link
Contributor Author

@stephentoub
"(Default)=0" appeared again.
screen shot 2015-02-02 at 12 50 40

@stephentoub
Copy link
Member

Thanks, @cnblogs-dudu. And yeah, this is why I said "Doesn't seem like a valid assumption for the test to be making"... something else on your machine seems to be setting that value to 0, which is then causing a subsequent execution of the tests to fail. The tests should really be fixed to not assume that HKEY_CURRENT_USER's (Default) value is unspecified.

Maxwe11 referenced this issue in Maxwe11/corefx Mar 28, 2015
Original tests rely on assumption that default value is not set for HKEY_CURRENT_USER. This assumption is wrong because default value of HKEY_CURRENT_USER could be used by someone else which will cause tests failure.
This commit fixes tests to rely on default value of test subkey.

Fixes #566
Maxwe11 referenced this issue in Maxwe11/corefx Mar 28, 2015
Original tests rely on assumption that default value is not set for HKEY_CURRENT_USER. This assumption is wrong because default value of HKEY_CURRENT_USER could be used by someone else.
Also original tests rely on assumption that value with name "tt" doesn't exists in HKEY_CURRENT_USER which also could be wrong on some machines.
In general tests should be run against test subkey instead of HKEY_CURRENT_USER. This commit fixes this.

Fixes #566
@pallavit pallavit removed their assignment Apr 8, 2015
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 1.0.0-rtm milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted [up-for-grabs] Good issue for external contributors test-bug Problem in test source code (most likely)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants