Error opening the revit cloud model in Forge Environment

59 views Asked by At

When opening the revit cloud model through Design Automation, sometimes it throws an error called "System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.". The error is thrown at -

var cloudModelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(CloudRegion, ProjectGuid, ModelGuid);
var userWorksetInfo = WorksharingUtils.GetUserWorksetInfo(cloudModelPath);
var worksetIds = GetWorksetIds(userWorksetInfo);
OpenOptions openingOptions = new OpenOptions();
WorksetConfiguration worksetConfiguration = new WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets);
worksetConfiguration.Open(worksetIds);
openingOptions.SetOpenWorksetsConfiguration(worksetConfiguration);

doc = rvtApp.OpenDocumentFile(cloudModelPath, openingOptions);

worksetIds is a list of userWorksetInfo.Id s filtered based on if each userWorksetInfo.Name includes certain substrings.

The exception is thrown at RevitApplication.openDocumentFile(RevitApplication* , ModelPath* , OpenOptions*). But for the same revit file, it does not throw the exception always.

I am following the example documented here - revit api docs

0

There are 0 answers