Results 1 to 4 of 4

Thread: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt

  1. #1
    Active Member
    Join Date
    2009-08
    Posts
    62
    Login to Give a bone
    0

    Default "Attempted to read or write protected memory. This is often an indication that other memory is corrupt

    Any thoughts on why this is not committing to the db I get the above error ob the db.


    Code:
        Public Function SetCustomProperty(ByVal sPath As String, ByVal Name As String, ByVal Value As String) As Boolean
    
            Dim Builder As DatabaseSummaryInfoBuilder
            Using db As Database = New Database()
                db.ReadDwgFile(sPath, FileShare.ReadWrite, True, "")
                Builder = New DatabaseSummaryInfoBuilder(db.SummaryInfo)
                Using tr As Transaction = db.TransactionManager.StartTransaction()
    
                    Try
                        If Builder.CustomPropertyTable(Name) Then
                            Builder.CustomPropertyTable.Item(Name) = Value
                        Else
                            Builder.CustomPropertyTable.Add(Name, Value)
                        End If
    
                        db.SummaryInfo = Builder.ToDatabaseSummaryInfo
                    Catch
                        Return False
                    End Try
    
                    tr.Commit()
                End Using
            End Using
            Return True
        End Function

  2. #2
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt

    Don't you have to lock any non-active databases before changing them?
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  3. #3
    Active Member
    Join Date
    2009-08
    Posts
    62
    Login to Give a bone
    0

    Default Re: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt

    How do I do this as the drawing is not opened... I cant use

    Using docLock As DocumentLock = Application.DocumentManager.MdiActiveDocument.LockDocument()

  4. #4
    Active Member
    Join Date
    2009-08
    Posts
    62
    Login to Give a bone
    0

    Default Re: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt

    Thanks Tony,

    I will have a look at this see it it helps my situation.

    I was reading the SummaryInfo on of max 10 file databases during activate events and it was creating performance issues with my app. I've gotten around it now by saving the SummaryInfo details to the registry when edited that way I can load it quickly when the docs activate.

    Is there a better way to read the SummaryInfo without opening the database on a closed dwg file?

    Cheers.

Similar Threads

  1. Replies: 2
    Last Post: 2014-10-17, 04:57 PM
  2. Replies: 4
    Last Post: 2011-09-13, 12:17 PM
  3. Attempted to read or write protected memory?
    By c-hawk in forum Revit - API
    Replies: 2
    Last Post: 2009-08-12, 02:32 PM
  4. RAM->REVIT 2009 protected memory error
    By mpruna in forum Revit - API
    Replies: 2
    Last Post: 2008-05-21, 01:49 PM
  5. AutoCAD Message "CUI file 'acad.cui' is write protected."
    By meb2283 in forum AutoCAD CUI Menus
    Replies: 4
    Last Post: 2008-04-29, 04:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •