来自WPF应用程序的MS Access Application.Run返回AccessViolationException

时间:2014-09-18 14:25:11

标签: c# wpf multithreading ms-access-2010 .net-4.5

因为我们将.net Framework 4.0中的WPF Soulution更新为4.5,导致AccessViolationException和MS Access崩溃。 (或Framework 4.5安装在本地)

我们有一个自己的WPF Gui线程。 当我们想从WPF表单启动Access窗体时,我们得到一个AccessViolationException。 当我们调用“Application.Run”时,活动线程是我们自己的WPF线程。 访问线程状态是“背景”

简短的示例:开始访问 - >调用WPF GUI - >调用Access Application = Exception

是否可以激活访问线程或在此线程上调用方法“运行”? 还是有其他解决方案吗?

.net Framework 4.5 for Threading是否会有一些重大变化会引发此异常?

谢谢,蒂姆

呼叫访问表单:

using Application = Microsoft.Office.Interop.Access.Application;

Application.Run(procedure, ref arg1, ref arg2, ref arg3, ref arg4, ref arg5, ref arg6, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing, ref _missing); 

从Access调用WPF Form看起来像这样:

Declare Sub ActivityLog_ShowForProductionOrder Lib "MawiLib.dll" (ByVal ProductionOrderID As Long, ByVal UserID As String) 

Call ActivityLog_ShowForProductionOrder(ProductionOrderID, UserID) 

0 个答案:

没有答案