The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception

An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object. The error is : The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception

Vb.net tutorial for beginners - This lessons will show you how to fix some error in Crystal Report Applications Development. When you have published your simple application that use vb.net or C#.net using installShield.

Some error will be like

An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object.
The error is : The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception

The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception

Solutions 1:

When a static constructor throws an exception, it is wrapped inside a TypeInitializationException. You need to check the exception object's InnerException property to see the actual exception.

In a staging / production environment (where you don't have Visual Studio installed), you'll need to either:
  1. Trace/Log the exception and its InnerException (recursively): Add an event handler to the AppDomain.UnhandledException event, and put your logging/tracing code there. Use System.Diagnostics.Debug.WriteLine for tracing, or a logger (log4net, ETW). DbgView (a Sysinternals tool) can be used to view the Debug.WriteLine trace.
  2. Use a production debugger (such as WinDbg or NTSD) to diagnose the exception.
  3. Use Visual Studio's Remote Debugging to diagnose the exception (enabling you to debug the code on the target computer from your own development computer).

Solutions 2 :

If you are installing on a 64-bit machine, make sure the application properties under the Build tab have "Any CPU" as the platform target, and unselect the check box for "Prefer 32-bit" if you have the option. Crystal is very touchy about 32/64 bit assemblies, and makes some pretty counterintuitive assumptions which are very difficult to troubleshoot.

Solution 3 :

  1. i set x86 for my application, then i set x64 for my setup application
  2. Prerequisite: i Placed the supporting CR runtime file CRRuntime_32bit_13_0_10.msi, CRRuntime_64bit_13_0_10.msi in the following directory C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\Crystal Reports for .NET Framework 4.0
  3. Include merge module file to the setup project. Here is version is not serious thing because i use 13.0.10 soft, 13.0.16 merge module file File i included: CRRuntime_13_0_16.msm This file is found one among the set msm files.
While installing this Merge module will add the necessary dll in the following dir C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet

dll file version will not cause any issues.

In your developer machine you confirm it same.

List Video Tutorial VB.NET For beginners



List Video tutorials C# for Beginners



references :
http://stackoverflow.com/questions/16658300/the-type-initializer-for-crystaldecisions-crystalreports-engine-reportdocument

http://stackoverflow.com/questions/2866831/an-error-occurred-creating-the-form-see-exception-innerexception-for-details-t

See you next lessons .....

COMMENTS

Next Recomended


Feel free to code it up and send us a pull request.

Hi everyone, let's me know how much this lesson can help your work. Please Subscribe and Follow Our Social Media 'kodeajaib[dot]com' to get Latest tutorials and will be send to your email everyday for free!, Just hit a comment if you have confused. Nice to meet you and Happy coding :) all ^^



Follow by E-Mail


Name

ADO.NET,3,Ajax,6,Android,9,AngularJS,4,ASP.NET,4,Blogger Tutorials,7,Bootstrap,7,C++,1,Codeigniter,2,Cplusplus,6,Crystal Report,6,CSharp,25,Ebook Java,2,FlyExam,1,FSharp,3,Game Development,2,Java,35,JDBC,2,Laravel,84,Lumen,2,MariaDB,2,Ms Access,3,MySQL,31,ODBC,6,OleDB,1,PHP,14,PHP Framework,5,PHP MYSQLI,9,PHP OOP,5,Python,8,Python 3,4,SQL Server,4,SQLite,4,Uncategorized,5,Vb 6,2,Vb.Net,89,Video,48,Vue Js,4,WPF,2,Yii,3,
ltr
item
KODE AJAIB: The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception
The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception
An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object. The error is : The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception
https://1.bp.blogspot.com/-V--W4L9AWsM/WBneA65OzwI/AAAAAAAACxM/JhjnyYuFpcQYNroja_R5j3pStx4vRVS7gCLcB/s320/crystall%2Breport%2Berror.png
https://1.bp.blogspot.com/-V--W4L9AWsM/WBneA65OzwI/AAAAAAAACxM/JhjnyYuFpcQYNroja_R5j3pStx4vRVS7gCLcB/s72-c/crystall%2Breport%2Berror.png
KODE AJAIB
https://www.kodeajaib.com/2016/11/the-type-initializer-for.html
https://www.kodeajaib.com/
https://www.kodeajaib.com/
https://www.kodeajaib.com/2016/11/the-type-initializer-for.html
true
3214704946184383982
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy