cancel
Showing results for 
Search instead for 
Did you mean: 

CrystalDecisions.Shared.SharedUtils threw an exception

Former Member
0 Kudos

So, I was having an issue similar to the thread at

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Information about the system:

windows 7 64bit

VS2010

version: 10

runtime: v2.0.50727

Crystal Reports

version:13.2000.0

runtime: v2.0.50727

References added: CrystalDecisions.CrystalReports.

Design

Engine

TemplateEngine

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=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.

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

former_member183750
Active Contributor
0 Kudos

I'd suggest looking at a few resources and sample apps.

Sample apps:

https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples

I'd suggest vbnet_win_dbengine to see info re. database logon. Also search these forums and use the search box at the top right of this web page. Lots of info on database logons. Vbnet_win_simplepreviewreport is a good example of loading a report.

Also, see the following;

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2081b4d9-6864-2b10-f49d-918baefc...

Developer help files.

CRVS2010:

Report Application Server .NET API Guide http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/xi4_rassdk_net_api_en.zip

Report Application Server .NET SDK Developer Guide http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/xi4_rassdk_net_dg_en.zip

SAP Crystal Reports .NET API Guide http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_api_2010_en.zip

SAP Crystal Reports .NET SDK Developer Guide http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_dg_2010_en.zip

CR2008:

http://help.sap.com/businessobject/product_guides/boexir31/en/crsdk_net_dg_12_en.chm

http://help.sap.com/businessobject/product_guides/boexir31/en/crsdk_net_apiRef_12_en.chm

Ludek

Follow us on Twitter http://twitter.com/SAPCRNetSup

Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

Former Member
0 Kudos

I was looking at the example code within the links in your posts, and i has a question about them as it is shown in c# and vb


dim myDataSet as Dataset = DatasetConfiguration.customerdataset

as shown on [http://msdn.microsoft.com/en-us/library/ms227627%28v=vs.90%29.aspx"] in step 7 of "To instantiate and bind a non-embedded report to the CrystalReportViewer control"

I want to do something similar in vb.net, but when writing, it doesnt say that datasetconfiguration exists. I didnt know what i should be importing.

currently i have the following imported:


Imports MySql.Data.MySqlClient
Imports System.Configuration
Imports System.Text.RegularExpressions
Imports System.Data.Odbc
Imports System.Data
Imports CrystalDecisions.CrystalReports.Engine

What else am i missing to import or is it located under something else in vb.net???

former_member183750
Active Contributor
0 Kudos

Perhaps the better thing to look at will be the sample app vbnet_win_adodotnet.zip from https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples

- Ludek

Former Member
0 Kudos

I had installed and did everything for that program and it was getting an error that i have seen in [] so if i am getting an error, i think it might be best to reinstall VS2010 in an attempt to cure my error? I figure it was a perfectly running demo, and i have seen that error many times today when working on and building my .net projects.

Ill reinstall tonight, and see if that works.

former_member183750
Active Contributor
0 Kudos

I'll keep my fingers crossed

- Ludek

Answers (2)

Answers (2)

Former Member
0 Kudos

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.

former_member183750
Active Contributor
0 Kudos

I'd suggest creating a phone case:

http://store.businessobjects.com/store/bobjamer/en_US/pd/productID.98078100?resid=S6I@hgoHAkEAAGsiyV...

If it's CR bug, you'll get a refund.

- Ludek

Former Member
0 Kudos

Guys,

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

Former Member
0 Kudos

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.