cancel
Showing results for 
Search instead for 
Did you mean: 

Attempted to read or write protected memory. With SP 21, 22 and 23

0 Kudos

Early last year we updated our application to use CR 2013 from CR2008, but due to a bug in CR20013 (SP18) we had to roll back our software until this was fixed by SAP. I tested the bug in the software with SP 20 (which was latest at the time), so I waited for future releases of CR2013 service packs.

Having returned to the issue, I've noticed SAP are now on SP 23 so I've downloaded SP 21, 22, 23 to test with our application, however all 3 are throwing a "Attempted to read/write protected memory" error when it instantiates the Report document.

_reportDocument = new ReportDocument(); //// THIS LINE THROWS ERROR
_reportDocument.Load(reportPath);


SP20 worked perfectly well before at this point, (the actual problem we had at the time was with the reports and parameters passed to them), but with SP 21-23, we can't even get to the point of loading the report.

We basically have 2 (very large) solutions (applications) with about 80 projects in each which are combined into one. Solutiont #1 has the code to load & display the report etc, this is compiled and the DLLs are copied over to solution 2 which then is compiled to use the DLLs from the first solution.

The above issue is happening when I call the code to create a "new ReportDocument()" from the 2nd solution. If I ran the first project on it's own, it works fine.

I've tried to replicate the issue by creating a NEW unrelated solution that reference the DLLs from the above 2 projects, but I can't replicate the issue, it works as expected.

I've gone through all the csproj files and made sure they are all compiled with x86 only etc. as we need to be in x86 still (old application). Old users still using 32bit windows.

Other than updating the CR DLLs and recompiling, nothing has changed in our software.

My Machine is however Windows 10 64bit, running Visual Studio 2017. Below I've attached the actual exception returned.

I'm now completely stumped at what to try and hope someone can help with this.

Many Thanks.

0 Kudos

I've put a small form in the 2nd application one that simply has a report viewer on it, and 3 lines of code:

the reportfile passed is just a blank report form that displays a text label, no database or anything.

            var reportDocument = new ReportDocument();
            reportDocument.Load(_reportFile);
            reportViewer.ReportSource = reportDocument;

I'm getting the exact same error on the first line - when it instantiates the ReportDocument()

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

I've solved this issue now. I copied my little test application.exe file into the main applications project folder and found that my test application started to have the same issue. So I created a TEMP folder and copied it in there, and it worked. So I then copied several files at a time from the main application and kept testing until it failed. I found one particular file I copied from the application to temp folder was causing the issue.

  • cxlibw-5-0.dll

Looking at the version details of this file it it has "13.0.18.xxxx" which is from SP18 which we used in our software before rolling back to CR 2008 due to issue last year. Deleting this file, or coping over the updated 13.0.23.xxxx file worked.

Deleting this file, the test application worked. After speaking with a colleague, he said that file (and others) are part of the CR Runtime that installs into the our application folder (no idea why they do this - before my time here) when our clients install our software and after removing the below files from the application folder, all is OK.

I basically removed the files found in the folder "C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86" from our client application.

  • BCM-4-0.dll
  • boezlib.dll
  • crpe32.dll
  • crpe32_res_en.dll
  • cslibu-3-0.dll
  • cxlibw-5-0.dll
  • ebus-3-3-2-7.dll
  • etc-1-0-12-6.dll
  • fssl-1-2-1-6.dll
  • libOCAhelperw-5-0.dll
  • locale_fallback-4-0.dll
  • pvlocale-1-0.dll
  • TraceLog-4-0.dll
  • uf12manager.dll
  • ufmanager.dll
  • Xalan-C_1_10.dll
  • XalanMessages_1_10.dll
  • xerces-c_2_7.dll

Thank you to everyone who tried to help with this.

Answers (3)

Answers (3)

mikael_kratz
Explorer
0 Kudos

Hi!

If you have compiled against any newer .Net Framework with earlier than SAP SP21 then you probably have a legacy tag in your config file.After SP21, this is no longer required.

<startup useLegacyV2RuntimeActivationPolicy = "true"> //No longer needed
<supportedRuntime version = "v4.0" />
</ Startup>

Hope it can solve the problem

0 Kudos

Many thanks for your info. When we upgraded from CR 2008 to CR2013 (SP18) we also upgraded to .NET 4.6 from 3.5 and we did add that line into the startup. Though I'm not 100% why as a different developer added it. However I've now removed it from both projects and recompiled but I'm still getting the same issue. 😞

I have this in the config now.

<!--<startup useLegacyV2RuntimeActivationPolicy="true">--> 
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/> 
</startup>

mikael_kratz
Explorer
0 Kudos

Do you have VC ++ installed? Minimum version 2015 is required for it to work.Otherwise, I have no other idea than to reinstall from the beginning, maybe even on a new computer. Know that CRVS is a bit sensitive when it's COM. If it does not work after reinstallation, you will need expert assistance from Don Williams or anyone else from SAP.

Hope your problem will resolve soon

0 Kudos

Thanks Mikael.

Yes I have VC++ 2017 installed (14.15.26706), I've already uninstalled all of Crystal Reports, rebooted and now just have CRforVS_13_0_23.exe installed now, and rebooted several times since. As mentioned my little test app worked fine, no issues, and the first project works as well, it's the 2nd project, which references the first project DLLs that it's failing on.

I was hoping Don would reply here at some point, not sure how I can get "official" sap support otherwise.

>>Hope your problem will resolve soon

I couldn't agree more, I hope so too - it's really strange how it worked just fine with SP20, but as soon as I put 21 on and change the references, I get this issue - no compile error messages either.


mikael_kratz
Explorer
0 Kudos

