cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.88k stars 2.92k forks source link

SerializeV8SimpleObject does not support ExpandoObject #4958

Closed mitchcapper closed 1 month ago

mitchcapper commented 1 month ago

Is there an existing issue for this?

CefSharp Version

129

Operating System

Windows 10

Architecture

x64

.Net Version

.net 8

Implementation

WPF

Reproduction Steps

Per https://github.com/cefsharp/CefSharp/discussions/4937 I found the 'simple':

var curExtSettings = (Dictionary<string,object>) context.GetPreference("extensions.settings");
context.SetPreference("extensions.settings", curExtSettings, out errSet);

fails. The cefclient shows us it should be possible. Digging into it the serialization used for SetPreference only handles generic IDictionaries but not typed ones like expandoObject.

Expected behavior

getting and setting the settings works

Actual behavior

settings store is corrupted visiting extension page will crash, corrupt json will be written to disk, restarting however does seem to do some cleanup.

Regression?

no

Known Workarounds

Force an object containing expandoobjects to be converted prior to being sent for serialization

Does this problem also occur in the CEF Sample Application

No

Other information

will submit PR #4959