ASP.NET - Crystal report Throwing exception - Asked By Dilip Sharma on 29-Sep-11 06:39 AM

hi i am using visual studio 2010...

in my C# window application i am using crystal report...

but it giving the following exception

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

on this line 

 private void InitializeComponent()
        {
            this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
-----

Plse any one tell What is solution for that........

Thanks
Web Star replied to Dilip Sharma on 29-Sep-11 06:43 AM

In one case these issues were solved when I went to

Solution Explorer -> right click project -> properties -> Build -> General -> Platform target -> x86

note it’s x86 even though i’m on a x64 box

Web Star replied to Dilip Sharma on 29-Sep-11 06:45 AM
If you set target platform to x86 you need the VS2010 Redist 32 bit an your machine. the Redist 64 is only for 64 bit processes. x86 mean 32 bit process.
also see this link
http://social.msdn.microsoft.com/forums/en-US/vscrystalreports/thread/54911a4f-d49f-484f-af1c-06765b06ebbc/
Suchit shah replied to Dilip Sharma on 29-Sep-11 06:49 AM

Make sure you are using the 4.0 Framework and not the 4.0 Client framework.

When you uninstalled the beta did you clean up the folders and registry entries. See this SAP post for more info on removing the beta: http://forums.sdn.sap.com/thread.jspa?messageID=9733991#9733991

It may also be realted to this post: http://forums.sdn.sap.com/thread.jspa?threadID=1857957&tstart=0

What database driver are you using? If it's adoplus then add this to your app.config file:

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>



and also check r u missing any dll refrence or not
Reena Jain replied to Dilip Sharma on 29-Sep-11 06:57 AM
Hi,

I faced this exception because of not installing Crystal Report component for Common Files. After reinstalling that particular component again it worked as it should work. However you can check http://social.msdn.microsoft.com/Forums/en/vscrystalreports/thread/f134b4a6-b40a-4064-8ca7-3f3058c20965 for more solutions.

try this and let me know
Dilip Sharma replied to Reena Jain on 29-Sep-11 07:56 AM
yes. . its working .. i re installed  all  ..
Now working fine.......