Bug 58821 - dynamic JObject issue after current VS2017 update
Summary: dynamic JObject issue after current VS2017 update
Status: RESOLVED DUPLICATE of bug 57919
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 10.99 (xcode9)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-08-16 18:14 UTC by Wesley
Modified: 2017-08-17 08:27 UTC (History)
3 users (show)

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


Attachments
Sample Projects (17.02 KB, application/zip)
2017-08-16 20:48 UTC, John Miller [MSFT]
Details


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 Developer Community or GitHub 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:
Status:
RESOLVED DUPLICATE of bug 57919

Description Wesley 2017-08-16 18:14:09 UTC
dynamic dt = JObject.Parse(data);

 if (dt.data.Count > 0) //calling Count causes the error

*********************************************************************

{System.PlatformNotSupportedException: Operation is not supported on this platform.
  at System.Runtime.InteropServices.Marshal.IsComObject (System.Object o) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs:744 
  at Microsoft.CSharp.RuntimeBinder.BinderHelper.IsComObject (System.Object obj) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/BinderHelper.cs:162 
  at Microsoft.CSharp.RuntimeBinder.BinderHelper.IsDynamicallyTypedRuntimeProxy (System.Dynamic.DynamicMetaObject argument, Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo info) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/BinderHelper.cs:214 
  at Microsoft.CSharp.RuntimeBinder.BinderHelper.DeduceArgumentRestriction (System.Int32 parameterIndex, Microsoft.CSharp.RuntimeBinder.ICSharpInvokeOrInvokeMemberBinder callPayload, System.Dynamic.DynamicMetaObject argument, Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo info) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/BinderHelper.cs:253 
  at Microsoft.CSharp.RuntimeBinder.BinderHelper.Bind (System.Dynamic.DynamicMetaObjectBinder action, Microsoft.CSharp.RuntimeBinder.RuntimeBinder binder, System.Dynamic.DynamicMetaObject[] args, System.Collections.Generic.IEnumerable`1[T] arginfos, System.Dynamic.DynamicMetaObject onBindingError) [0x000a3] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/BinderHelper.cs:64 
  at Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBinder.FallbackGetMember (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject errorSuggestion) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetMemberBinder.cs:64 
  at Newtonsoft.Json.Utilities.DynamicProxyMetaObject`1+<>c__DisplayClass3_0[T].<BindGetMember>b__0 (System.Dynamic.DynamicMetaObject e) [0x00000] in <c19705166c7c4a608e182e859c4de6d2>:0 
  at Newtonsoft.Json.Utilities.DynamicProxyMetaObject`1[T].CallMethodWithResult (System.String methodName, System.Dynamic.DynamicMetaObjectBinder binder, System.Collections.Generic.IEnumerable`1[T] args, Newtonsoft.Json.Utilities.DynamicProxyMetaObject`1+Fallback[T] fallback, Newtonsoft.Json.Utilities.DynamicProxyMetaObject`1+Fallback[T] fallbackInvoke) [0x00000] in <c19705166c7c4a608e182e859c4de6d2>:0 
  at Newtonsoft.Json.Utilities.DynamicProxyMetaObject`1[T].BindGetMember (System.Dynamic.GetMemberBinder binder) [0x0004b] in <c19705166c7c4a608e182e859c4de6d2>:0 
  at System.Dynamic.GetMemberBinder.Bind (System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject[] args) [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Dynamic/GetMemberBinder.cs:71 
  at System.Dynamic.DynamicMetaObjectBinder.Bind (System.Object[] args, System.Collections.ObjectModel.ReadOnlyCollection`1[T] parameters, System.Linq.Expressions.LabelTarget returnLabel) [0x000c6] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Dynamic/DynamicMetaObjectBinder.cs:90 
  at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T] (System.Runtime.CompilerServices.CallSite`1[T] site, System.Object[] args) [0x00019] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/CallSiteBinder.cs:129 
  at System.Runtime.CompilerServices.CallSiteOps.Bind[T] (System.Runtime.CompilerServices.CallSiteBinder binder, System.Runtime.CompilerServices.CallSite`1[T] site, System.Object[] args) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/CallSiteOps.cs:157 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:305 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow (System.Reflection.TargetInvocationException exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Utilities.cs:174 
  at System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00035] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/CallInstruction.cs:333 
  at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00015] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Interpreter.cs:63 
  at System.Linq.Expressions.Interpreter.LightLambda.Run2[T0,T1,TRet] (T0 arg0, T1 arg1) [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.18/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LightLambda.Generated.cs:79 
  at TelerikXamarin.iOS.DependencyServices.Login.Authenticate (System.String username, System.String password, System.Boolean rememberCredentials) [0x00109] in C:\SoftwareEngineeringRepo\unpluggedmobile\EnvoyUnplugged\iOS\DependencyServices\Login.cs:54 }
