Bug 33066 - Watch evaluations different in XS than VS
Summary: Watch evaluations different in XS than VS
Status: NEEDINFO
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2015-08-13 13:14 UTC by Cody Beyer (MSFT)
Modified: 2017-09-06 14:50 UTC (History)
6 users (show)

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


Attachments
Sample (32.68 KB, application/zip)
2015-08-13 13:14 UTC, Cody Beyer (MSFT)
Details

Description Cody Beyer (MSFT) 2015-08-13 13:14:29 UTC
Created attachment 12491 [details]
Sample

### Description

The following sample app demonstrates an issue where watches are evaluated incorrectly in XS, where in VS they are evaluated correctly. 

This may in fact be a Mono bug, but I am starting with the most external item.

### Images

VS (Correct) = https://db.tt/qzX6oIdZ
XS (Incorrect) = https://db.tt/lTmifgtA

### Sample

Attached

### Steps to reproduce

1. Open app in XS
2. Set the following watches

string.IsNullOrEmpty(whenIAmaString)
string.IsNullOrWhiteSpace(whenIAmaString)
whenIAmaString == ""
whenIAmaString == string.Empty

3. Run app

### Expected Results

whenIAmaString and whenIAmaString == string.Empty should evaluate false

### Actual Results

whenIAmaString and whenIAmaString == string.Empty evaluate true

### Version

=== Xamarin Studio ===

Version 5.9.5 (build 9)
Installation UUID: 8915c17c-ec61-4ec3-8f89-0683d6363abf
Runtime:
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

Version: 8.10.4.46 (Business Edition)
Hash: 2c66d2f
Branch: master
Build date: 2015-08-04 13:52:25-0400

=== Xamarin.Android ===

Version: 5.1.5.3 (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.2.111 (Business Edition)

=== Build Information ===

Release ID: 509050009
Git revision: b99cb19a1d3b15d8980c4616f13f837457e5b292
Build date: 2015-07-28 02:01:44-04
Xamarin addins: d53d6eceb828422f3d4aff8547f2f6bab6c9ea58

=== Operating System ===

Mac OS X 10.10.4
Darwin BeyerStudios.router 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 1 Rajneesh Kumar 2015-08-14 07:36:28 UTC
I have checked this issue and able to reproduce this issue. To reproduce this issue I have followed the steps and instruction provide din bug description.

I observed that whenIAmaString and whenIAmaString == string.Empty evaluate true in the Xamarin Studio. Please refer the screencast given below.

Screencast: http://www.screencast.com/t/GSgQPBRc4E

Ide Logs: https://gist.github.com/Rajneesh360Logica/fde0b878efb61c8a285a

Environment Info:

=== Xamarin Studio ===

Version 5.9.5 (build 9)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

=== Xamarin.Android ===

Version: 5.1.5.3 (Starter Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: 8.10.4.46 (Starter Edition)
Hash: 2c66d2f
Branch: master
Build date: 2015-08-04 13:52:25-0400

=== Xamarin.Mac ===

Version: 2.0.2.111 (Starter Edition)

=== Build Information ===

Release ID: 509050009
Git revision: b99cb19a1d3b15d8980c4616f13f837457e5b292
Build date: 2015-07-28 02:01:44-04
Xamarin addins: d53d6eceb828422f3d4aff8547f2f6bab6c9ea58

=== Operating System ===

Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 David Karlaš 2015-08-18 09:49:50 UTC
Problem appears to be in UTF8 encoding used on runtime side of SDB protocol, because it's sending empty byte array instead of "new byte[1]{0}".

https://github.com/mono/mono/blob/0916de42bda64e3aea2a115a8f16a22e85d5379d/mono/mini/debugger-agent.c#L9209-L9213

What is kinda interesting... CMD_STRING_REF_GET_LENGTH is returning 1.

Encoding.UTF8.GetBytes (whenIAmaString) results into "new byte[1]{0}". I'm guessing problem is probably around here: https://github.com/mono/mono/blob/88d2b9da2a87b4e5c82abaea4e5110188d49601d/eglib/src/giconv.c#L1100
Comment 3 Zoltan Varga 2015-08-18 15:33:48 UTC
We need to emit modified-utf8 which supports embedded null's.
Comment 4 Zoltan Varga 2015-08-18 17:18:19 UTC
Fixed in mono master/cycle6.
Comment 5 Rajneesh Kumar 2015-10-09 11:34:07 UTC
I have checked this issue with the following Cycle 6 builds:

MonoFramework-MDK-4.2.1.69.macos10.xamarin.x86_d8b68fd5787b116201969176d88deb08924059d8
XamarinStudio-5.10.0.815_1f1910169d5433415cac632094c57272080ef9df

I observed that this issue still exist with this build, because  whenIAmaString and whenIAmaString == string.Empty still evaluate true in the Xamarin Studio

Screencast: http://www.screencast.com/t/0pgp5VEZ

This issue does't seems fixed to me, hence I am reopening this issue.

Note: I have test it with the Master builds to but getting same behavior.
i.e. MonoFramework-MDK-4.3.0.1454.macos10.xamarin.x86_e6ad2dc73b415e091c80a9912c66e86af1e7a761
XamarinStudio-5.11.0.277_1f090cf5560dcc3aa2b485f8d68e9b46de87a0fd

Please let me know if I am missing something to check this issue.

Thanks..!

Environment Info:

=== Xamarin Studio ===

Version 5.10 (build 815)
Installation UUID: 0b7eaebc-a0ed-4b58-81df-91e378cad28c
Runtime:
	Mono 4.2.1 (explicit/d8b68fd)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010069

=== Xamarin.Profiler ===

Version: 0.0.0.0
Location: /Applications/XamarinProfiler.Mac.app/Contents/MacOS/XamarinProfiler.Mac

=== Apple Developer Tools ===

Xcode 7.0 (8227)
Build 7A220

=== Xamarin.Mac ===

Version: 2.4.0.80 (Indie Edition)

=== Xamarin.iOS ===

Version: 9.2.0.85 (Trial Edition)
Hash: 7bcf0da
Branch: master
Build date: 2015-10-05 17:54:02-0400

=== Xamarin.Android ===

Version: 6.0.0.12
Android SDK: Not found

=== Xamarin Android Player ===

Version: 0.6.1
Location: /Applications/Xamarin Android Player.app

=== Build Information ===

Release ID: 510000815
Git revision: 1f1910169d5433415cac632094c57272080ef9df
Build date: 2015-10-08 14:39:26-04
Xamarin addins: a44901897f3e0c6a25c0f12b6a5fcd892faecdbc
Build lane: monodevelop-lion-cycle6

=== Operating System ===

Mac OS X 10.11.0
Darwin Admin-Macs-Mac-mini.local 15.0.0 Darwin Kernel Version 15.0.0
    Wed Aug 26 16:57:32 PDT 2015
    root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64
Comment 6 Marek Safar 2017-09-06 14:50:49 UTC
Rajneesh could you retest the issue with recent versions

Note You need to log in before you can comment on or make changes to this bug.