RTF threading issue with 2021.3

Stimulsoft Reports.Wpf discussion
Post Reply
Posts: 8
Joined: Tue Jul 24, 2018 3:18 am

RTF threading issue with 2021.3

Post by jcfarsight » Thu Jun 10, 2021 8:53 pm

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?

Lech Kulikowski
Posts: 3696
Joined: Tue Mar 20, 2018 5:34 am

Re: RTF threading issue with 2021.3

Post by Lech Kulikowski » Tue Jun 15, 2021 8:55 am

Hello Justin,

Please send us a sample project that reproduces the issue for analysis.

Thank you.
Post Reply