cancel
Showing results for 
Search instead for 
Did you mean: 

The type initializer threw an exception

Former Member
0 Kudos

I'm using Visual Studio 2008 and Crystal Reports 2008. Adding the CrystalReportViewer and running the application, my project stops and displays this error:

"The type initializer for 'CrystalDecisions.ReportSource.ReportSourceFactory' threw an exception."

and I'm not able to understand the problem...

I paste here the details of the error

System.TypeInitializationException was unhandled

Message="The type initializer for 'CrystalDecisions.ReportSource.ReportSourceFactory' threw an exception."

Source="CrystalDecisions.Windows.Forms"

TypeName="CrystalDecisions.ReportSource.ReportSourceFactory"

StackTrace:

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

at Geo9001.Anteprima.InitializeComponent() in C:\Documents and Settings\Windows XP\Documenti\Visual Studio 2008\Projects\Geo9001\Geo9001\Anteprima.Designer.vb:line 25

at Geo9001.Anteprima..ctor()

at Geo9001.Anagrafiche0.cmdStampa_Click(Object sender, EventArgs e) in C:\Documents and Settings\Windows XP\Documenti\Visual Studio 2008\Projects\Geo9001\Geo9001\Anagrafiche0.vb:line 68

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

at C1.Win.C1Input.C1Button.OnMouseUp(MouseEventArgs mevent)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ButtonBase.WndProc(Message& m)

at System.Windows.Forms.Button.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)

at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

at System.Windows.Forms.Application.Run(ApplicationContext context)

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)

at Geo9001.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81

at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)

at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

InnerException: System.TypeInitializationException

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

Source="CrystalDecisions.Shared"

TypeName="CrystalDecisions.Shared.SharedUtils"

StackTrace:

at CrystalDecisions.Shared.SharedUtils.GetFullTypeName(Type type)

at CrystalDecisions.ReportSource.ReportSourceFactory..cctor()

InnerException: System.Configuration.ConfigurationErrorsException

BareMessage="Configuration system failed to initialize"

Line=0

Message="Configuration system failed to initialize"

Source="System.Configuration"

StackTrace:

at System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object sender, InternalConfigEventArgs e)

at System.Configuration.Internal.InternalConfigRoot.OnConfigRemoved(InternalConfigEventArgs e)

at System.Configuration.Internal.InternalConfigRoot.RemoveConfigImpl(String configPath, BaseConfigurationRecord configRecord)

at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)

at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)

at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)

at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)

at System.Configuration.ConfigurationManager.GetSection(String sectionName)

at System.Configuration.ConfigurationSettings.GetConfig(String sectionName)

at CrystalDecisions.Shared.SharedUtils.GetPropertyFromCustomSection(String property)

at CrystalDecisions.Shared.SharedUtils.GetBrowserLocaleFromConfigFile()

at CrystalDecisions.Shared.SharedUtils.get_UseBrowserLocale()

at CrystalDecisions.Shared.SharedUtils.GetEffectiveCulture()

at CrystalDecisions.Shared.SharedUtils.GetClientCulture()

at CrystalDecisions.Shared.SharedSys.GetString(String name)

at CrystalDecisions.Shared.SharedUtils..cctor()

InnerException: System.Configuration.ConfigurationErrorsException

BareMessage="An error occurred loading a configuration file: Could not find a part of the path 'C:\Documents and Settings\Windows XP\Geo9001.vshost.exe_Url_ypnoq0o5ga12ki3hioc1aoafatieb51d\1.0.0.0\user.config'."

Filename="C:\Documents and Settings\Windows XP\Dati applicazioni\...\Geo9001.vshost.exe_Url_ypnoq0o5ga12ki3hioc1aoafatieb51d\1.0.0.0\user.config"

Line=0

Message="An error occurred loading a configuration file: Could not find a part of the path 'C:\Documents and Settings\Windows XP\Geo9001.vshost.exe_Url_ypnoq0o5ga12ki3hioc1aoafatieb51d\1.0.0.0\user.config'. (C:\Documents and Settings\Windows XP\Dati applicazioni\...\Geo9001.vshost.exe_Url_ypnoq0o5ga12ki3hioc1aoafatieb51d\1.0.0.0\user.config)"

Source="System.Configuration"

StackTrace:

at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)

at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)

at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()

at System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object sender, InternalConfigEventArgs e)

InnerException: System.IO.DirectoryNotFoundException

Message="Could not find a part of the path 'C:\Documents and Settings\Windows XP\Geo9001.vshost.exe_Url_ypnoq0o5ga12ki3hioc1aoafatieb51d\1.0.0.0\user.config'."

Source="mscorlib"

StackTrace:

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)

at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

at System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String streamName)

at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName, Boolean assertPermissions)

at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName)

at System.Configuration.ClientConfigurationHost.OpenStreamForRead(String streamName)

at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()

InnerException:

View Entire Topic
0 Kudos

Hello,

The system removed all the line feeds and carrage returns but it looks like you have a permission issue on the resources.

What verion of the Cr assemblies are you using and which ones are you including in your application?

Thank you

Don