如何解决XamlParserException [英] How to I resolve the XamlParserException

查看:65
本文介绍了如何解决XamlParserException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在WPF应用程序中收到了XamlParserException。



可以有人帮忙吗?



这是异常的堆栈跟踪。



System.Windows。 Markup.XamlParseException:'System.Windows.Baml2006.TypeConverterMarkupExtension'の値の指定时に例外がスローされました.---> System.ArgumentOutOfRangeException:インデックスが范囲を超えています。负でないまで,コレクションのサイズよりも小さくなければなりません。

パラメーター名:index

at System.ThrowHelper.ThrowArgumentOutOfRangeException()

在System.Collections.Generic.List`1.get_Item(Int32 index)

在System.Windows.Media.Imaging.BitmapDecoder。 SetupFrames(BitmapDecoder解码器,ReadOnlyCollection`1帧)

在System.Windows.Media.Imaging.BitmapDecoder.Initialize(BitmapDecoder解码器)

在System.Windows.Media.Imaging .BitmapDecoder..ctor(SafeMILHandle decoderHandle,BitmapDecoder decoder,Uri baseUri,Uri uri,Stream stream,BitmapCreateOptions createOptions,BitmapCacheOption cacheOption,Boolean insertInDecoderCache,Boolean isOriginalWritable,Stream uriStream,UnmanagedMemoryStream unmanagedMemoryStream,SafeFileHandle safeFilehandle)

在System.Windows.Media。 Imaging.PngBitmapDecoder..ctor(SafeMILHandle decoderHandle,BitmapDecoder decoder,Uri baseUri,Uri uri,Stream stream,BitmapCreateOptions createOptions,BitmapCacheOption cacheOption,Boolean insertInDecoderCache,Boolean originalWritable,Stream uriStream,UnmanagedMemoryStream unmanagedMemoryStream,SafeFileHandle safeFilehandle)

在System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri,Uri uri,Stream stream,BitmapCreateOptions createOptions,BitmapCacheOption cacheOption,RequestCachePolicy uriCachePolicy,Boolean insertInDecoderCache)

在System.Windows.Media。 Imaging.BitmapFrame.CreateFromUriOrStream(Uri baseUri,Uri uri,Stream stream,BitmapCreateOptions createOptions,BitmapCacheOption cacheOption,RequestCachePolicy uriCachePolicy)

at System.Windows.Media.ImageSourceConverter.ConvertFrom(ITypeDescriptorContext context,CultureInfo culture,Object价值)

在System.Windows.Baml2006.TypeConverterMark upExtension.ProvideValue(IServiceProvider serviceProvider)

at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me,IServiceProvider serviceProvider)

---内部例外スタックトレースの在System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader,IXamlObjectWriterFactory writerFactory,Boolean skipJournaledProperties,Object rootObject,XamlObjectWriterSettings设置,Uri baseUri)终止


at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader,Boolean skipJournaledProperties,Object rootObject,XamlAccessLevel accessLevel,Uri baseUri)

at System.Windows.Markup.XamlReader.LoadBaml(Stream stream,ParserContext parserContext, Object parent,Boolean closeStream)

在System.Windows.Application.LoadComponent(对象组件,Uri resourceLocator)

在PenSoft.PrintSubmenuControl.InitializeComponent()

at PenSoft.PrintSubmen uControl..ctor(MainWindow parent)

at PenSoft.PrintSubmenuControl..ctor(PrintEventArgs args,MainWindow parent)

at PenSoft.MainWindow.CreatePrintControl(Int32 id)

at PenSoft.MainWindow.CreateSubmenuControl(Squaremenu squareMenu,SubSquareMenu submenuType)

at PenSoft.ClassicMenuControl.InitLargeClassicMenu()

at PenSoft.MainWindow.Window_Loaded(对象发送者,RoutedEventArgs e)

在System.Windows.RoutedEventHandlerInfo.InvokeHandler(对象目标,RoutedEventArgs routedEventArgs)

在System.Windows.EventRoute.InvokeHandlersImpl(对象源,RoutedEventArgs) args,Boolean reRaised)

在System.Windows.UIElement.RaiseEventImpl(DependencyObject sender,RoutedEventArgs args)

在System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)

在System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root,RoutedEvent routedEvent)

在System.Wi ndows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)

at MS.Internal.LoadedOrUnloadedOperation.DoWork()

at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()

在System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()

在System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)

在System。 Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)

在System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)

在System.Windows.Interop.HwndTarget。 OnResize()

在System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg,IntPtr wparam,IntPtr lparam)

在System.Windows.Interop.HwndSource.HwndTargetFilterMessage( IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean&handling)

at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd,Int32 msg,IntP tr wParam,IntPtr lParam,Boolean&handling)

at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback) ,对象args,Int32 numArgs)

at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source,Delegate方法,Object args,Int32 numArgs,Delegate catchHandler)



感谢提前。

Harish Reddy。

Hi Everyone,

I'm getting the XamlParserException in the WPF application.

Can anyone help in this?

Here is the Stack trace of the exception.

System.Windows.Markup.XamlParseException: 'System.Windows.Baml2006.TypeConverterMarkupExtension' の値の指定時に例外がスローされました。 ---> System.ArgumentOutOfRangeException: インデックスが範囲を超えています。負でない値で、コレクションのサイズよりも小さくなければなりません。
パラメーター名: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Windows.Media.Imaging.BitmapDecoder.SetupFrames(BitmapDecoder decoder, ReadOnlyCollection`1 frames)
at System.Windows.Media.Imaging.BitmapDecoder.Initialize(BitmapDecoder decoder)
at System.Windows.Media.Imaging.BitmapDecoder..ctor(SafeMILHandle decoderHandle, BitmapDecoder decoder, Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, Boolean insertInDecoderCache, Boolean isOriginalWritable, Stream uriStream, UnmanagedMemoryStream unmanagedMemoryStream, SafeFileHandle safeFilehandle)
at System.Windows.Media.Imaging.PngBitmapDecoder..ctor(SafeMILHandle decoderHandle, BitmapDecoder decoder, Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, Boolean insertInDecoderCache, Boolean originalWritable, Stream uriStream, UnmanagedMemoryStream unmanagedMemoryStream, SafeFileHandle safeFilehandle)
at System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy, Boolean insertInDecoderCache)
at System.Windows.Media.Imaging.BitmapFrame.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy)
at System.Windows.Media.ImageSourceConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.Windows.Baml2006.TypeConverterMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
--- 内部例外スタック トレースの終わり ---
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at PenSoft.PrintSubmenuControl.InitializeComponent()
at PenSoft.PrintSubmenuControl..ctor(MainWindow parent)
at PenSoft.PrintSubmenuControl..ctor(PrintEventArgs args, MainWindow parent)
at PenSoft.MainWindow.CreatePrintControl(Int32 id)
at PenSoft.MainWindow.CreateSubmenuControl(Squaremenu squareMenu, SubSquareMenu submenuType)
at PenSoft.ClassicMenuControl.InitLargeClassicMenu()
at PenSoft.MainWindow.Window_Loaded(Object sender, RoutedEventArgs e)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at MS.Internal.LoadedOrUnloadedOperation.DoWork()
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)
at System.Windows.Interop.HwndTarget.OnResize()
at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

THANKS in Advance.
Harish Reddy.

推荐答案

这篇关于如何解决XamlParserException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