none
Creating XPSDocument with xps path fails in case of large XPS files ~40MB RRS feed

  • Question

  • hi All

    we are trying to create xpsdocument for the available xpspath as follows.

    XpsDocument xpsDoc = new XpsDocument(XPSFullPath, FileAccess.Read);

    my xpsDoc is corrupted, when i pass larger xps files.

    Any help how this can be handled ?

    Highly appreciate any response.

    Wednesday, February 27, 2019 4:28 AM

All replies

  • Catch the exception and see why

    Wednesday, February 27, 2019 10:50 PM
  • Sorry for the late response

    the exception occurs on below line

    mDocPaginator = mXpsDoc.GetFixedDocumentSequence().DocumentPaginator;

    Exception details are below. ( i have problem uploading the image, hence giving the exception in the text )

    ex = {"Exception has been thrown by the target of an invocation."}

             Data = {System.Collections.ListDictionaryInternal}

             HResult = -2146232828

             InnerException = {"Insufficient memory to continue the execution of the program."}

             Message = "Exception has been thrown by the target of an invocation."

             Source = "mscorlib"

             StackTrace = "   at System.RuntimeMethodHandle.InvokeMethod(Object target,                                         Object[] arguments, Signature sig, Boolean constructor)\r\n   at                                                                                                                               System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object                                                                  obj, Object[] parameters, Object[] arguments)\r\n   at System.Refl...

                                  "   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)\r\n   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)\r\n   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)\r\n   at System.Xaml.Schema.SafeReflectionInvoker.InvokeMethodCritical(MethodInfo method, Object instance, Object[] args)\r\n   at System.Xaml.Schema.SafeReflectionInvoker.InvokeMethod(MethodInfo method, Object instance, Object[] args)\r\n   at System.Xaml.Schema.XamlTypeInvoker.AddToCollection(Object instance, Object item)\r\n   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.Add(Object collection, XamlType collectionType, Object value, XamlType valueXamlType)\r\n   at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentCollection(ObjectWriterContext ctx)\r\n   at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)\r\n   at System.Xaml.XamlObjectWriter.WriteEndObject()\r\n   at System.Xaml.XamlWriter.WriteNode(XamlReader reader)\r\n   at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)\r\n   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)\r\n   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, Boolean skipJournaledProperties, Uri baseUri)\r\n   at System.Windows.Markup.XamlReader.Load(XamlReader xamlReader, ParserContext parserContext)\r\n   at System.Windows.Markup.XamlReader.Load(XmlReader reader, ParserContext parserContext, XamlParseMode parseMode)\r\n   at System.Windows.Markup.XamlReader.Load(Stream stream, ParserContext parserContext)\r\n   at System.Windows.Xps.Packaging.XpsDocument.GetFixedDocumentSequence()\r\n   at HPECM.Model.InputOutputData..ctor() in "MYFILEPATH" "

    • Edited by ManjuCMNath Saturday, March 16, 2019 6:11 AM
    Saturday, March 16, 2019 6:03 AM