Skip to Content
avatar image
Former Member

CrystalDecisions.Shared.SharedUtils threw an exception

So, I was having an issue similar to the thread at the-type-initializer-for-crystaldecisionssharedsha

Here is what i am doing currently:

DSN connection to a source via

Dim conn As New OdbcConnection("DSN=lalConnect")

and then

input = getfile()
While (Not (input.Contains(".rpt")))
         MessageBox.Show(input & " is NOT a .rpt file")
         input = getfile()
End While
ReportViewer.CrystalReportViewer1.ReportSource = input.ToString

I set the compiler to be for any CPU type (x86 || x64)

My error throws in the last line of the above code and would show message "An Error Occurred creating the form. See Exception.InnerException for details. The error is: The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exceptiion."

I wasnt quite sure as to why this was happening, and as a side question, i wasnt sure how to connect my DSN connection to the report so it can properly pull information. could be a reason why it is throwing this error..?

Thanks everyone.

P.S.- If you need more information, i can post it.

Edited by: fallenreaper on Feb 14, 2011 4:38 PM

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Feb 14, 2011 at 06:41 PM

    Information about the system:

    windows 7 64bit


    version: 10

    runtime: v2.0.50727

    Crystal Reports


    runtime: v2.0.50727

    References added: CrystalDecisions.CrystalReports.




    Edit: I also moved information into a new project/solution, and i was getting the same error, so it isnt simply solved similarly how another person did on this forums.

    Edited by: fallenreaper on Feb 14, 2011 8:53 PM

    Below is the output from the inner exception:

    System.TypeInitializationException: The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception. ---> System.BadImageFormatException: Could not load file or assembly 'log4net, Version=, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    at CrystalDecisions.Shared.SharedUtils..cctor()

    --- End of inner exception stack trace ---

    at CrystalDecisions.Shared.SharedUtils.GetEffectiveCulture()

    at CrystalDecisions.Shared.LocaleManager..ctor()

    at CrystalDecisions.Windows.Forms.CrystalReportViewer.InitReportViewer()

    at CrystalDecisions.Windows.Forms.CrystalReportViewer..ctor()

    at will.ReportViewer.InitializeComponent() in C:\Users\Fallenreaper\Documents\Visual Studio 2010\Projects\will\will\ReportViewer.Designer.vb:line 25

    at will.ReportViewer..ctor()

    Edited by: fallenreaper on Feb 14, 2011 9:32 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 14, 2011 at 02:13 PM

    Of these issues, nothing seems to be working. I was unsure why none of this is working. I have recompiled, recreated projects, and approached from several angles, but it does not seem to work.

    I still get the util's issue, and i dont know anymore then you all how to fix it. Assumed that this is just because of this being associated with a Microsoft Product. 😊

    I am still working on this issue every day, and so far, put over 100 hours into this.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 15, 2011 at 11:15 PM


    you must install the correct crystal report runtime (32 or 64) and this error will be resolved.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I wasnt sure about that Georgino - AUB, as I have made and run Crystal reports previously and it didnt affect me, but i am downloading the most current patch just in case.