Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High Contrast resource dictionary reference in ModernWpf.SampleApp throws System.Windows.Markup.XamlParseException #659

Open
dostjh opened this issue Dec 24, 2023 · 0 comments

Comments

@dostjh
Copy link

dostjh commented Dec 24, 2023

DESCRIPTION
I tried to clone the ModernWpf repository and compile and run the ModernWpf.SampleApp with no changes since I wanted to browse the controls and their functionality. The build compiles fine. But I hit an exception on application execution before startup completes.


Inner Exception
Exception: Cannot find resource named 'SystemColorButtonTextColorBrush'. Resource names are case sensitive.

This occurs on several brushes.

Eventually, I resorted to commenting out the reference to the HighContrast resource dictionary in ModernWpf\ModernWpf.SampleApp\App.xaml line 37 through 41 to get the application to run.

I am cloned to commit 218e8ec100caf4f653835d207977e631b869f7a4.
I am running Windows 11.

Call Stack:

	PresentationFramework.dll!System.Windows.Markup.XamlReader.RewrapException(System.Exception e, System.Xaml.IXamlLineInfo lineInfo, System.Uri baseUri) Line 362	C#
 	PresentationFramework.dll!System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader xamlReader, System.Xaml.IXamlObjectWriterFactory writerFactory, bool skipJournaledProperties, object rootObject, System.Xaml.XamlObjectWriterSettings settings, System.Uri baseUri) Line 121	C#
 	PresentationFramework.dll!System.Windows.ResourceDictionary.CreateObject(System.Windows.Baml2006.KeyRecord key) Line 1176	C#
 	PresentationFramework.dll!System.Windows.ResourceDictionary.OnGettingValue(object key, ref object value, out bool canCache) Line 985	C#
 	PresentationFramework.dll!System.Windows.ResourceDictionary.OnGettingValuePrivate(object key, ref object value, out bool canCache) Line 950	C#
 	PresentationFramework.dll!System.Windows.ResourceDictionary.GetValueWithoutLock(object key, out bool canCache) Line 684	C#
 	PresentationFramework.dll!System.Windows.ResourceDictionary.GetValue(object key, out bool canCache) Line 676	C#
 	PresentationFramework.dll!System.Windows.ResourceDictionary.ResourceDictionaryEnumerator.System.Collections.IDictionaryEnumerator.Entry.get() Line 42	C#
 	PresentationFramework.dll!System.Windows.ResourceDictionary.ResourceDictionaryEnumerator.System.Collections.IEnumerator.Current.get()	C#
 	ModernWpf.dll!ModernWpf.ColorsHelper.UpdateBrushes(System.Windows.ResourceDictionary themeDictionary, System.Windows.ResourceDictionary colors) Line 101	C#
 	ModernWpf.dll!ModernWpf.ColorsHelper.UpdateBrushes(System.Windows.ResourceDictionary themeDictionary) Line 96	C#
 	ModernWpf.dll!ModernWpf.ThemeManager.ApplyAccentColor() Line 198	C#
 	ModernWpf.dll!ModernWpf.ThemeManager.Initialize() Line 797	C#
 	ModernWpf.dll!ModernWpf.ThemeResources.EndInit() Line 214	C#
 	ModernWpf.dll!ModernWpf.ThemeResources.System.ComponentModel.ISupportInitialize.EndInit() Line 238	C#
 	System.Xaml.dll!MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(System.Xaml.XamlType xamlType, object obj, bool begin)	Unknown
 	System.Xaml.dll!System.Xaml.XamlObjectWriter.Logic_EndInit(MS.Internal.Xaml.Context.ObjectWriterContext ctx)	Unknown
 	System.Xaml.dll!System.Xaml.XamlObjectWriter.WriteEndObject()	Unknown
 	PresentationFramework.dll!System.Windows.Markup.WpfXamlLoader.TransformNodes(System.Xaml.XamlReader xamlReader, System.Xaml.XamlObjectWriter xamlWriter, bool onlyLoadOneNode, bool skipJournaledProperties, bool shouldPassLineNumberInfo, System.Xaml.IXamlLineInfo xamlLineInfo, System.Xaml.IXamlLineInfoConsumer xamlLineInfoConsumer, MS.Internal.Xaml.Context.XamlContextStack<System.Windows.Markup.WpfXamlFrame> stack, System.Windows.Markup.IStyleConnector styleConnector) Line 167	C#
 	PresentationFramework.dll!System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader xamlReader, System.Xaml.IXamlObjectWriterFactory writerFactory, bool skipJournaledProperties, object rootObject, System.Xaml.XamlObjectWriterSettings settings, System.Uri baseUri) Line 111	C#
 	PresentationFramework.dll!System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader xamlReader, bool skipJournaledProperties, object rootObject, System.Xaml.Permissions.XamlAccessLevel accessLevel, System.Uri baseUri) Line 38	C#
 	PresentationFramework.dll!System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream stream, System.Windows.Markup.ParserContext parserContext, object parent, bool closeStream) Line 764	C#
 	ModernWpf.SampleApp.exe!ModernWpf.SampleApp.App.InitializeComponent() Line 1	C#
 	ModernWpf.SampleApp.exe!ModernWpf.SampleApp.App.Main()	Unknown

Note, I am running on Windows 11, so maybe high contrast is differently set up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant