2

I am getting an memory leak in below line of code.

 var fixedSequence = xpsDoc.GetFixedDocumentSequence();
 if (fixedSequence == null) return;  

I tried below given solutions.Adding UpdateLayout cannot solve the issue.

https://stackoverflow.com/a/7102886
https://stackoverflow.com/a/2410588

I'm facing below two exceptions due that windows service was crashed:

  1. Memory Out of Exception(at XpsDocument.GetFixedDocumentSequence())
  2. System.Windows.Markup.XamlParseException

Exception detail for System.Windows.Markup.XamlParseException

Exception Info: System.ComponentModel.Win32Exception
   at MS.Win32.UnsafeNativeMethods.CreateWindowEx(Int32, System.String, System.String, Int32, Int32, Int32, Int32, Int32, System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, System.Object)
   at MS.Win32.HwndWrapper..ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, System.String, IntPtr, MS.Win32.HwndWrapperHook[])
   at System.Windows.Media.MediaContextNotificationWindow..ctor(System.Windows.Media.MediaContext)
   at System.Windows.Media.MediaContext..ctor(System.Windows.Threading.Dispatcher)
   at System.Windows.Media.MediaContext.From(System.Windows.Threading.Dispatcher)
   at System.Windows.Media.Visual.VerifyAPIReadWrite()
   at System.Windows.Media.VisualCollection.Add(System.Windows.Media.Visual)
   at System.Windows.Controls.UIElementCollection.AddInternal(System.Windows.UIElement)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.Add(System.Object, System.Xaml.XamlType, System.Object, System.Xaml.XamlType)

Exception Info: System.Windows.Markup.XamlParseException
   at System.Windows.Markup.XamlReader.RewrapException(System.Exception, System.Xaml.IXamlLineInfo, System.Uri)
   at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
   at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, Boolean, System.Uri)
   at System.Windows.Markup.XamlReader.Load(System.Xaml.XamlReader, System.Windows.Markup.ParserContext)
   at System.Windows.Markup.XamlReader.Load(System.Xml.XmlReader, System.Windows.Markup.ParserContext, System.Windows.Markup.XamlParseMode)
   at System.Windows.Markup.XamlReader.Load(System.IO.Stream, System.Windows.Markup.ParserContext)
   at System.Windows.Xps.Packaging.XpsDocument.GetFixedDocumentSequence()
   at Softdocs.Imaging.MultiPageStreamSplitter.<OpenXpsDocument>b__1()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()
Dmitry Pavliv
  • 35,333
  • 13
  • 79
  • 80

0 Answers0