"Attempted to read or write protected memory" error in loading a report.

Development Environment
===
Windows XP
Visual Studio 2008 Pro; with Crystal Reports 2008 for Visual Studio
TagetCPU: 'AnyCPU'
VB.net 3.5
Windows dll
Crystal Reports Runtime SP2 (12.2.0.290)
Deployment Environment
===
Windows XP
.net3.5
Crystal Reports Runtime SP3 (no be confirmed)
I have created a windows dll with a form with a reportdocument, that loads a report (CrystalDecisions.CrystalReports.Engine.ReportDocument).
Then we circle through the report setting every table location to point at a specific ODBC and database.
The Dll can do this process several hundred reports in a day. However a small number (less than 10) of these have the following error:
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
This is normally occurring when the reportDocument.Load function is called. But also happens when going through the setting of table locations: [myTable.ApplyLogOnInfo(TmpTableLogOnInfo)
The dll is called via COM interop and so i have checked "Register for COM interop".
Simon@Sanderson

1) Get to SP 3:
for dev computer:
https://smpdl.sap-ag.de/~sapidp/012002523100007123572010E/cr2008_sp3.exe
Recompile the app after SP3 is applied.
for SP3 runtime:
MSI
https://smpdl.sap-ag.de/~sapidp/012002523100007123592010E/cr2008sp3_redist.zip
MSM
https://smpdl.sap-ag.de/~sapidp/012002523100007123582010E/cr2008sp3_mm.zip
(You will have to uninstall SP 2 runtime before installing SP 3 runtime)
2) Do not use "Any CPU". CR2008 is only 32 bit anyhow so use 32 bit.
3) Make sure you are using .Close and .Dispose once you are done with each report object
- Ludek

