Bug 23379 - If sentence evaluating wrong
Summary: If sentence evaluating wrong
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2014-09-25 14:52 UTC by Bjarke Pedersen
Modified: 2014-09-26 03:46 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Bjarke Pedersen 2014-09-25 14:52:12 UTC
Hi Guys, I am have a strange problem - I just updated to the newest update and is working in xamarin studio mac version 5.4(240).

In of of my classes I have the following code: 

if (string.IsNullOrEmpty(Password) || string.IsNullOrEmpty(Username)

Password and Username are property strings and no matter what it always evaluate true. If both have values it still says true. Its very frustrating as none of my code is working af the update.
Comment 1 Bjarke Pedersen 2014-09-25 16:13:10 UTC
I need to update my bug report I ony have the problem in monodroid and visual studio - the same code work fine in mac and ios.
Comment 2 Bjarke Pedersen 2014-09-25 16:26:23 UTC
Sorry for the spam. The code work on mono droid on mac as well. So the issue is isolated to monodroid and visualstudio in windows - please do write if you need for more info.
Comment 3 Bjarke Pedersen 2014-09-25 17:18:45 UTC
I believe that I have made a mistake. It seems that the debugger led me to believe that issue was in that if sentence. However the subsequent code was executed but resulted in an error. Some datetime calculation which has worked for the past year suddenly stopped working. and gave an argument out of range exception. I needed to change the code from:

var seventies = new DateTime (1970, 1, 1);
            var time = DateTime.UtcNow - seventies.ToUniversalTime ();

var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            var d = DateTime.UtcNow.Subtract (epoch);
Comment 4 Marek Safar 2014-09-26 03:45:07 UTC
That's due fixed bug. The new behaviour is correct one.
Comment 5 Bjarke Pedersen 2014-09-26 03:46:16 UTC