Null Reference Exception in plugin when accessing ActiveFileProperties and ActiveFile in Trados Studio 2024

Context
First of all, I should note that I have previously worked on our plugin Trados Studio 2024 compatibility and everything was working fine. While I was creating a new version for Trados 2024 with our latest changes, the plugin started failing with NullReferenceException when opening a new file. The plugin is working fine in Studio 2021-2022 versions, but failing in Studio 2024.


Issue Description
In Studio 2024, when the plugin initializes and tries to access _activeDocument.ActiveFileProperties and _activeDocument.ActiveFile, both properties return null, causing NullReferenceExceptions. These properties were previously accessible in Studio 2021-2022, suggesting an API change in the newer version.

Error Points
The error starts from EditorController_ActiveDocumentChanged method where the the Document has null ActiveFile and ActiveFileProperties:

private void EditorController_ActiveDocumentChanged(object sender, DocumentEventArgs e)
{
    SetActiveDocument(e.Document);
}

What I've Tried
1. Added null checks for _activeDocument.ActiveFile before attempting to access it
2. Attempted to access file properties through other paths (ActiveDocument.Files collection)
3. Checked the Studio 2024 documentation for API changes (limited information available)


Expected Behavior
The plugin should be able to access file metadata in Trados Studio 2024 to determine if the current document was processed by ESTeam Language Factory and display the appropriate tabs and information based on the document type.


Actual Behavior
The plugin fails with NullReferenceException when trying to access ActiveFileProperties or ActiveFile.