Similar Messages

  • Attempted to read or write protected memory error on reportdocument.load

    Reportdocument.load causes "System.AccessViolationException: Attempted to read or write protected memory" error.
    The error is not consistent. Sometimes a report will print. Sometimes a report will error.
    I am at a loss as to what to try.
    I have uninstall the app, reinstalled the app, uninstall and reinstalled .NET frameworks, Visual C++ runtime, etc.,
    reworked the code to try to capture the error. Nothing helps. Application crashes with Unhandled exception.
    Attempted to read or write to protected memory.
    Has anyone been able to resolve this issue?

    Hi Mary,
    What happens if you set your project to use 4.0 framework?
    Anything else in the Event Viewer to show an access violation?
    Have you tried updating the printer driver to one that is supported in the Framework? I find most legacy printers tend to use the old DEVMODE structure and not the Framework. Try using the printer off the Window CD rather than the Manufacturers driver.
    Is your app doing "Report Bursting"? In other words sending multiple reports one right after the other with no time between?
    Are you using any legacy UFL's? Try renaming u2lcom.dll if you are not using them. If you do you'll get an error in formula.
    Are you using try/catch in your code around each CR API? It may catch something more for you also.
    AND, can you try a C# project, some thing very simple also. I've of issues in VS VB that do not show up in other dev languages. Neither Microsoft or SAP can figure out what the cause is.
    Thank you
    Don
    Edited by: Don Williams on Feb 11, 2011 2:34 PM

  • Attempted to read or write protected memory error

    Hello,
    I am using the .Net library and occasionally I get a System.AccessViolationException,"Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Currently it is occurring when trying to initialize a TypedTPINIT object (this has happened in other places before and we just retry the request as a work-around). I set the size equal to the password length + 2 and the constructor for TypedTPINIT throws the exception after making the call to tpaloc. I have code that catches the exception and tries again up to 5 times before bubbling the exception up the chain. Once this exception occurs, no calls can be made to tux, they all throw the same exception. Once the application is closed and restarted (restarting the win32 process), everything works fine with the same data. It will work for a day or two and then fowl up again, seemingly at random. I am unable to reproduce the error at will, we just see it popup now and again, but closing the process and restarting it makes it go away for a while.
    Any idea why this exception is happening?
    I tried taking the .Net library out of the question and make the call to tpalloc myself using p/invoke and the same thing happens, but not every time.
    I appreciate any help you can provide.
    ~Jason

    Hi Jason,
    I would suggest using a memory access checking tool like bounds checker, electric fence, or the like, although I don't know what's available in a .NET environment.
    Regards,
    Todd Little
    Oracle Tuxedo Chief Architect

  • Attempted to read or write protected memory followed by Load Report Failed

    After running OK for some time ASP.NET web application (VS 2008 .NET 3.5 with Crystal Reports included) running on MS WIN 2003 R2, SP2) will throw error when trying to create PDF crystal report. Error reads as follow:
    Attempted to read or write protected memory. This is often an indication that other memory is corrupt. -    at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Close()     at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.InternalClose(Boolean bSetupForNextReport, Boolean bAutoClose)     at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Dispose(Boolean bDisposeManaged)     at System.ComponentModel.Component.Dispose()     at CrystalDecisions.CrystalReports.Engine.ReportDocument.InternalClose(Boolean bSetupForNextReport)     at CrystalDecisions.CrystalReports.Engine.ReportDocument.Close()
    After that every consecutive attempt to create another PDF crystal report will fail with fallowing error:
    Load report failed. -    at ... at System.Web.UI.WebControls.Button.OnClick(EventArgs e)     at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    Once Application pool is recycled, error goes away but comes back after while. It seems that recently the uptime is getting shorter.
    Anyone had similar experience, posible solution?
    Thanks in advance,
    Miro

    Hi Miro,
    Clean Temp folder of that machine.
    For testing export report to PDF format from designer do you face any issue?
    Try to export the report with following line of code :
            CrystalDecisions.CrystalReports.Engine.ReportDocument boReportDocument;
            CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument reportClientDoc;
            boReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            boReportDocument.Load(Server.MapPath("FinalActivityRpt.rpt"));
            reportClientDoc = boReportDocument.ReportClientDocument;
            boReportDocument.SetDatabaseLogon("sa", "sa");
            CrystalReportViewer1.ReportSource = boReportDocument;
            ExportOptions exportOptions = new ExportOptions();
            exportOptions.ExportFormatType = CrReportExportFormatEnum.crReportExportFormatPDF;
            PDFExportFormatOptions pdfOptions = new PDFExportFormatOptions();
            pdfOptions.StartPageNumber = 1;
            pdfOptions.EndPageNumber = 3;
            exportOptions.FormatOptions = pdfOptions;
            Response.AddHeader("Content-Disposition", "filename=" + "untiteled" + ".pdf");
            Response.ContentType = "application/pdf";
            Response.BinaryWrite((Byte[])reportClientDoc.ReportSource.Export(exportOptions, new         RequestContext()));
            Response.End();
    Regards,
    Shweta

  • SSRS 2008 R2 - on Preview report in report builder itself, getting an error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt". Any Suggestions please to resolve it?

    Hi,
    I am working on SSRS 2008 R2. On Preview report in report builder itself, i am getting an error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt".
    See my below screen shoot.
    Any Suggestions please  to resolve it? 
    thank you in advance !
    best regards,
    Venkat,
    [email protected]

    Hi Venkat,
    According to the error message, I guess that the error occurred when you previewed the report in Business Intelligence Development Studio (BIDS).
    Based on my research, I think it may be a Window Layout issue of Visual Studio. Please try the steps below:
    Click “Window” button from the toolbar ribbon.
    Click “Reset Windows Layout” option.
    Click “Yes” to finish the operation.
    The following thread is for your reference:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/90949d68-a611-467c-b438-be97b8ab250b/attempted-to-read-or-write-protected-memory-this-is-often-an-indication-that-other-memory-is
    Hope this helps.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Unknow error message: Attempted to read or write protected memory.  This is

    Hi,
    I am using 2007B PL08.  The following are my coding:
    Dim oCompanyService As SAPbobsCOM.CompanyService
    Dim oCompanyAdminInfo As SAPbobsCOM.AdminInfo
    Pub.User.Company.NameEng=oCompany.CompanyName
    I can run the above coding properly yesterday but there is no reason that i got the following message suddenly today
    Interop.SAPbobsCOM:Attempted to read or write protected memory.  This is often an indication that other memory is corrupt.
    1.  I try to re-boot the machine
    2.  I try to connect the program to another testing database
    3.  I try to re-install the DIAPI
    I did all the above steps but the message still coming out.  Anyone can help??
    Regards,
    Anna

    I have experienced this same error, and also found that reinstalling the DIAPI or deleting the temporary folder did not work.
    However, I was eventually able to fix the problem by removing removing the reference to the DIAPI from my .NET project, removing the associated Interop file, and adding the reference again, thereby forcing .NET to re-create the COM wrapper. This fixed the problem, and I suspect that my code was calling a method that, although it existed in the Interop file, did not map correctly to the actual DIAPI COM object that was installed on the machine.
    Hope this helps someone - I know I was happy to find a solution to this very frustrating problem!

  • Error Connecting Addon. Attempted to read or write protected memory

    Hi All
    I m trying to connect company database.....
    while doing
    ocompany.connect()
    i m getting following error
    Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    how should i solve this????
    Thank you

    Rajesh - this question has already been asked and aswered.
    Search the forum for "protected memory".
    Here's the solution:
    Error when install addon

  • Stock Audit Trail Report Error - Attempt to read or write protected memory.

    Hi,
    I have a customer running on
    1. SQL 2008 SP2
    2. SAP B1 8.8 PL21
    After the Stock Audit Trail report is run, on the output screen, when i try to click on any of the "Golden Arrow" to drill down, i get an error message on the bottow of the screen that says
    "[ItemEvent]: Attempt to read or write protected memory. This is often an indication that other memory is corrupt."
    I get this error on workstations as well as servers. What could be wrong and what should i do?
    Thanks,
    Taw-Fey, Tan

    Hi Taw-Fey,
    Check your demo database to see if you get the same error. If not, something is wrong in your live db. You need at least DBCC to check.
    Thanks,
    Gordon

  • Error: Attempted to read or write protected memory. Memory is corrupt

    2005A SP1 PL4
    I have added a user field with B1 in Items with success.
    Therefore I have started the addon and I have the following error at  SAPbouiCOM.SboGuiApiClass.Connect(String ConnectionStr):
    "Attempted to read or write protected memory. This is often an indication that other memory is corrupt"
    I have restart B1, and I have restart the PC, but the problem persist.
    Before I added user field, the addon worked
    Now if I open items system form, the user field not exists , not even I press CtrlShiftU
    It seems that the user fields are not record correctly
    Now I re-add a new second user field in items. Now there are all user fields in system form Items, but i have the same error with my addon.
    This is the second company that occorr this problem
    Is this a 2005A SP1 PL4 problem? Must I convert the company to 2005A SP1 PL11? Or are there other solution? 
    Help me
    Thank you

    I would strongly recommend to go up to PL11 - and then re-check the issue.
    If it still doesn't work:
    The minimum information to provide here would be the definition of the UDF! Since UFDs work in general there must be some issue with your specific UDF (or some combination of settings).
    Check table CUFD + the actual definition of the UDF in the SQL table as well.
    ...or just involve SAP Support...
    HTH,
    Frank

  • Error "Attempt to read or write protected memory" in MAS

    Hello,
    I am always getting the error message "Attempt to read or write protected memory. This is often a indicator that other memory is currupt" as soon as I try to add a new Method to a BO. What I do is
    1) Open BO in Code Mode
    2) Open Tab "Document Outline" ; right click on Method and "New.."
    3) I enter the Method name i desire "Z_CPB_RetrieveStockInfo"
    4) I enter the specific signature i need "Public Function Z_CPB_RetrieveStockInfo( ByRef Sfmara As String) As Object"
    5) I press ok and get the error message in the first popup.
    6) I get another error Popup "Cannot open the code window. Reason: The object may have been deleted from the Changelist"
    The method "Z_CPB_RetrieveStockInfo" listed in the "Document Outline" Tab below Methods, but not in the selection box above the code. If I restart MAS I can see the method in the code and in every selection box. It is also possible to enter the code into the method, but as soon as I saved and restarted the machine, the code is gone and the method body is empty again.
    Does anyone know what's going wrong?
    Regards,
    Andreas

    Hi,
    this is a well-known issue, you can check here for more information
    [MAS and  Attempted to read or write protected memory.]
    Regards,
    Wolfhard

  • Error "Attempted to read or write protected memory"

    When I started using Microsoft Visual 2008, he began appearing this error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt" and not know what could be.
    To debug the program the error occurred after executing the line:
    objBP = (BusinessPartners)objCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners)
    Does anyone know what might cause this error?

    I isolated the piece of code for testing:
    private void button5_Click(object sender, EventArgs e)
                try
                    if (objCompany.Connected) {
                       objSBOBob = (SBObob)objCompany.GetBusinessObject(BoObjectTypes.BoBridge);
                       objRecordset = (Recordset)objCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                       objBP = (BusinessPartners)objCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners);
                       objRecordset = objSBOBob.GetBPList(BoCardTypes.cSupplier);
                       objBP.Browser.Recordset = objRecordset;
                catch (Exception er)
                    MessageBox.Show(er.Message);
    And the variables:
    private BusinessPartners objBP = null;
            private Recordset objRecordset = null;
            private SBObob objSBOBob = null;

  • AccessViolationException: Attempted to read or write protected memory.

    Hello all.
    The application that I am working on has a Oracle DB 10g and we want to migrate the DB to 11g (11.2.0.2). The client OS is a Windows 7 x64 and the application (which is an x86 app) is a hybrid between .NET and C++(COM components). The .NET part is using ODP.NET components and the C++ part is using ODBC drivers (oraclient 11.2.0.1 - x86 version).
    The problem is that the application works without any problems with the 10g DB but when switching to 11g we get an exception. Basically, we have a try { call COM component } catch(Ex ex) {...} and the Exception ex is a AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. I debugged the C++ part and this strange thing happens: the component opens the connection (using a connection string like this : "driver={Oracle in OraClient}; uid=... pwd=.. "), executes some queries, and on one query (which is the same as the last ones - just some selects), when the data is processed (by data I mean a integer ID), the exception is thrown in .NET code. I was able to enter in afxdb.cpp and it looks like the exception is thrown when GetData method is called. I looked over the ID's from previous queries and the data passed to GetData method is about the same (I mean the fieldtype, index, len, SQL type).
    As solutions I tried:
    -set "Statement Cache Purge=true" => same effect
    - install a instantclient11_2 basic and ODBC drivers (for 11.2.0.2) but I could not connect to the DB (I could find the new drivers in registry WoW64Node/ODBC Drivers, put the location in PATH in front of the other OraClient and replace the OraClient with the name in registry in conn string) => Specified driver could not be loaded due to system error 127.
    - tried to see the Marshal.GetLastWin32Error() => returns 0.
    Any ideas? :D
    Edited by: 917334 on Feb 27, 2012 12:57 PM

    The select clause that causes the problem is actually a select over a view. I replaced the select * from MYView with the actual select clause (with inner join) and the issue disappeared.
    Any ideas? :)
    Solution:
    Looks like the view was written using INNER JOIN stuff. I replaced the code from the view with a simple select like this (inner join free):
    select table1.col1, table2.col2, table3.col2, from table1, table2, table3 where table1.col1 = table2.col1 and table1.col1 = table3.col1
    Some questions still remain (even if my issue is partially solved):
    - why was it working on 10g?
    - why this particular view crashed? (there are other views that use inner join and don't cause this)
    - why was it working when using the full select (with inner join) and not working when selecting over the view?
    Edited by: 917334 on 28.02.2012 08:33

  • System.AccessViolationException:Attempted to read or write protected memory

    Hi,
    I am using Asp.net with oracle 10 g in my application , it is working perfectly in my machine. i have installed Oracle 10 g in my machine. but i did not installed oracle 10 g in server
    but i am running an application from the server. i got this Error:
    Attempted to read or write protected memory.This is often an indication that other memory is corrupt.
    Please Help me.
    Thanks.

    Hi,
    try to set the
    ProxyCreationEnabled property of dbContext is set to true.

  • Attempted to read or write protected memory

    Imports Axzkemkeeper
    Imports zkemkeeper
    Public Class Form11
    Dim q As New Axzkemkeeper.AxCZKEM
    Dim con As Boolean = False
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    'Try
    ' q.CreateControl()
    ' con = q.Connect_Net("192.168.0.202", CInt(4370))
    ' If con Then
    ' MsgBox("yes")
    ' Else
    ' MsgBox("fuck!")
    ' End If
    'Catch ex As Exception
    ' MsgBox(ex.Message)
    'End Try
    q.CreateControl()
    'q.SkinAllThreads()
    con = q.Connect_Net("192.168.0.202", CInt(4370))
    If con Then
    MsgBox("yes")
    Else
    MsgBox("oh shoot!")
    End If
    End Sub
    End Class
    i try to connect biometric device from vb using axzkemkeeper.dll but i comes with error:
    An unhandled exception of type 'System.AccessViolationException' occurred in AxInterop.zkemkeeper.dll
    Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    i really thanksful with any advice you give....
    best regards...
    Exception is:
    An unhandled exception of type 'System.AccessViolationException' occurred in AxInterop.zkemkeeper.dll  Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

    Please refrain from the profanity.
    The problem appears to be from inside Axzkemkeeper.AxCZKEM. Whatever that is... I am unable to help with the code you provided.
    “If you want something you've never had, you need to do something you've never done.”
    Don't forget to mark
    helpful posts and answers
    ! Answer an interesting question? Write a
    new article
    about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

  • Attempted to read or write protected memory. This is often an indication that other memory is corrupt SAP B1

    Dear All,
    While adding customization addon, the below error shows.
    The below credentials ,
    SAP B1 -- 9.0 Version
    Patch level -- PL 06
    DIAPI -- 32 bit (x86)
    "Attempted to read or write protected memory. This is often an indication that other memory is corrupt".
    Please fix this issue ASAP.
    Thanks & Regards,
    Bowya S S

    Hi,
    Please check SAP note:
    1988581 - Unable to update UDT
    Thanks & Regards,
    Nagarajan

Maybe you are looking for