Bug 59956 - [llvm][bitcode] [FAIL] UniqueIdTest.Ctor_Id (System.Runtime.Serialization tests)
Summary: [llvm][bitcode] [FAIL] UniqueIdTest.Ctor_Id (System.Runtime.Serialization tests)
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler (show other bugs)
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.5
Assignee: Zoltan Varga
Depends on:
Reported: 2017-10-04 14:02 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2017-10-27 17:05 UTC (History)
2 users (show)

See Also:
Is this bug a regression?: Yes
Last known good build: d15-4

minimal testcase (842 bytes, text/plain)
2017-10-13 20:18 UTC, Zoltan Varga
XI test project (90.12 KB, application/zip)
2017-10-20 08:39 UTC, Rolf Bjarne Kvinge [MSFT]

Description Rolf Bjarne Kvinge [MSFT] 2017-10-04 14:02:42 UTC

* Run "make run-watchos-dev-System.Runtime.Serialization CONFIG=Release" in xamarin-macios/tests


> [FAIL] UniqueIdTest.Ctor_Id : System.NullReferenceException : Object reference not set to an instance of an object.

Complete test log: https://gist.github.com/rolfbjarne/e92d1cf89f7d3985e1cfa481dfb53a59
Complete build log: https://gist.github.com/rolfbjarne/dd0401611192e97e60ca44c7e91aa32c

This does not happen with d15-4 nor d15-3, so it's a regression.

It only happens with watchOS on device in Release mode.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2017-10-10 16:36:04 UTC
This test code fails:

> new int [1].Concat (new int [2]).ToArray ();

while this works:

> new object [1].Concat (new object [2]).ToArray ();

it fails somewhere inside .ToArray:

> System.NullReferenceException: Object reference not set to an instance of an object.
>   at System.Collections.Generic.ArrayBuilder`1[T].First () <0x39550d + 0x00064> in <160d2620587c4d0eb0956e998349bb70>:0 
>   at System.Linq.Enumerable+Concat2Iterator`1[TSource].ToArray () <0x38cfa1 + 0x00442> in <160d2620587c4d0eb0956e998349bb70>:0 
>   at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] ) <0xa9d37 + 0x001a0> in <160d2620587c4d0eb0956e998349bb70>:0
Comment 3 Zoltan Varga 2017-10-13 20:18:16 UTC
Created attachment 25305 [details]
minimal testcase
Comment 4 Zoltan Varga 2017-10-13 22:44:46 UTC

Note that the fix has only been tested on desktop, not on watchos.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2017-10-18 16:48:05 UTC
I've tested the fix locally on watchOS, and it works.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2017-10-20 08:39:54 UTC
Created attachment 25378 [details]
XI test project

Attaching XI test project for QA.

To repro:

* Open project
* Select the monotouch-test-watchos-app project as the startup project
* Select Release|watchDevice as the configuration
* Run

It will print "FAILURE!" to the application output when failing, and "SUCCESS!" if successful.
Comment 8 Ludovic Henry 2017-10-24 20:17:46 UTC
Backport to 2017-06 at https://github.com/mono/mono/pull/5855
Comment 10 Ludovic Henry 2017-10-25 14:45:11 UTC
Backport to d15-5-2017-06 at https://github.com/mono/mono/pull/5859

Backport to 2017-06 at https://github.com/mono/mono/pull/5855 has been merged with https://github.com/mono/mono/commit/e66d9abbb271c3d08589c09afce4afc80de2d3b6
Comment 11 Rolf Bjarne Kvinge [MSFT] 2017-10-25 16:29:04 UTC
master: https://github.com/xamarin/xamarin-macios/pull/2921
Comment 12 Ludovic Henry 2017-10-26 16:02:46 UTC
Backport to d15-5-2017-06 at https://github.com/mono/mono/pull/5859 has been merged with https://github.com/mono/mono/commit/4005b8a4a6b9ee57c60cb02dc901bc96f027d7ca
Comment 13 Rolf Bjarne Kvinge [MSFT] 2017-10-26 16:06:00 UTC
xamarin-macios/d15-5: https://github.com/xamarin/xamarin-macios/pull/2929

@Ludovic, is this fix in 2017-10 already? If not we'd need it there too to not regress d15-6.
Comment 14 Rolf Bjarne Kvinge [MSFT] 2017-10-27 16:15:31 UTC
finally fixed in d15-5: https://github.com/xamarin/xamarin-macios/commit/25c6ba1ebe39bbe95b9dd74efc6d40ba26e262ee
Comment 15 Rolf Bjarne Kvinge [MSFT] 2017-10-27 17:05:01 UTC
I couldn't find this fix in 2017-10, so I created a PR for it: https://github.com/mono/mono/pull/5887

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