- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在做一个项目,遇到了一个问题。当我运行我的代码时,我收到此错误消息:
The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception
消息的标题是“TypeInitializerException was unhandled”。
我在这行代码收到此错误:
this.crystalReportViewer = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
我一直在寻找解决此问题的方法,但我一直遇到另一个问题。我找到的关于如何解决这个问题的所有内容都表明平台目标应该更改为 x86。遵循该建议的所有评论总是积极的,因为它似乎对每个人都有效,但对我不起作用。我还尝试将平台目标设为 x64。当我这样做时,我没有收到前面提到的错误,而是收到一个新的错误:
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
此 消息的标题是“未处理 InvalidOperationException”。错误就在这一行:
db.Open();
db,当然,被设置为一个新的 OleDbConnection(connection)。连接 = 一个 Access 数据库。
为什么当平台目标是 x86 时我收到第一个错误而不是第二个错误,如果平台目标是 x64 则反之亦然?
堆栈跟踪:
System.TypeInitializationException was unhandled
Message=The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception.
Source=CrystalDecisions.Shared
TypeName=CrystalDecisions.Shared.SharedUtils
StackTrace:
at CrystalDecisions.Shared.SharedUtils.get_CurrentControl()
at CrystalDecisions.Shared.SharedUtils.GetEffectiveCulture()
at CrystalDecisions.Shared.LocaleManager..ctor()
at CrystalDecisions.Windows.Forms.CrystalReportViewer.InitReportViewer()
at CrystalDecisions.Windows.Forms.CrystalReportViewer..ctor()
at Client_Manager.ReportViewer.InitializeComponent() in C:\Users\Will\Desktop\Client_Manager\SyndicateII\ReportViewer.Designer.cs:line 31
at Client_Manager.ReportViewer..ctor() in C:\Users\Will\Desktop\Client_Manager\SyndicateII\ReportViewer.cs:line 27
at Client_Manager.Form1..ctor() in C:\Users\Will\Desktop\Client_Manager\SyndicateII\Form1.cs:line 174
at Client_Manager.Program.Main() in C:\Users\Will\Desktop\Client_Manager\SyndicateII\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.BadImageFormatException
Message=Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=CrystalDecisions.Shared
FileName=log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
FusionLog==== Pre-bind state information ===
LOG: User = Will-PC\Will
LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
(Fully-specified)
LOG: Appbase = file:///C:/Users/Will/Desktop/Client_Manager/SyndicateII/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Will\Desktop\Client_Manager\SyndicateII\bin\Debug\Client_Manager.vshost.exe.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
LOG: Attempting download of new URL file:///C:/Users/Will/Desktop/Client_Manager/SyndicateII/bin/Debug/log4net.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
StackTrace:
at CrystalDecisions.Shared.SharedUtils..cctor()
InnerException:
最佳答案
这看起来像是原始问题:
InnerException: System.BadImageFormatException
Message=Could not load file or assembly 'log4net, Version=1.2.10.0,
Culture=neutral, PublicKeyToken=692fbea5521e1304'
or one of its dependencies. An attempt was made to load a program
with an incorrect format.
所以看起来要么您使用了错误的 log4net 版本,如果它针对不同的体系结构有多个版本,或者您只是错误地复制了程序集。日志的这一部分似乎也相关:
LOG: Attempting download of new URL
file:///C:/Users/Will/Desktop/Client_Manager/SyndicateII/bin/Debug/log4net.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
这看起来像是您需要检查正确性的文件。
关于c# - 'CrystalDecisions.Shared.SharedUtils' 的类型初始值设定项抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12374681/
我收到错误“CrystalDecisions.CrystalReports.Engine.dll”丢失。我可以从哪里下载 DLL。我已经安装了 sap CrystalDecisions 但它给出了同样
我的用户的终端运行 2 应用程序。其中一个我使用 VS 2005 和 Crystal Reports 捆绑版本构建了一个应用程序,另一个使用不同 Crystal Report 版本的外部产品。大约有
我正在做一个项目,遇到了一个问题。当我运行我的代码时,我收到此错误消息: The type initializer for 'CrystalDecisions.Shared.SharedUtils'
我在 SO 上看过类似的问题,但据我所知,没有什么与我的问题完全匹配。 异常信息: Could not load file or assembly 'CrystalDecisions.ReportAp
ppI 正在尝试使用 Crystal 报告部署应用程序,asp.net 3.5 在 Vs2008 中开发。 在我的开发箱上,我有 CrystalDecisions.Shared 11.5.3300 和
Could not load file or assembly 'CrystalDecisions.ReportAppServer.ClientDoc, Version=10.5.3700.0, Cu
我正在为使用 Crystal Reports API 显示和打印表单的客户部署桌面应用程序。我正在使用 InstallShield 2012 构建安装程序。我还包括了 .NET 4.0 Framewo
一直在工作单应用程序上工作,并且进展顺利。前几天,我下载并安装了Crystal报表,并在我的项目中设计了一个报表。经过编码后,我决定对其进行测试。当我在VS 2010中重建解决方案时,突然出现了66个
我尝试通过 IIS 管理器在另一台 PC 本地打开已经创建的 ASP.NET 项目。但是我收到了这个错误: CS0246:找不到类型或命名空间名称“CrystalDecisions”(是否缺少 usi
运行 Crystal 报表时出现以下错误 CS0433: The type 'CrystalDecisions.Web.CrystalReportViewer' exists in both 'c:\
我写了一个使用 ReportViewer 的 .NET DLL在 VS2010 中。在开发计算机上,它运行良好。但是,当我在客户端上安装该程序时,我收到错误消息 Crystaldecisions.Cr
我有 2 个 Windows 程序。 程序A:用visual studio 2015 和Crystal Report SP18 创建 程序B:使用visual studio 2017 和Crystal
在我的 asp.net 3.5 a3 层应用程序中使用 Crystal 报表时出现以下错误 The type or namespace name 'CrystalReportViewer' does
我正在使用 CrystalDecisions.CrystalReports.Engine获取 FormulaField、FieldObject 等的属性。但是如何获取 FieldObject 的抑制条
我们有一个用 .NET 4.0 编写的应用程序,它使用这个 SAP Crystal Reports。虽然相同的构建 (x86) 在安装了 .NET 4.0 框架 (x86) 和 CrystalRepo
你好 我想上传我的网络应用程序,但出现以下错误。 Server Error in '/' Application. Configuration Error Description: An error
我开发了一个简单的项目。我必须在那里打印一些 Crystal 报告。该项目在本地机器上运行良好,但是当我在网络托管服务器上启动它时,它在查看 Crystal 报告时显示错误。 Could not lo
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 5 年前。 Improve this qu
我是一名优秀的程序员,十分优秀!