Closed isaacabraham closed 7 years ago
Can you post a minimal amount of xaml to reproduce?
On Oct 25, 2016 6:02 AM, "Isaac Abraham" notifications@github.com wrote:
Description
Creating a new Window which has an image in it - I've tried as both Icon of the window or as a background image on a child control. The image is a content resource and shows in the designer file - but when I run the application, as soon as I create the window, I get: -
An unhandled exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll Additional information: XAML Node Stream: Missing CurrentObject before EndObject.
Any way I can get around this?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fsprojects/FsXaml/issues/53, or mute the thread https://github.com/notifications/unsubscribe-auth/AFCUmpj74qXvIpEVTpTi3g71fexV9mOkks5q3f3BgaJpZM4Kf9Ft .
Yes - will do. Apologies for delay in this.
I think that this is a related issue (and again, most likely just my mistake) - when trying to use static resources. Here's an example hello world project that just tries to add a converter as a static resource in a window and then use it: -
https://github.com/isaacabraham/wpf-error/tree/master/FsEmptyWindowsApp2/FsEmptyWindowsApp2
The error I get back is: -
Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll
Additional information: 'Cannot create unknown type '{clr-namespace:ViewModels}MyConverter'.' Line number '9' and line position '10'.
Again, the converter works fine - even in the designer. Just at runtime after creating the window through FSXaml and then calling Run on it.
@isaacabraham workaround - you can just specify assembly:
xmlns:converters="clr-namespace:ViewModels;assembly=FsEmptyWindowsApp2"
Thanks - that worked! Why does this happen though?
This is a limitation (ie: necessity) when using FsXaml. Since we're not compiling the XAML into BAML in the same assembly, at runtime, it's being loaded outside of the assembly, which requires including the assembly in the xmlns
definitions.
I'd like to figure out a way to not require this, but at this point, it's required to use any resources (whether in the assembly or outside of it).
Description
Creating a new Window which has a PNG image in it - I've tried as both Icon of the window or as a background image on a child control. The image is a content resource and shows in the WPF designer - but when I run the application, as soon as I create the window, I get: -
An unhandled exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll Additional information: XAML Node Stream: Missing CurrentObject before EndObject.
Any way I can get around this?