The first exception of type "Microsoft.CSharp.RuntimeBinder.RuntimeBinderException" is thrown

When using dynamic in Newtonsoft JObjects, I get a lot Microsoft.CSharp.RuntimeBinder.RuntimeBinderExceptionin my debug output. Although the trap exceptions are somewhere in Microsoft.CSharp.dll, it makes me uncomfortable that they happen. Is there anything I can do to stop them (different from giving up dynamics altogether)?

Here is a brief test program that throws one of these exceptions:

    using System;
    using Newtonsoft.Json.Linq;

    namespace DynamicTest {
        class Program {
            static void Main(string[] args) {
                JObject j = new JObject();
                j["DocumentName"] = "Name";
                dynamic d = j;
                d.DocumentName = "Changed";
            }
        }
    }
+4
source share
1 answer

The creator of JSON.Net himself accessed it here.

, , - . RuntimeBinderException , fooobar.com/questions/1586787/...

, , .

Visual Studio , ..

+12

All Articles