Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1042
  • Last Modified:

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
0
Bob Learned
Asked:
Bob Learned
  • 3
  • 3
  • 2
3 Solutions
 
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
 
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now