Error opening or creating project: Attempted to read or write protected memory

Product(s): WaterGEMS, WaterCAD, HAMMER, SewerGEMS, SewerCAD, StormCAD, CivilStorm, PondPack
Version(s): 08.11.XX.XX and 10.XX.XX.XX
Area: Modeling

Problem

The following error is generated when opening or creating a model file: Attempted to read or write protected memory.

Solution

Compact Database

First, try compacting the database. To do this, close the model but leave the product open. Go to Tools > Database Utilities > Compact Database (V8i) or File > Database Utilities > Compact Database (CONNECT Edition). Select the database file and choose the option to purge the model to save space. Once completed, open the model and see if the issue still occurs.

Isolate the main model files

Second, try creating a new folder and moving just the starter file and the database file to the new folder. For Water products, this would be the .WTG and .WTG.SQLITE and storm/sewer products this would be .STSW and .STSW.SQLITE. For PondPack, it would be the .PPC and .PPC.MDB. for Once done, open the model from the new folder location.

If that doesn't help, try importing the database into a new drawing. This is done by going to File > Import > (product name) database. 

An instance was also report when there was a large background layer associated with the model file. The steps above would remove reference to the background layer as part of the process, but if you have a large background you could try deleting this to see if that impacts the results.

If the model is saved to a network drive, try to move the model files to the local drive instead. Since there can be any number of configurations for a network drive, limited testing is done on how models save to network drives. For this reason, it is recommended that model files are opened from and saved to the local hard drive. The files can then be copied into the network drive. If you have access to ProjectWise, this would be an alternative to saving your models to a network drive.

Delete the Engineering Library Registry

Lastly, you can also try deleting the engineering library database.  Go to c:\users\<user name>\AppData\Roaming\Bentley\EngineeringLibraries and delete EngineeringLibraries.mdb and/or Engineeringlibraries.sqlite.  Make sure the program is closed when you do this.  When you open the program again, the files will get re-created. Note: Custom items in the engineering library will be lost if you do this.

Video Card

Switch the Default

If you have more than one video hardware/display adapter showing (such as onboard CPU video like "Intel HD" plus a discrete video card like NVidia), try changing the settings so one is the default that is used for the program. The method to do this varies depending on the manufacturer and driver, but as an example for NVIDIA hardware, right click on your desktop, choose the entry for the NVIDIA control panel, then look for a setting to designate the product to use the "high end" or "discrete" hardware.

Update the Drivers

This type of issue has also been known to occur with certain video hardware driver versions (such as Intel HD 520 driver versions from the end of 2017). Try updating the video card drivers associated with the graphics hardware on your computer, or roll back if an updated version does not resolve the issue.

See: Updating video drivers and troubleshooting video hardware issues

Compatibility model troubleshooter

If the product is installed on a Windows 8 or Windows 10 machine, right-click on the shortcut on desktop and select Properties. Click on the Compatibility tab and then click “Run compatibility troubleshooter.” Next, select “Try recommended settings”. Test by opening a file. If it opens, select “Next” and then “Save settings.”

Clean Reinstallation

In case the problem is related to a file stored in the user profile, try a clean reinstallation:

How do I perform a clean uninstall and reinstall of the Hydraulic and Hydrology products?

Repair or replace user profile

If the problem does not occur on another Windows user profile on the same computer and no differences can be found as far as running applications, etc. Try creating a new Windows account for the user, or reimage/reinstall the operating system.

See Also

How do I perform a clean uninstall and reinstall of the Hydraulic and Hydrology products?

Updating video drivers and troubleshooting video hardware issues

Recommended
Related