Not CLS-Compliant Exception

I just started using Crystal Reports 10 with .NET 2.0, after using my reports with ASP for years.  It is a new world for me, and I am lost.  

I get this error over and over:

Return type of function 'ReportHeaderSection1' is not CLS-compliant

1) What would be causing this?  
2) Do I have an old version of a DLL or something?  
3) Has anyone seen this exception before?

Any help to explain this to get me started, or find a solution would be greatly appreciated.

TIA,
Bob
LVL 96
Bob LearnedAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

janmariniCommented:

Is this a web app or Windows?  How are you loading your report?  Are you sending it to a Viewer, exporting it, or printing?

Here's a link to some info I found having to do with the error (re: aspx, not Crystal) - but it might give you some ideas of things to look into
http://www.experts-exchange.com/Programming/Programming_Languages/Q_20846294.html?query=CLS-compliant&clearTAFilter=true 
0
janmariniCommented:
Can you share a code snippet on your process to load the Crystal report?

There might be a problem in how you are declaring datatypes or variables in your code, search for CLS in this article:
http://www.samspublishing.com/library/content.asp?b=Net_2003_21days&seqNum=95&rl=1
http://www.samspublishing.com/library/content.asp?b=Net_2003_21days&seqNum=94

You can try setting the AssemblyInfo CLSComplient to False and see if this allows the report to be run (but you shouldn't have to do this - would would probably indicate some problem in your code if changing this setting to false works)
Open the project in Visual Studio and double click AssemblyInfo.cs (or .vb) file in Solution Explorer. Change the value from true to false
 
Some more info on CLS Compliance
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconwritingcls-compliantcode.asp
http://www.devarticles.com/c/a/C-Sharp/Making-Your-Code-CLS-Compliant/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
frodomanCommented:
Is this a single report giving you this error or every report?

If it's a single report you can probably open the [reportname].vb module that Visual Studio creates (it's just a class wrapper for the report) and go to the ReportHeaderSection1 Property and debug further.  In .Net 1.1 it should be returning a value of the type: CrystalDecisions.CrystalReports.Engine.Section  - I assume it hasn't changed in .Net 2.0 but I haven't verified that.

I've seen the CrystalDecisions.CrystalReports.Engine reference lose its binding in Visual Studio on occassion, for reasons I cannot explain.  Removing the reference from my project and re-adding it again seems to correct the binding and eliminates the compile errors that had been found.  Since that's the dll that contains the return type for the section in question this may be worth a few seconds to attempt.

frodoman
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Bob LearnedAuthor Commented:
a) We are in a state of flux, with other developers working on different sections
b) The problem has apparently gone away, for reasons unknown
c) Sorry, I couldn't provide you with any more detailed information.
d) Sorry for wasting your time.

Thanks,
Bob
0
frodomanCommented:
No trouble - hopefully the problem stays away permanently.

frodoman
0
janmariniCommented:
I'm glad that things are working now :-)  Any ideas on the root cause for the problem?

Jan
0
Bob LearnedAuthor Commented:
I would have to do some serious detective work, and I am not sure it is really worth it right now, since it is working.  I was hoping that someone could explain it so that I could avoid it in the future, but I'll deal with that problem if it happens to rear it's ugly head again.

Bob
0
Bob LearnedAuthor Commented:
Mike, I can take care of my own question--thank you very much *BIG GRIN*  I will be back, though, because using Crystal Reports in the .NET arena is very foreign to me, and I have a lot to learn.

Bob
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.