Comment 1 John Miller [MSFT] 2017-08-16 18:19:04 UTC
@Wesley,

Could you provide the data payload you used to reproduce this? Thanks!
Comment 2 Wesley 2017-08-16 18:28:25 UTC
{
	data: [{
		"SiteId": 1502,
		"IDSite": 1502,
		"CreatedDate": "2017-01-23T10:53:11.983",
		"CreatedDateUTC": "2017-01-23T16:53:11.983",
		"UserName": "wescur88@gmail.com",
		"Password": "SomePassword",
		"FirstName": "Wesley",
		"LastName": "Currie",
		"Email": "wescur88@gmail.com",
		"Title": "Sr .Net Developer",
		"LoginCount": 1737,
		"Notes": null,
		"UTC_Offset": null,
		"CreatedUserID": null,
		"ModifiedDateUTC": null,
		"IDUser": 2753,
		"LastLoginDateUTC": "2017-08-16T18:13:29.667",
		"UserTypeID": 6,
		"RegionID": null,
		"SiteName": "Sharkfare",
		"SiteDescription": "Sharkfare",
		"CustomerID": 0,
		"IsInternal": null,
		"SiteType": null,
		"Status": "N",
		"StatusReason": "No Devices Online ",
		"Edit Assets": true,
		"LoginEnabled": true,
		"Edit Users": true,
	}]
}

This issue also happens on Android as well.
Comment 3 John Miller [MSFT] 2017-08-16 20:48:56 UTC
Created attachment 24252 [details]
Sample Projects

I was able to reproduce this and attached this project. Run the iOS project to reproduce. The included console app works OK. 

=== Visual Studio Enterprise 2017 for Mac (Preview) ===

Version 7.2 Preview (7.2 build 526)
Installation UUID: b968d862-551c-4a33-ab4e-9666400e357c
Runtime:
	Mono 5.4.0.151 (2017-06/b65d1a9ffc0) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 504000151

=== NuGet ===

Version: 4.3.0.4199

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.0.0-preview2-25407-01
SDK: /usr/local/share/dotnet/sdk/2.0.0-preview2-006497/Sdks
SDK Version: 2.0.0-preview2-006497
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.6
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.3 (12175.1)
Build 8E3004b

=== Xamarin.iOS ===

Version: 10.14.0.3 (Visual Studio Enterprise)
Hash: 80f17b0b
Branch: d15-4
Build date: 2017-07-19 10:26:09-0400

=== Xamarin.Android ===

Version: 7.5.0.3 (Visual Studio Enterprise)
Android SDK: /Users/johnmiller/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		7.1 (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 26.0.0
SDK Build Tools Version: 25.0.3

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Inspector ===

Not Installed

=== Xamarin.Mac ===

Version: 3.8.0.3 (Visual Studio Enterprise)

=== Build Information ===

Release ID: 702000526
Git revision: 5fa56512f7661f9256db825adce8863894a88e5a
Build date: 2017-08-09 16:34:33-04
Xamarin addins: 989f4c020010e87fca451a6c58541361e926c3b0
Build lane: monodevelop-lion-d15-4

=== Operating System ===

Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Comment 5 Rolf Bjarne Kvinge [MSFT] 2017-08-17 08:27:10 UTC

*** This bug has been marked as a duplicate of bug 57919 ***