One more thing.The installation on the development computer must be done by right-clicking and selecting "Run as administrator" even if you are an administrator on the computer. Do not just double-click the setup.

0 Kudos

Thanks Mikael, already done that though, it's one of my habits to a always right click and run as admin, I even extract the exe file into a folder and run setup.exe via rightclick>admin.

DellSC
Active Contributor
0 Kudos

Actually, although you and your customers may be using Crystal 2013 to create reports, you're using the Crystal for Visual Studio SDK in your application. The SDK is no longer linked to the version of Crystal - it's a completely separate download.

SP18 of the SDK is old - it's currently on SP23. However, it is still possible to download that version. Go to https://www.crystalreports.com/crystal-reports-visual-studio/ and enter your name and email address. This will take you to a page with the current version of the various downloads. The orange button is for the integration with VS. Get the URL that button redirects to; it will end in ...13_0_23.exe. Use that URL with ...13_0_18.exe to get the version you need. The blue buttons are for the various runtime options that are only used for deploying your application - DO NOT install on the developer workstation!. You'll do the same thing to get the correct version of the runtime - get the URL form the page, replace "23" with "28, and put that in the address bar in your browser to download the runtime.

What you delete depends on what else you have installed. If you also have Crystal 2013 installed, you'll want to uninstall that, and then delete the SAP BusinessObjects folder. The Business Objects folder is where Crystal 2008 and its SDK are installed.

0 Kudos

Hi Dell, many thanks for your responses.

I have already downloaded SP 16-20 last year when I had an issue with integers / parameters, but that issue was with CR, so we rolled back our application to keep CR 2008 as that worked. I've now got SPs 21-23 downloaded as I've been asked to investigate this again to see if the later SP fixes the issue we had with 18 (and 20).

I only install the CR for VS on my machine. not the deployment files. we keep the DLL files in a folder with the project for SVN purposes. Copied from here when installed: C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet

I've removed ALL versions of SAP / CR from my machine, 2008, 2013, and even the CR2013 application I had installed - nothing left, rebooted and then installed "CRforVS_13_0_23.exe". Checking the GAC, only CR 2013.SP23 is in there.

Ran our application again - exact same problem as before. My test application works find, the first solution works fine, but the second solution we have (which uses the first) is throwing the error. For the life of me I can't work out what the issue is now, and don't understand it. I copy the required DLLs from the two solutions to my test app, and that works. It's very strange.

This is the original issue I had last year with SP 16-20. Hence the wait for a later SP.

https://answers.sap.com/questions/235400/unspecified-error.html

DellSC
Active Contributor
0 Kudos

Are you running the full app on the computer where you have VS installed or is it somewhere else? If it's somewhere else, you MUST install one of the runtimes - just copying the .dll files does not work because there are also registry settings that get updated during the install.

Are the two apps 32-bit or 64-bit? (You need to be explicit how you compile "Any CPU" doesn't work with the SDK.) They need to match and you need to have the correct SDK installed. The 64-bit runtime is an optional install at the end of the install that gets the integration into VS and the 32-bit runtime is integrated into the install. The SDK you use needs to match the "bit-ness" of the application, which may or may not match the bit-ness of the OS.

-Dell

0 Kudos

Correct, I'm running the app on my own machine via VS2017 and also via the compiled version. I know I need runtime on the deployed server, but need to get it running locally first before deploying it 🙂

Yes, at the end of the CRtoVS install I removed the tick for the 64bit install, as we only use 32bit, even though the OS is 64 bit. the two apps in question are all compiled in x86. I downloaded and installed the 32bit version of the CR. No 64 bit here!

We are only using the following DLLs in the solution:

CrystalDecisions.CrystalReports.Engine.dll
CrystalDecisions.ReportSource.dll
CrystalDecisions.Shared.dll
CrystalDecisions.Windows.Forms.dll

as that was all there was in 2008, but 2013 has several more dlls. I've now added most of the extra ones (not sure what they are all for as I didn't develop this part of our app)

CrystalDecisions.ReportAppServer.*.dll

Just in case, but that made no difference. Still just as puzzled with this. 😞

I've even got the CR Logging turned on, but no log files are generated.

DellSC
Active Contributor
0 Kudos

Those four should be the only ones you need to reference. The ReportAppServer assemblies are used for working with the ReportApplicationServer part of the SDK.

Is this a Windows or a web app?

Can you post the code you're using to open the report? Are you connecting to a database or a dataset that is internal to your application?

-Dell

0 Kudos

The strange thing is that it works as expected when SP20 was installed, except for the bug in the parameters issue I had last year (linked in earlier comment), but at least it opened reports. Now with SP 21 to 23, I get this issue, with NO change to the code (except pointing the reference to the updated dlls of course).

With the different version of our application we keep a copy of the dlls in a "3rd party assemblies" folder and point the reference to that. So we can check out an earlier version our software and recompile with hotfixes etc.

DellSC
Active Contributor
0 Kudos

I ran into a similar issue recently. The problem was that there were "relics" of libraries from the older SDK that caused this issue. To get around this, I uninstalled the SDK entirely, delete the folders where the SDK was installed, and the reinstalled.

-Dell

0 Kudos

Hmm interesting thought. I do have the CR2008 version on, as we have to support the older version as well as our clients don't always want to upgrade...

I've uninstalled all of the SAP installs under "add/remove programs" so will now uninstall CR2013 application now.

when you say delete the folder - which folder do you mean?

C:\Program Files\Business Objects

C:\Program Files (x86)\Business Objects

C:\Program Files (x86)\SAP BusinessObjects

Thanks. - I might just zap all of them and see what happens 🙂

One issue I might have is that I also need CR2013-SP18 on my machine as we have a couple of customers that are on this version and need to compile the application using this...