Skip to Content
author's profile photo
Former Member

The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exc

I'm new to Crystal Reports and trying to work my way into it.

I created a form and dropped a CrystalReportViewer onto it. I set the ReportSource to a .rpt file that I also created.

When I run my VB.NET 2010 application and click the button to open up the Viewer form I get the following error:

The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception.

The details says that it's the log4net error that I've seen on here in several threads. I followed these directions from another thread:

- Go into your project Properties.
- Then go to the Publish tab. 
- Click the Application Files button.
- Select to Exclude any file with CrystalDecisions or BusinessObjects in the name. Plus exclude log4net.dll.
- Click OK
- Rebuild your application, then republish it to your site or file share to be installed by your clients.

No luck with that.

I then tried changing my my compile options from AnyCPU to x86 but that crashes the program on startup by complaining about my OdbcConnection.

Any suggestions are greatly appreciated.

I'm running Visual Studio 2010 on a Win 7 64-bit computer. I tried the same process in a new project and it worked there, but without actually connecting to a DSN database. I assume I have something configured wrong in my actual application but I don't know enough about Crystal Reports yet to know what to look for.

Edited by: wolfmanyoda on Jan 15, 2011 4:14 AM

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Posted on Jan 15, 2011 at 03:40 PM

    Set your project framework to 4.0, not the client version.

    Don't use c:\temp, rename it to c:\mytemp

    Use a report with saved data then it doesn't need a DB connection as a test. Create your DSN using the 32 bit ODBC administrator in \syswow64 folder for 32 bit applications.

    Have a look at these samples:

    Root Page

    Enterprise Samples (including managed and unmanaged ras)

    Non-Enterprise Samples

    Exporting Samples (RAS)

    Thank you


    Add comment
    10|10000 characters needed characters exceeded