Markup Xaml Parse Exception

My WPF project throws xamal parse exception when it is run. this exception is thrown from main window when InitializeComponent method is called .How can I figure it out ?
here is the stack trace of this exception

System.Windows.Markup.XamlParseException
HResult=0x80131501
Message=Provide value on ‘System.Windows.Baml2006.TypeConverterMarkupExtension’ threw an exception.
Source=PresentationFramework
StackTrace:
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.ResourceDictionary.CreateObject(KeyRecord key)
at System.Windows.ResourceDictionary.OnGettingValue(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.OnGettingValuePrivate(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
at System.Windows.FrameworkElement.FindResourceInternal(FrameworkElement fe, FrameworkContentElement fce, DependencyProperty dp, Object resourceKey, Object unlinkedParent, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, DependencyObject boundaryElement, Boolean isImplicitStyleLookup, Object& source)
at System.Windows.FrameworkElement.FindImplicitStyleResource(FrameworkElement fe, Object resourceKey, Object& source)
at System.Windows.FrameworkElement.GetRawValue(DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry& entry)
at System.Windows.FrameworkElement.EvaluateBaseValueCore(DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry& newEntry)
at System.Windows.DependencyObject.EvaluateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry, OperationType operationType)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.FrameworkElement.UpdateStyleProperty()
at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
at System.Windows.FrameworkElement.TryFireInitialized()
at System.Windows.FrameworkElementFactory.InstantiateTree(UncommonField1 dataField, DependencyObject container, DependencyObject parent, List1 affectedChildren, List1& noChildIndexChildren, FrugalStructList1& resourceDependents)
at System.Windows.FrameworkElementFactory.InstantiateTree(UncommonField1 dataField, DependencyObject container, DependencyObject parent, List1 affectedChildren, List1& noChildIndexChildren, FrugalStructList1& resourceDependents)
at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate) at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField1 templateDataField, FrameworkElement container)
at System.Windows.FrameworkElement.ApplyTemplate()
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.Controls.TextBox.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.StackPanel.StackMeasureHelper(IStackMeasure measureElement, IStackMeasureScrollData scrollData, Size constraint)
at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Window.MeasureOverrideHelper(Size constraint)
at System.Windows.Window.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Window.SetRootVisual()
at System.Windows.Window.SetRootVisualAndUpdateSTC()
at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
at System.Windows.Window.ShowHelper(Object booleanBox)
at PM_Tool.App.OnStartup(StartupEventArgs e)
at System.Windows.Application.<.ctor>b__1_0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at PM_Tool.App.Main()

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
NotSupportedException: DependencyPropertyConverter cannot convert from System.String.

Tricky to say. there is something wring with your XAML ;).

Do you have any custom property converters, or any bindings that use property converters, in your Xaml? if so, I would review those for correctness, to start.

I notice that above error is generated by Metrial UI design . Does RemObject support Megrial UI ?

It’s not something I am familiar with or that we support explicitly , but if it uses standard Xaml/WPF, it should just work.

I had the same problem with the WPF control to preview a report in Telerik Reporting. Carlo agrees that this is a bug in the RemObjects XAML to BAML compiler, but the problem is that the BAML format is not documented, so Carlo Writes the compiler using reverse engineering.
I’ve solved the problem by creating a MS C# assembly with the XAML resource on it!

Is this the BAML issue we still have open from a few months back?

If convenient, can we get a testcase that has

  • the original xaml
  • the baml generated by VC# that works
  • the baml generated by Elements that fails

with that, I’d hope we can probably find the difference and update the baml compiler :crossed_fingers:t3:

I don’t know which one you are referring to, but it is bug 85521: Login | Portal | RemObjects Software.
It was entered in February 2021 and still has no solution.

Carlo has the testcase, but I can send it again, using a private message, because it contains the Telerik assemblies that are needed to compile the XAML file.

Pls do. in particular, including the good and the bad .balm (or binary containing it) would really be helpful.

Sent by private message.

1 Like

Here is the testcase with Material UI.

  1. In this testcase I tried to load a userControl in main window it was working fine
  2. but when I used matrial ui component in user control and run it again the project goes into debug mode for xaml and terminite the Application.
  3. As per suggestion of patrick, I made userControl in seprate class library project and tried to load this in main application,
    but it didn’t show any UI.

Can you please guide me?

Hello @mh,
did you find any solution of my problem ?

Not over the weekend, no. I’ve re-upped toe original issue logged for Patrick, with his new test case, and my colleague will take a look this week.

Which ,balls am I supposed to be comparing here, between VC# and Elements? the two MainWindow/Window1 balls look n other alike, but then, of course, neither do the originating .xaml files.n They also don’t really contain anything exciting that id’d expect to fail. as they are essentially empty.

Can you provide me with a a sample of THE EXACT VERY SAME .xaml and resulting .baml, once built with VC# and working, and built with Elements and not working?

I need (a) to know which balm to look at in the resulting binaries thats the culprit (the samples you sent had a handful, each) and (b) too know that the .xaml used to create these two balms was exactly the same down to the ‘t’.

thanx,
marc

Marc,
The xaml files are compiled to baml files and included in the application dll as resources. As far as I know, there is no possibility to export them as a single file.
image

All of the information was on my private message:

The ZIP contains the Telerik assemblies, an Oxygene solution and a C# solution with the Telerik.ReportViewer.Wpf.xaml file (the one that has problems).
You can find the balm compiled in the application dll file of both solutions.

Yes, that’s not what I was asking for.

Oxygene solution and a C# solution with the Telerik.ReportViewer.Wpf.xaml

that was the part I was missing. thanx. i take it (haven’t checked yet) these are 100% identical fro both apps, on the pre-compiled xaml side?

Damn, those two .bamls are still completely different, down to every single byte :(.

That’s by different compilers.
And the BAML decompilers often can’t decompile the one from Elements compiler.

Yes, they are both compiled from the same XAML file, included in the example.