Bug 12614 - Fail to open c# files or Edit->Preferences->Syntax Highlighting [with workaround]
Summary: Fail to open c# files or Edit->Preferences->Syntax Highlighting [with workaro...
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: master
Assignee: Mike Krüger
Depends on:
Reported: 2013-06-09 22:23 UTC by wjywbs
Modified: 2013-06-09 23:55 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description wjywbs 2013-06-09 22:23:27 UTC
I used archlinux monodevelop 4.0.8-1 package in Ubuntu. When I opened MonoDevelop and open a c# file, an error window appeared. 

The file '.....MainForm.Designer.cs' could not be opened. Error while loading style :Default
System.IO.IOException: Error while loading style :Default ---> System.IO.InvalidDataException: Scheme Default is not valid.
  at Mono.TextEditor.Highlighting.ColorScheme.LoadFrom (System.IO.Stream stream) [0x003bf] in /build/monodevelop/src/monodevelop-4.0.8/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs:640 
  at Mono.TextEditor.Highlighting.SyntaxModeService.LoadStyle (System.String name) [0x00098] in /build/monodevelop/src/monodevelop-4.0.8/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs:120 
  --- End of inner exception stack trace ---
(More removed)

Then I built from trunk, master branch and followed instructions "Getting MonoDevelop from the Git repository". It also has this problem. So I made some changes in ColorScheme.cs to see which colors are missing. "Background(Read Only)" and "Plain Text" are missing.

I found monodevelop/main/src/core/Mono.Texteditor/Styles/DefaultStyle.json,
		{ "name": "Background(Read Only)", "color":"white" },

		{ "name": "Plain Text", "fore":"text-black", "back":"white" },

They appeared to be the first element in each node. Then I added an useless line before it:
		{ "name": "Background(Read Only)1", "color":"white" },
		{ "name": "Background(Read Only)", "color":"white" },
		{ "name": "Plain Text1", "fore":"text-black", "back":"white" },
		{ "name": "Plain Text", "fore":"text-black", "back":"white" },

Re-compile, and this issue is solved.

It turned out to be some bug in System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonReader.
Comment 1 Mike Krüger 2013-06-09 23:55:29 UTC
It's a bug in mono - use a newer mono it's solved there.