CefSharp crashing when javascript tries to parse an object containing a list sent from C# -


i'm using cefsharp have webbrowser run angularjs code inside winforms application.

i able send c# objects js side , use them if contain strings, ints, , on. when try send object containing list of values in it, cefsharp crashes when trys parse on js side.

an example of c# code:

public class testclass {     public string name { get; set; }     public string other { get; set; }     public list<int> ints { get; set; }  } 

working obj:

testclass tc = new testclass() {     name = "bobby test",     other = "hello" }; 

obj causing crashes:

testclass tc = new testclass() {     name = "bobby test",     other = "hello",     ints = new list<int>(){0,1} }; 

how pass js code:

browser.registerjsobject("testobj", tc); 

my angular code setting use:

$scope.$watch(function () { return window.testobj }, function () {     $scope.somefield = window.testobj; }); 

i tried doing jsonconvert.serializeobject on object before passing ended being empty object on js side.

edit - solution

c# js:

changed testclass to:

testclass tc = new testclass() {     name = "bobby test",     other = "hello",     ints = new int[] {0,1} }; 

and works correctly code above without having call serializing or deserializing methods directly.

js c#:

although wasn't in question:

i passing object js side callback function c#, callback function accepts serialized string js side deserialize on c# side.

chromium can handle javascript simple types (arrays, numbers, strings, etc)

what on server side complex data return json string:

javascriptserializer().serialize(myobject); 

and on client side reconstitute using

json.parse(myobjectasstring); 

works me


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -