Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7432243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:25:40+00:00 2026-05-29T09:25:40+00:00

I am working on an application that uses Crystal Reports for the reporting. It

  • 0

I am working on an application that uses Crystal Reports for the reporting. It opens a given report in a ReportDocument object, does what it needs to do and then closes the report.

using (var report = OpenReport(reportSourceInfo))
{
    // Do stuff with the report
    report.Close();
}

The OpenReport method does some validation of the source file and returns an open ReportDocument object.

Testing has shown that this code does what it’s meant to do and appears to have no issues. The problem I’m really after advice on is when I do a code analysis (CA) build of the reporting project, I get the following CA message:

CA2202 : Microsoft.Usage : Object ‘report’ can be disposed more than once in method ‘CrystalReportingProvider.ReportExecute(ReportSourceInformation)’. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.

Now obviously I can change the code around so I don’t get this CA warning, but my question is should I?

Does the Crystal Reports ReportDocument.Close() method do everything to handle resource cleanup properly? The message seems to indicate that the Close method calls the Dispose method, but that just doesn’t seem right.

Any advice would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:25:40+00:00Added an answer on May 29, 2026 at 9:25 am

    Well, according to this, “Close() … release[s] the memory that is used by the report.” That would indicate that Close() calls Dispose(), so it would be redundant to have both a using statement and Close().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a VB6 application that uses an ADODB.Recordset object to dump
I am working on an application that uses Oracle's built in authentication mechanisms to
I am currently working on an application that uses a TableViewer in several places
I am working on a php that application that uses ajax. On all the
I am currently working on an web application that uses ASP.NET 2.0 framework. I
Environment I'm working on a C++ application that uses SQL Native Client 9.0 to
I am currently working on a web application that uses PHP and MySQL, but
I am working on a client-server application that uses boost::serialization library for it's serialization
I am working on a new application that uses a jet (MS Access) database.
I am thinking of working on a Rails application that uses PostgreSQL. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.