Message 1 of 8
[Bug] [Regression] Set CurrentType cause SEH Exception
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Unexpected error when calling the CurrentType setter in FamilyManager. System.Runtime.InteropServices.SEHException (0x80004005):
Versions affected: Revit 2025.4.
Note: Revit 2024 and older works fine.
Code sample:
[UsedImplicitly]
[Transaction(TransactionMode.Manual)]
public class StartupCommand : ExternalCommand
{
public override void Execute()
{
var documentsPath = $@"C:\Program Files\Autodesk\Revit {Application.VersionNumber}\Samples";
foreach (var documentPath in Directory.EnumerateFiles(documentsPath, "*.rfa"))
{
var document = Application.OpenDocumentFile(new FilePath(documentPath), new OpenOptions
{
AllowOpeningLocalByWrongUser = true,
OpenForeignOption = OpenForeignOption.Open,
Audit = false
});
try
{
using var transaction = new Transaction(document);
transaction.Start("Set CurrentType");
var familyManager = document.FamilyManager;
foreach (FamilyType familyType in familyManager.Types)
{
familyManager.CurrentType = familyType;
}
transaction.Commit();
}
finally
{
document.Close(false);
}
}
}
}