使用动态对象时RuntimeBinderException,即使选中了Just My Code也是如此

时间:2017-09-13 06:30:53

标签: dynamic xamarin.forms json.net

我有一些非常简单的代码抛出RuntimeBinderException

var mockString = "{ Status: \"Aware\" }";
dynamic d = JsonConvert.DeserializeObject(mockString);
OutputString = d.Status;

我已经阅读了很多类似的问题like this one,给出的答案是它是第一次机会异常,我应该在工具>选项>调试中检查“仅我的代码”。

我有两个解决方案的代码。一个工作,一个不工作。两者都选中了“Just My Code”选项。两者都使用相同版本的Newtonsoft.Json(8.0.3)

这是VS 2015,Xamarin Forms在Android上运行。

1 个答案:

答案 0 :(得分:0)

In my case I had the debugger break on first chance exceptions for RuntimeBinderException, but when running on Android it was shown as "unhandled" exception in the debugger.

That threw me off for a moment, but after I found out I could continue running without problems I realised it was actually a first chance exception. After turning break on first chance exception of for RuntimeBinderException (since I wasn't interested in those at the time) it worked as expected.

To turn break on first chance exceptions on/off check the menu: Debug -> Windows -> Exception settings