找回密码
 立即注册

QQ登录

只需一步,快速开始

hzt0099

注册会员

2

主题

4

帖子

48

积分

注册会员

积分
48
最新发帖
hzt0099
注册会员   /  发表于:2018-3-11 15:32  /   查看:3228  /  回复:3
Exception details:
System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
   在 System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
   在 System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   在 System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   在 System.Type.GetType(String typeName)
   在 System.Drawing.Printing.PrintDocument.get_PrintController()
   在 GrapeCity.ActiveReports.Extensibility.Printing.Printer.set_PrintController(PrintController value)
   在 GrapeCity.ActiveReports.Extensibility.Printing.Printer.get_PrintController()
   在 GrapeCity.ActiveReports.Viewer.Win.Printing.PrintImpl.Print(#q0B documentPrintAdapter, Boolean showPrintDialog, Boolean showPrintProgressDialog, Boolean usePrintingThread, Action`1 action)
   在 GrapeCity.ActiveReports.Viewer.Win.Printing.PrintImpl.Print(DocumentModel documentModel, ReportModelBase reportModel, IApplicationContext context, Boolean showPrintDialog, Boolean showPrintProgressDialog, Boolean usePrintingThread)
   在 GrapeCity.ActiveReports.Viewer.Win.WindowsPrintService.Print(DocumentModel documentModel, ReportModelBase reportModel, IApplicationContext context, Boolean showPrintDialog, Boolean showPrintProgressDialog, Boolean usePrintingThread)
   在 GrapeCity.Viewer.Common.ViewModel.ToolbarViewModel.<>c__DisplayClass3e.#9kz()

---打印的时候隔三差五的就报这个错,有时候直接导致程序闪退,请帮忙看看是我程序问题还是ActiveReports的bug。我用的是activeReports 8
谢谢。

3 个回复

倒序浏览
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-3-11 16:04:32
沙发
本帖最后由 KearneyKang 于 2018-3-12 09:32 编辑

将dll里函数需要返回的局部变量声明为static,然后再重新调试运行看看
回复 使用道具 举报
hzt0099
注册会员   /  发表于:2018-3-12 17:28:29
板凳
LZ您好
Dim Type As Type  Type = System.Reflection.Assembly.GetExecutingAssembly().GetType(strContactClass, False)
Dim ClassObj As Object = Activator.CreateInstance(Type, COMPANY_NO, DEFAULT_CONTACT_ID, DEFAULT_CENTER_NO, DOC_NO, LIST_BY, ReportPara)  
ClassObj.Run()
ReportViewer.Document = ClassObj.Document
我不明白您说的将dll里面需要返回的函数声明为static是啥意思?在打印的时候我先反射加载画好的报表显示预览,然后点击viewer控件上的打印按钮打印,这个逻辑有问题吗?
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-3-12 18:10:47
地板
您好!就是把左右的引用设置为复制到本地。
如下截图:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部