Bug 59302 - Task in Mono 5.4.0.167 is throwing exception "Length cannot be less than zero"
Summary: Task in Mono 5.4.0.167 is throwing exception "Length cannot be less than zero"
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: Microsoft.CSharp (show other bugs)
Version: 5.4 (2017-06)
Hardware: Macintosh Mac OS
: High critical
Target Milestone: 15.4 SR1
Assignee: Marek Safar
URL:
: 58685 59971 (view as bug list)
Depends on:
Blocks: 59971
  Show dependency tree
 
Reported: 2017-09-07 16:47 UTC by David Hathaway
Modified: 2017-10-18 00:28 UTC (History)
9 users (show)

See Also:
Tags: xamextfollowed
Is this bug a regression?: Yes
Last known good build: 5.2.0.215


Attachments

Description David Hathaway 2017-09-07 16:47:53 UTC
After installing 15.4 preview of VSMac, I'm getting this behavior when tapping elements in hybrid/web views on iOS using UITest.  Switching back to 5.2.0.215 does not exhibit this behavior.

Steps to reproduce:

1. Deploy a simple IPA with a hybrid webview in it to your device
2. Create new UITest project
3. Update Xamarin.UITest to 2.0.10
4. Update AppInitializer.cs to the following (replacing with your device ID)

            return ConfigureApp
                .iOS
                // TODO: Update this path to point to your iOS app and uncomment the
                // code if the app is not included in the solution.
                .EnableLocalScreenshots()
                .DeviceIdentifier("<your device id here>")
                .InstalledApp("<your package name here>")
                .StartApp();

5. Launch a REPL window (using app.Repl() in your test)
6. On home screen of app, enter a query to locate an element within the webview, and note that it returns an element.  An example would  look like

app.Query(x => x.Class("WKWebView").XPath("//DIV[@id='btn_login']"));

7. Execute the following query, and note that the element is tapped, and the subsequent screen is displayed, but UITest returns the exception show in the description above

app.Tap(x => x.Class("WKWebView").XPath("//DIV[@id='btn_login']"));

Expected Behavior:

The element is tapped, and the tests proceed.

Actual Behavior:

Sample query + results:
app.Query(x => x.Class("WKWebView").XPath("//DIV[@id='btn_login']")) Query for Class("WKWebView").XPath("//DIV[@id='btn_login']") gave 1 results. [ [0] { Id => "btn_login", NodeType => "ELEMENT_NODE", NodeName => "DIV", Class => "btn_login", Html => null,
Value => null, WebView => "<WKWebView: 0x100824e00; frame = (0 0; 768 1024); autoresize = W+H; layer = <CALayer: 0x174222fa0>>", TextContent => "", Rect => { Width => 294, Height => 93, CenterX => 384, CenterY => 833.6406, Top => 787.6406, Bottom => 0, Left => 237, Right => 0, X => 237, Y => 787.6406 } } ]

Sample Tap + Results (including error):

