Why the ' ', hexadecimal value 0x0C, is an invalid character. Line 1, position 1. throws in WPF

StackOverflow https://stackoverflow.com/questions/14352651

  •  16-01-2022
  •  | 
  •  

Вопрос

When i load a xxxx.XAML into WPF frame it throws the error ' ', hexadecimal value 0x0C, is an invalid character. Line 1, position 1. how to find which is causing the problem. when the xxxx.XAML is in another project's start page, it works fine, when i load that condent of xxxx.XAML in arother project means it throws an error why this is happening ?

And also i upgrade my project from vs 2010 to vs 2012

Это было полезно?

Решение 2

In my file name, i have upper case X. while reading load the file i use small x. so it cause the problem

Другие советы

In my case it was that I wanted to load a XAML file using the code below, but it's Build Action was set to Page instead of Resource:

Uri uri = new Uri(resourcePath, System.UriKind.Relative);
Stream stream = Application.GetResourceStream(uri).Stream;
UIElement view = (UIElement)XamlReader.Load(stream);
stream.Close();
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top