Closed WelterDevelopment closed 2 years ago
There is some rd.xml madness going on and I could not find any clue in the documentation on how to solve this. <Namespace Name="Monaco.Editor" Serialize="All" Dynamic="All"/>
does not seem to work with JsonConverters (like LineNumbersTypeConverter). A quick workaround for me was to reset the LineNumbers Property back to the old string type in IEditorOptions:
[JsonProperty("lineNumbers", NullValueHandling = NullValueHandling.Ignore)]
string LineNumbers { get; set; }
Thanks for digging in and finding the cause @WelterDevelopment. There may be some rd.xml stuff we can do in the component, I'll have to take a look.
I've added toggling this option in the sample app. I can see what you see in Release mode that it's updating on the C# side, but then just being turned off in the Monaco editor (and never turning back on); even though it's fine in Debug.
It's fine up until the point of serialization. I'm going to try debugging on the script side now to see what might be going on there on the receiving end to confirm.
Ok, from the script side it's still getting called to update, but in Debug it's getting passed the string value like "on", "off", "relative", etc... In Release mode it's being passed an int like 0, 1, 2 instead... 🤔
For whatever reason it seems like Json.NET can't infer the JsonTypeConverter
defined from the interface itself. If I declare the converter on the property, it works fine... No idea why. For now will just declare on property as well as that should resolve the issue.
Steps to reproduce:
This issue also occurs e.g. with Editor.Options.WordWrap and maybe even for more Editor.Options. I have not tested them all. And turning off the .NET Native Compiler is of course not an option since all UWP apps you want to submit to the Microsoft Store need to be compiled with this toolchain.