简体   繁体   English

DirectWriteForwarder.dll 中发生异常“System.ExecutionEngineException”

[英]Exception 'System.ExecutionEngineException' occurred in DirectWriteForwarder.dll

I am building a WPF app on .NET Core 3.1.我正在 .NET Core 3.1 上构建 WPF 应用程序。 Basically, the setup of the app is a main screen with a tab control with two tabs.基本上,应用程序的设置是一个带有两个选项卡的选项卡控件的主屏幕。 Each tab has a thread running in the background to pull data from different devices.每个选项卡都有一个在后台运行的线程,用于从不同设备提取数据。

In each tab I have a frame that holds a page so that each page opens and closes every time the tab is changed to reduce load on the UI thread.在每个选项卡中,我都有一个包含页面的框架,以便每次更改选项卡时都会打开和关闭每个页面以减少 UI 线程上的负载。

<TabControl SelectedItem="{Binding SelectedMainTab, Mode=TwoWay}">

    <!-- SCAN TAB -->
    <TabItem x:Name="ScanTab">
        <TabItem.Header>
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Width="100" Height="40" HorizontalAlignment="Center">
                <TextBlock Style="{StaticResource TabTextBlock}" Text="Scan" VerticalAlignment="Center" Margin="5,0"/>
            </StackPanel>
        </TabItem.Header>
        <Frame Source="ScanView.xaml"/>
    </TabItem>

    <!-- VALIDATION TAB -->
    <TabItem x:Name="ValidationTab">
        <TabItem.Header>
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Width="150" Height="40" HorizontalAlignment="Center">
                <TextBlock Style="{StaticResource TabTextBlock}" Text="Validation" VerticalAlignment="Center" Margin="5,0"/>
            </StackPanel>
        </TabItem.Header>
        <Frame Source="ValidationView.xaml"/>
    </TabItem>
</TabControl>

Basically, when a page unloads, I have it stop the thread that was running, polling the device status.基本上,当页面卸载时,我让它停止正在运行的线程,轮询设备状态。 Simple enough.足够简单。 But what happens is when I load up the app and begin switching back and forth between the tabs.但是当我加载应用程序并开始在选项卡之间来回切换时会发生什么。 The UI freezes up and then it crashes with An Exception 'System.ExecutionEngineException' occurred in DirectWriteForwarder.dll UI 冻结,然后崩溃, An Exception 'System.ExecutionEngineException' occurred in DirectWriteForwarder.dll

There is no line number that this occurs on and from a bit of googling I can't seem to find much about what this DLL is except it is part of .net.没有任何行号发生在谷歌搜索上,除了它是 .net 的一部分之外,我似乎无法找到太多关于这个 DLL 是什么的信息。 Any assistance would be greatly appreciated!任何帮助将不胜感激!

EDIT编辑

Upon trying to replicate the error I also get it to crash with System.Collections.dll being the location the exception occurs.在尝试复制错误时,我也让它崩溃,System.Collections.dll 是发生异常的位置。 Same exception though.不过同样的例外。

So I might have an answer to my own question.所以我可能对我自己的问题有一个答案。 I did not fully determine the cause of the issue.我没有完全确定问题的原因。 But figured out it was something to do with garbage collection and probably how I was disposing of one thread when switching tabs.但是发现这与垃圾收集有关,并且可能与我在切换选项卡时如何处理一个线程有关。

Ultimately, on the unloading event of the page that is opened by the tab, I placed the "shutdown" functionalities inside a thread with IsBackground = true.最终,在选项卡打开的页面的卸载事件中,我将“关闭”功能放置在 IsBackground = true 的线程中。 This will allow them to dispose of themselves without some properties they use from the page being disposed of.这将允许他们在不处理他们使用的页面中的某些属性的情况下处理自己。

This has seemed to fix my issue since I do not receive that crash anymore.这似乎解决了我的问题,因为我不再收到崩溃了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 mscorlib.dll 中出现奇怪的错误“System.ExecutionEngineException” - Weird error 'System.ExecutionEngineException' occurred in mscorlib.dll XXX.exe中发生了未处理的“System.ExecutionEngineException”类型异常 - An unhandled exception of type 'System.ExecutionEngineException' occurred in XXX.exe 如何找到 System.ExecutionEngineException 异常的来源 - How to find source of System.ExecutionEngineException Exception 沉默“未知模块中出现类型&#39;System.ExecutionEngineException&#39;的未处理异常”错误 - Silencing “An unhandled exception of type 'System.ExecutionEngineException' occurred in Unknown Module” error 读取 Azure 密钥保管库会引发异常:System.ExecutionEngineException:“引发了‘System.ExecutionEngineException’类型的异常。” - Reading Azure key vault throws exception: System.ExecutionEngineException: 'Exception of type 'System.ExecutionEngineException' was thrown.' System.ExecutionEngineException 使用特定的 .dll (CodeArtEng.Gauge.dll) - System.ExecutionEngineException using especific .dll (CodeArtEng.Gauge.dll) 加载嵌入式DLL时引发System.ExecutionEngineException - System.ExecutionEngineException thrown when loading embedded DLL 尝试从user32.dll的GetWindowText()读取窗口时发生类型为&#39;System.ExecutionEngineException&#39;的未处理异常 - An unhandled exception of type 'System.ExecutionEngineException' occurring When trying to read window from GetWindowText() of user32.dll 给定System.ExecutionEngineException的GetMessage() - GetMessage() given an System.ExecutionEngineException 抛出System.ExecutionEngineException - System.ExecutionEngineException being thrown
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM