fix: match active fixture document by stable name

This commit is contained in:
codex
2026-08-04 07:26:45 +03:00
parent 13578b7c9b
commit 1b4ff816ba
2 changed files with 3 additions and 2 deletions
@@ -199,7 +199,8 @@ internal sealed class FirstLimitedApplyAutomationCoordinator
// coordinator receives the returned Document. Confirm the current // coordinator receives the returned Document. Confirm the current
// active document after assignment so that one missed event cannot // active document after assignment so that one missed event cannot
// strand the workflow waiting for another startup Idle. // strand the workflow waiting for another startup Idle.
if (ReferenceEquals(AcadApplication.DocumentManager.MdiActiveDocument, document)) var activeDocument = AcadApplication.DocumentManager.MdiActiveDocument;
if (activeDocument is not null && string.Equals(activeDocument.Name, document.Name, StringComparison.OrdinalIgnoreCase))
{ {
fixtureDocumentActivated = true; fixtureDocumentActivated = true;
transitions.Add("FixtureDocumentActiveAfterOpen"); transitions.Add("FixtureDocumentActiveAfterOpen");
@@ -103,7 +103,7 @@ public sealed class FoundationTests
var source = File.ReadAllText(Path.Combine(ProjectRoot, "src", "PRecAnnot.Plant3D2026", "FirstLimitedApplyAutomation.cs")); var source = File.ReadAllText(Path.Combine(ProjectRoot, "src", "PRecAnnot.Plant3D2026", "FirstLimitedApplyAutomation.cs"));
var start = source[source.IndexOf("public void Start()", StringComparison.Ordinal)..source.IndexOf("private void CompleteLifecycleProbe", StringComparison.Ordinal)]; var start = source[source.IndexOf("public void Start()", StringComparison.Ordinal)..source.IndexOf("private void CompleteLifecycleProbe", StringComparison.Ordinal)];
Assert.Contains("FixtureDocumentActiveAfterOpen", start); Assert.Contains("FixtureDocumentActiveAfterOpen", start);
Assert.Contains("ReferenceEquals(AcadApplication.DocumentManager.MdiActiveDocument, document)", start); Assert.Contains("string.Equals(activeDocument.Name, document.Name", start);
Assert.Contains("TryActivateProjectAndVerifyContext();", start); Assert.Contains("TryActivateProjectAndVerifyContext();", start);
} }