RTF threading issue with 2021.3
Posted: Thu Jun 10, 2021 8:53 pm
Greetings,
We've just upgraded our Stimulsoft WPF library from 2020.5.2 to 2021.3.2 and it has started causing a problem when we upload an RTF disclaimer file.
Because we need to set the CanShrink/CanGrow properties to true, StiRichText requires the rendering to be done on an STA thread. This used to work in the old version but we are now encountering this exception:
StiUtil.<InternalRenderReport>b__0 The calling thread cannot access this object because a different thread owns it.
StiUtil.<InternalRenderReport>b__0 at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
at System.Windows.Media.SolidColorBrush.get_Color()
at Stimulsoft.Report.Wpf.ControlsV2.StiWpfV2ThemeHelper.InitResourcesForOffice2013Theme(ResourceDictionary dict1)
at Stimulsoft.Report.Wpf.ControlsV2.StiWpfV2ThemeHelper.LoadControlTheme(IStiWpfV2Control control)
at Stimulsoft.Report.Painters.StiRichTextWpfPainter.Measure(Double width, StiComponent comp)
at Stimulsoft.Report.Components.StiRichText.GetActualSize()
at Stimulsoft.Report.Components.StiContainerHelper.CheckSize(StiComponent component)
at Stimulsoft.Report.Engine.StiContainerV2Builder.InternalRender(StiComponent masterComp)
at Stimulsoft.Report.Engine.StiEngine.InternalRenderBand(StiBand band, Boolean ignorePageBreaks, Boolean allowRenderingEvents, Boolean& isChildsEnabled)
at Stimulsoft.Report.Engine.StiEngine.RenderBand(StiBand band, Boolean ignorePageBreaks, Boolean allowRenderingEvents)
at Stimulsoft.Report.Engine.StiPageHelper.RenderPage(StiPage page)
at Stimulsoft.Report.Engine.StiRenderProviderV2.RenderReport(StiReport report, StiReport masterReport, StiRenderState state)
at Stimulsoft.Report.Engine.StiRenderProviderV2.Render(StiReport report, StiRenderState state)
at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState)
at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
at Stimulsoft.Report.StiReport.RenderWithWpf(Boolean showProgress)
Could you please advise whether there is a solution we can implement?
Regards,
Justin
We've just upgraded our Stimulsoft WPF library from 2020.5.2 to 2021.3.2 and it has started causing a problem when we upload an RTF disclaimer file.
Because we need to set the CanShrink/CanGrow properties to true, StiRichText requires the rendering to be done on an STA thread. This used to work in the old version but we are now encountering this exception:
StiUtil.<InternalRenderReport>b__0 The calling thread cannot access this object because a different thread owns it.
StiUtil.<InternalRenderReport>b__0 at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
at System.Windows.Media.SolidColorBrush.get_Color()
at Stimulsoft.Report.Wpf.ControlsV2.StiWpfV2ThemeHelper.InitResourcesForOffice2013Theme(ResourceDictionary dict1)
at Stimulsoft.Report.Wpf.ControlsV2.StiWpfV2ThemeHelper.LoadControlTheme(IStiWpfV2Control control)
at Stimulsoft.Report.Painters.StiRichTextWpfPainter.Measure(Double width, StiComponent comp)
at Stimulsoft.Report.Components.StiRichText.GetActualSize()
at Stimulsoft.Report.Components.StiContainerHelper.CheckSize(StiComponent component)
at Stimulsoft.Report.Engine.StiContainerV2Builder.InternalRender(StiComponent masterComp)
at Stimulsoft.Report.Engine.StiEngine.InternalRenderBand(StiBand band, Boolean ignorePageBreaks, Boolean allowRenderingEvents, Boolean& isChildsEnabled)
at Stimulsoft.Report.Engine.StiEngine.RenderBand(StiBand band, Boolean ignorePageBreaks, Boolean allowRenderingEvents)
at Stimulsoft.Report.Engine.StiPageHelper.RenderPage(StiPage page)
at Stimulsoft.Report.Engine.StiRenderProviderV2.RenderReport(StiReport report, StiReport masterReport, StiRenderState state)
at Stimulsoft.Report.Engine.StiRenderProviderV2.Render(StiReport report, StiRenderState state)
at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState)
at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
at Stimulsoft.Report.StiReport.RenderWithWpf(Boolean showProgress)
Could you please advise whether there is a solution we can implement?
Regards,
Justin