app.Tap(x => x.Class("WKWebView").XPath("//DIV[@id='btn_login']")) Tapping element matching Class("WKWebView").XPath("//DIV[@id='btn_login']") at coordinates [ 384, 833.6406 ]. Error while performing Tap(Class("WKWebView").XPath("//DIV[@id='btn_login']")) Exception: System.AggregateException: One or more errors occurred. ---> System.ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length at System.String.Substring (System.Int32 startIndex, System.Int32 length) [0x0004a] in <0f9cf89506fc472489b02664600526e9>:0 at Microsoft.CSharp.RuntimeBinder.Syntax.NameTable.Add (System.String key, System.Int32 length) [0x00048] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.Syntax.NameManager.Add (System.String key, System.Int32 length) [0x00010] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.GetName (System.Type type) [0x0002b] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.LoadSymbolsFromType (System.Type originalType) [0x0004e] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.GetCTypeFromType (System.Type t) [0x00000] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.AddMethodToSymbolTable (System.Reflection.MemberInfo member, Microsoft.CSharp.RuntimeBinder.Semantics.AggregateSymbol callingAggregate, Microsoft.CSharp.RuntimeBinder.Semantics.MethodKindEnum kind) [0x001d1] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.AddNamesInInheritanceHierarchy (System.String name, System.Collections.Generic.List1[T] inheritance) [0x0015d] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.AddNamesOnType (Microsoft.CSharp.RuntimeBinder.SymbolTable+NameHashKey key) [0x0000d] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.PopulateSymbolTableWithName (System.String name, System.Collections.Generic.IEnumerable1[T] typeArguments, System.Type callingType) [0x00056] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.PopulateSymbolTableWithPayloadInformation (Microsoft.CSharp.RuntimeBinder.SymbolTable symbolTable, Microsoft.CSharp.RuntimeBinder.ICSharpInvokeOrInvokeMemberBinder callOrInvoke, System.Type callingType, Microsoft.CSharp.RuntimeBinder.ArgumentObject[] arguments) [0x00038] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder.PopulateSymbolTableWithName (Microsoft.CSharp.RuntimeBinder.SymbolTable symbolTable, System.Type callingType, Microsoft.CSharp.RuntimeBinder.ArgumentObject[] arguments) [0x00000] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.BindCore (Microsoft.CSharp.RuntimeBinder.ICSharpBinder payload, System.Linq.Expressions.Expression[] parameters, System.Dynamic.DynamicMetaObject[] args, System.Dynamic.DynamicMetaObject& deferredBinding) [0x0001d] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.Bind (System.Dynamic.DynamicMetaObjectBinder payload, System.Linq.Expressions.Expression[] parameters, System.Dynamic.DynamicMetaObject[] args, System.Dynamic.DynamicMetaObject& deferredBinding) [0x00021] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.BinderHelper.Bind (System.Dynamic.DynamicMetaObjectBinder action, Microsoft.CSharp.RuntimeBinder.RuntimeBinder binder, System.Dynamic.DynamicMetaObject[] args, System.Collections.Generic.IEnumerable1[T] arginfos, System.Dynamic.DynamicMetaObject onBindingError) [0x001f5] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder.FallbackInvokeMember (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject[] args, System.Dynamic.DynamicMetaObject errorSuggestion) [0x0000e] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at System.Dynamic.InvokeMemberBinder.FallbackInvokeMember (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject[] args) [0x00000] in <3fb92ec709f44a579da6a23087df403d>:0 at System.Dynamic.DynamicMetaObject.BindInvokeMember (System.Dynamic.InvokeMemberBinder binder, System.Dynamic.DynamicMetaObject[] args) [0x0000b] in <3fb92ec709f44a579da6a23087df403d>:0 at System.Dynamic.InvokeMemberBinder.Bind (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject[] args) [0x00016] in <3fb92ec709f44a579da6a23087df403d>:0 at System.Dynamic.DynamicMetaObjectBinder.Bind (System.Object[] args, System.Collections.ObjectModel.ReadOnlyCollection1[T] parameters, System.Linq.Expressions.LabelTarget returnLabel) [0x000c6] in <3fb92ec709f44a579da6a23087df403d>:0 at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T] (System.Runtime.CompilerServices.CallSite1[T] site, System.Object[] args) [0x00019] in <3fb92ec709f44a579da6a23087df403d>:0 at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet] (System.Runtime.CompilerServices.CallSite site, T0 arg0) [0x000f1] in <3fb92ec709f44a579da6a23087df403d>:0 at Xamarin.UITest.XDB.Services.iOSDeviceAgentService+<GestureAsync>c__async5.MoveNext () [0x002b4] in <a87c90c09452445fbb922acae3a82f00>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <0f9cf89506fc472489b02664600526e9>:0 at Xamarin.UITest.XDB.Services.iOSDeviceAgentService+<PointGestureAsync>c__async15.MoveNext () [0x000ac] in <a87c90c09452445fbb922acae3a82f00>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <0f9cf89506fc472489b02664600526e9>:0 at Xamarin.UITest.XDB.Services.iOSDeviceAgentService+<TouchAsync>c__async10.MoveNext () [0x00080] in <a87c90c09452445fbb922acae3a82f00>:0 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <0f9cf89506fc472489b02664600526e9>:0 at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <0f9cf89506fc472489b02664600526e9>:0 at System.Threading.Tasks.Task.Wait () [0x00000] in <0f9cf89506fc472489b02664600526e9>:0 at Xamarin.UITest.iOS.iOSGestures.TapCoordinates (System.Single x, System.Single y) [0x00023] in <a87c90c09452445fbb922acae3a82f00>:0 at Xamarin.UITest.iOS.iOSApp+<Tap>c__AnonStoreyB.<>m__0 () [0x000f9] in <a87c90c09452445fbb922acae3a82f00>:0 at Xamarin.UITest.Utils.ErrorReporting.With (System.Action func, System.Object[] args, System.String memberName) [0x00006] in <a87c90c09452445fbb922acae3a82f00>:0 ---> (Inner Exception #0) System.ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length at System.String.Substring (System.Int32 startIndex, System.Int32 length) [0x0004a] in <0f9cf89506fc472489b02664600526e9>:0 at Microsoft.CSharp.RuntimeBinder.Syntax.NameTable.Add (System.String key, System.Int32 length) [0x00048] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.Syntax.NameManager.Add (System.String key, System.Int32 length) [0x00010] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.GetName (System.Type type) [0x0002b] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.LoadSymbolsFromType (System.Type originalType) [0x0004e] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.GetCTypeFromType (System.Type t) [0x00000] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.AddMethodToSymbolTable (System.Reflection.MemberInfo member, Microsoft.CSharp.RuntimeBinder.Semantics.AggregateSymbol callingAggregate, Microsoft.CSharp.RuntimeBinder.Semantics.MethodKindEnum kind) [0x001d1] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.AddNamesInInheritanceHierarchy (System.String name, System.Collections.Generic.List1[T] inheritance) [0x0015d] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.AddNamesOnType (Microsoft.CSharp.RuntimeBinder.SymbolTable+NameHashKey key) [0x0000d] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.SymbolTable.PopulateSymbolTableWithName (System.String name, System.Collections.Generic.IEnumerable1[T] typeArguments, System.Type callingType) [0x00056] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.PopulateSymbolTableWithPayloadInformation (Microsoft.CSharp.RuntimeBinder.SymbolTable symbolTable, Microsoft.CSharp.RuntimeBinder.ICSharpInvokeOrInvokeMemberBinder callOrInvoke, System.Type callingType, Microsoft.CSharp.RuntimeBinder.ArgumentObject[] arguments) [0x00038] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder.PopulateSymbolTableWithName (Microsoft.CSharp.RuntimeBinder.SymbolTable symbolTable, System.Type callingType, Microsoft.CSharp.RuntimeBinder.ArgumentObject[] arguments) [0x00000] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.BindCore (Microsoft.CSharp.RuntimeBinder.ICSharpBinder payload, System.Linq.Expressions.Expression[] parameters, System.Dynamic.DynamicMetaObject[] args, System.Dynamic.DynamicMetaObject& deferredBinding) [0x0001d] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.Bind (System.Dynamic.DynamicMetaObjectBinder payload, System.Linq.Expressions.Expression[] parameters, System.Dynamic.DynamicMetaObject[] args, System.Dynamic.DynamicMetaObject& deferredBinding) [0x00021] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.BinderHelper.Bind (System.Dynamic.DynamicMetaObjectBinder action, Microsoft.CSharp.RuntimeBinder.RuntimeBinder binder, System.Dynamic.DynamicMetaObject[] args, System.Collections.Generic.IEnumerable1[T] arginfos, System.Dynamic.DynamicMetaObject onBindingError) [0x001f5] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder.FallbackInvokeMember (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject[] args, System.Dynamic.DynamicMetaObject errorSuggestion) [0x0000e] in <8326c0dc23f348dba5871e78cf0a46d3>:0 at System.Dynamic.InvokeMemberBinder.FallbackInvokeMember (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject[] args) [0x00000] in <3fb92ec709f44a579da6a23087df403d>:0 at System.Dynamic.DynamicMetaObject.BindInvokeMember (System.Dynamic.InvokeMemberBinder binder, System.Dynamic.DynamicMetaObject[] args) [0x0000b] in <3fb92ec709f44a579da6a23087df403d>:0 at System.Dynamic.InvokeMemberBinder.Bind (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject[] args) [0x00016] in <3fb92ec709f44a579da6a23087df403d>:0 at System.Dynamic.DynamicMetaObjectBinder.Bind (System.Object[] args, System.Collections.ObjectModel.ReadOnlyCollection1[T] parameters, System.Linq.Expressions.LabelTarget returnLabel) [0x000c6] in <3fb92ec709f44a579da6a23087df403d>:0 at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T] (System.Runtime.CompilerServices.CallSite1[T] site, System.Object[] args) [0x00019] in <3fb92ec709f44a579da6a23087df403d>:0 at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet] (System.Runtime.CompilerServices.CallSite site, T0 arg0) [0x000f1] in <3fb92ec709f44a579da6a23087df403d>:0 at Xamarin.UITest.XDB.Services.iOSDeviceAgentService+<GestureAsync>c__async5.MoveNext () [0x002b4] in <a87c90c09452445fbb922acae3a82f00>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <0f9cf89506fc472489b02664600526e9>:0 at Xamarin.UITest.XDB.Services.iOSDeviceAgentService+<PointGestureAsync>c__async15.MoveNext () [0x000ac] in <a87c90c09452445fbb922acae3a82f00>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0f9cf89506fc472489b02664600526e9>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <0f9cf89506fc472489b02664600526e9>:0 at Xamarin.UITest.XDB.Services.iOSDeviceAgentService+<TouchAsync>c__async10.MoveNext () [0x00080] in <a87c90c09452445fbb922acae3a82f00>:0 <---
Exception: Error while performing Tap(Class("WKWebView").XPath("//DIV[@id='btn_login']"))
Comment 2 Brandon Minnick 2017-10-09 19:49:10 UTC
Here's some additional data from debugging this problem with the UITest team.

It also contains a link to a reproduction on GitHub.

https://github.com/xamarin/Xamarin.UITest/issues/1171
Comment 3 Marek Safar 2017-10-09 21:25:06 UTC
It should be fixed in Mono 5.6 and newer already
Comment 4 Brendan Zagaeski (Xamarin Support) 2017-10-09 21:28:44 UTC
Copying updates from duplicate bug for bookkeeping

From Matt Ward in Bug 59971, Comment 2:
> Tried a few different Mono versions and ran the UITests from the command
> line:
> 
> Mono 5.2.0.224 (d15-3/14f2c81) - OK
> Mono 5.4.0.73 (2017-06/2f1b9e8) - Fail
> Mono 5.4.0.167 (2017-06/6b8abfeb7cc) - Fail
> Mono 5.4.0.201 (2017-06/71277e78f6e - Fail
> Mono 5.4.0.204 (2017-06/cb4c3ca997f) - Fail
> Mono 5.8.0.0 (2017-10/8a2a0628624) - OK
Comment 5 Brendan Zagaeski (Xamarin Support) 2017-10-09 21:30:00 UTC
From me in Bug 59971, Comment 3:

> ## Additional testing to answer what fixed the issue
> 
> The fix that is present in Mono 5.8 is also present in Mono 5.6.  I
> performed a bisect using the available CI builds, and found that one of the
> following 2 commits fixed the issue:
> 
> https://github.com/mono/mono/commit/b08c54265b20d914bd3a5f1c0f7a8ad606411c6e "Bump API snapshot submodule"
> https://github.com/mono/mono/commit/efc7e54e149d5b4642bc3b89d7d963c98ec84561 "Bump CoreFX"
> 
> "Bump CoreFX" is likely the fix (corefx does appear in the stack trace), but
> unfortunately that bump is a large change, so backporting it would carry
> risks.
> 
> I can attempt a similar bisect to find the point of breakage tomorrow.  My
> suspicion would be that it's another earlier CoreFX bump.
Comment 6 Brendan Zagaeski (Xamarin Support) 2017-10-09 21:34:37 UTC
*** Bug 59971 has been marked as a duplicate of this bug. ***
Comment 7 Marek Safar 2017-10-09 21:36:42 UTC
This looks like corefx regression fixed in https://github.com/dotnet/corefx/pull/22117
Comment 8 Brendan Zagaeski (Xamarin Support) 2017-10-10 02:02:13 UTC
While we continue to investigate possible fixes for Mono 5.4, here are links for the older and newer Mono versions that behave correctly in this scenario.




## Previous Stable Mono Framework MDK 5.2 

https://dl.xamarin.com/MonoFrameworkMDK/Macx86/MonoFramework-MDK-5.2.0.224.macos10.xamarin.universal.pkg




## Experimental-quality Mono Framework MDK 5.6

This is an experimental quality development build.  Be advised that this package has not been through any QA testing, but it did successfully stop the problem in my local tests.

Download the following package onto your Mac and double-click it in Finder to run the installer:

https://dl.xamarin.com/uploads/0ctarivn5rv/MonoFramework-MDK-5.6.0.107.macos10.xamarin.universal.pkg

Because this is an experimental version installed outside of the updater channels mechanism, Visual Studio for Mac will continue to offer an "update" back to the _older_ published Stable updater channel versions when you have this version installed.  You will need to ignore that notification if you wish to keep using this experimental version.




## Steps to switch back to the current published version

If any users need to switch back to the current published version Mono Framework MDK 5.4.0.201 after trying this experimental version, you can do so using either of the following methods:

- Check for updates on the Stable updater channel within Visual Studio for Mac on your Mac.

OR

- Manually download and run the individual older Mono Framework MDK installer package from https://download.mono-project.com/archive/5.4.0/macos-10-universal/.
Comment 9 Brendan Zagaeski (Xamarin Support) 2017-10-12 03:49:51 UTC
The upstream dotnet/corefx commit mentioned in Comment 7 appears to be precisely the change we would need to backport (onto a new branch of https://github.com/mono/corefx specifically aligned to the Xamarin 15.4 Release) to resolve this issue in Mono Framework MDK 5.4.




## Steps followed to test the effect of the commit from Comment 7

1. Checkout and make Mono Framework MDK 5.4.0.201 (71277e7) from source.

2. Confirm the symptom with Xamarin.UITest is reproducible using that version.

3. `cd` into external/corefx in the mono source directory.

4. Cherry-pick the commit from the pull request (a6dad05166781157e95e1f5a87a454f6a2edea7f).

5. `cd` back to the top-level mono source directory and `make install`.




## Results: success

- At step 2, I was able to hit the error as described in Comment 0.

- After step 5, I was no longer able to hit the error. The UITest test ran successfully to completion.
Comment 10 Marek Safar 2017-10-12 08:16:57 UTC
Only Mono 5.4.* and dev15-5 products are affected

PR fixing the issue https://github.com/mono/mono/pull/5772
Comment 11 Luis Aguilera 2017-10-12 15:42:45 UTC
d15-5-2017-06: https://github.com/mono/mono/pull/5775
Comment 13 Brendan Zagaeski (Xamarin Support) 2017-10-17 22:38:41 UTC
*** Bug 58685 has been marked as a duplicate of this bug. ***
Comment 14 Brendan Zagaeski (Xamarin Support) 2017-10-18 00:07:55 UTC
## Possible alternate temporary workaround (until the change mentioned in Comment 10 is published)

From Bug 58685, Comment 12, one other potential temporary workaround is to update to a newer version of Xamarin.UITest:

> I too was experiencing this problem and updating to
> Xamarin.UITest.2.1.3.1660-dev has resolved the issue for me
In my local tests, updating to Xamarin.UITest version 2.1.4 [1] was indeed successful as a workaround for this issue (at least for the particular scenario described in Bug 59971, Comment 1).

[1] Published on October 12, a little while after version 2.1.3.1660-dev.
Comment 15 Kent Green [MSFT] 2017-10-18 00:28:46 UTC
Just an addendum / observation for Brendan's comment. The release notes for Xamarin.UITest 2.1.4 note: https://www.nuget.org/packages/Xamarin.UITest/2.1.4

> Fixes Mono/VS error on Mono 5.4

I'm not familiar enough with the Mono errors or UITest on the backend but I thought it was worth noting that the release as a workaround did update something related to Mono and so this likely explains the improved behavior; at least partially if not completely.

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