1528971 - Custom .NET web application throws "The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception" while debugging.

SAP Knowledge Base Article - Public

1528971 - Custom .NET web application throws "The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception" while debugging.

Symptom

  • Custom .NET application throws the error while debugging.
  • Error: "'CrystalDecisions.Shared.SharedUtils' threw an exception"
  • Stack Trace: at CrystalDecisions.Shared.SharedUtils.set_CurrentControl(Control value)

at CrystalDecisions.Web.CrystalReportViewer.CreateChildControls()

at System.Web.UI.Control.EnsureChildControls()

at CrystalDecisions.Web.CrystalReportViewer.set_BestFitPage(Boolean value)

Note: This may apply to Windows application as well.

Environment

  • Windows XP
  • Crystal Reports XI R2 (SP6)
  • Crystal Reports 2008
  • Visual Studio 2005
  • Web Application

Reproducing the Issue

  • Create a wrapper class for Crystal Reports (a compiled assembly file) referring to Crystal Reports XI R2.
  • Web.config have the mixed references of Crystal Reports XI R2 (11.5) and Crystal Reports 2008 (12.0).

Cause

  • Web.config and wrapper class had the mixed reference of Crystal Reports XI R2 (11.5) and Crystal Reports 2008 (12.0).

Resolution

  • Old assembly references of Crystal Reports i.e. Crystal Reports XI R2 (11.5) were removed from web.config file and wrapper class.
  • Add the latest references of Crystal Reports 2008 to web.config and wrapper class.

Note: 

  1. Ensure that the assembly version of every dll added to project is same as mentioned in GAC.
  2. Crystal Reports XI R2 assembly version is 11.5 & Crystal Reports 2008 assembly version is 12.0

See Also

1356735 - Error: An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in system.dll

Keywords

.NET, CR XI R2, CR 2008, .NET SDK,'CrystalDecisions.Shared.SharedUtils' threw an exception, CrystalDecisions.Shared.SharedUtils , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports XI R2