jeremytammik / RevitLookup

Interactive Revit RFA and RVT project database exploration tool to view and navigate BIM element parameters, properties and relationships.
http://thebuildingcoder.typepad.com
MIT License
1.11k stars 302 forks source link

Revit crashes if i snoop a Bending Detail Schematic #225

Open maartendebeuf opened 7 months ago

maartendebeuf commented 7 months ago

When i select a Bending Detail Schematic and preform a Snoop Selection Revit crashes.

Below a fragment of the journal where i think the crash hapens. (if needed i can send the full journal).

'<> 'E 30-Apr-2024 08:43:38.642; 0:< Jrn.MouseMove 0 , 580 , 24 'E 30-Apr-2024 08:43:38.642; 0:< Jrn.RibbonEvent "Execute external command:CustomCtrl%Revit Lookup%RevitLookup.Commands.SnoopSelectionCommand:RevitLookup.Commands.SnoopSelectionCommand" ' 0.193117 1:<<<API External Command Time 'H 30-Apr-2024 08:43:38.835; 0:< Jrn.Data "APIStringStringMapJournalData" , 0 'H 30-Apr-2024 08:43:38.884; 0:< Jrn.Data _ "Restricted Propagation" , 2, 93 ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void, _s__ThrowInfo) ' 0:< <> ' 'Edit mode: IDR_COMMON 'Command: ID_BUTTON_SELECT 'Category: 1 'Bar list: ' Dialog_Revit_DynamicLabelDBar ' Dialog_Essentials_FilterSelectionNew 'Provider list: ' PP_BendingDetailLeaders_ModScope ' PP_MultiAlign_ModScope ' PP_SchematicBendingDetails_ModScope 'Product: Revit

Nice3point commented 7 months ago

Initial investigation

Property: TagText Exception: System.AccessViolationException Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Nice3point commented 7 months ago

@jeremytammik hi Jeremy. Issue for Revit Development team


Bug ticket

Revit version: 2025 only Class: Autodesk.Revit.DB.IndependentTag Property: TagText Category: OST_RebarBendingDetails Property access: IExternalEventHandler Exception: System.AccessViolationException Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Issue level: Critical

Description: getting the tag text for "Structural Rebar Bending Details" results in an AccessViolationException. The problem is relevant in 2025 and is not observed in later Revit versions. Another problem is that this type of exception cannot be handled by a catch block since .Net Core, as it is considered unique and requires the application to be terminated.

Revit API fixes required

image

Nice3point commented 7 months ago

For now, we can just disable this property in RevitLookup until we see a fix in the API

maartendebeuf commented 7 months ago

Thanks for investigating! I would also like to report that I discovered that it was successful via the "Revit DB Explorer' tool (https://github.com/NeVeSpl/RevitDBExplorer)

Nice3point commented 7 months ago

@maartendebeuf this property also disabled manually in RevitDbExplorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/sources%2FRevitDBExplorer%2FDomain%2FDataModel%2FMemberAccessors%2FIndependentTag%2FIndependentTag_TagText.cs

I have alreade done it for RevitLookup. Wait for a new release.

But revit api issue still exists

jeremytammik commented 7 months ago

Dear Roman and Maarten,

Thank you both for reporting and analysing this. Sorry to hear about it.

I logged the issue REVIT-221696 [IndependentTag TagText throws AccessViolationException] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

This issue is important to me. What can I do to help?

This issue needs to be assessed by our engineering team and prioritised against all other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

This information is crucial. Our engineering team has limited resources and must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

Best regards,

Jeremy

Nice3point commented 7 months ago

@jeremytammik

Impact on your application and/or your development.

Critical. This bug causes the domain to be terminated, without possibility to catch it. Normal behaviour: Autodesk.Revit.Exceptions.InvalidOperationException Current behaviour: System.AccessViolationException

The number of users affected. All add-in developers. No impact on engineers, as the bug can only be detected by an API call

The potential revenue impact to you. Negative impact on the structural developers

The potential revenue impact to Autodesk. The Revit crash is having a negative impact

Realistic timescale over which a fix would help you. Nearest hotfix

Nice3point commented 7 months ago

@jeremytammik

Addin solution with example: TagTextBug.zip

Select Debug R25 configuration and run debug.

Only Revit 2025. Bundled Snowdon Towers Structural project

jeremytammik commented 7 months ago

thank you very much!

the development team do indeed insist on a complete minimal reproducible case, saying: I do not see a code snippet or a dataset to reproduce this issue. Would the customer provide this information?

I assume that TagTextBug.zip includes all they need?

Nice3point commented 7 months ago

@jeremytammik yes, TagTextBug.zip contains a C# project with a full reproduction of this issue

Nice3point commented 6 months ago

@jeremytammik hi Jeremy. The same exception with DatumPlane class. Revit 2025 only https://github.com/jeremytammik/RevitLookup/pull/232 изображение

Revit 2024 and lower works fine изображение

Any updates?

jeremytammik commented 6 months ago

They are still looking at REVIT-221696 [IndependentTag TagText throws AccessViolationException]. i added your note on DatumPlane. Thank you!

jeremytammik commented 6 months ago

The development team ask: can you provide a sample Revit project that has the category etc. setup? I have nothing handy and would be a big help. Thank you.

Nice3point commented 6 months ago

@jeremytammik for Bending Detail you can use dafault revit project изображение

Plan L1_43_High изображение

and after placing Bending Detail try to get TagText property using api изображение

Nice3point commented 6 months ago

@jeremytammik as for DatumPlane you can select any Grid and call CanBeVisibleInView using the API изображение

jeremytammik commented 6 months ago

I created a separate Jira issue for the access violation caused by datum plane: REVIT-222687 [DatumPlane.CanBeVisibleInView throws AccessViolationException].

jeremytammik commented 6 months ago

thank you for the detailed instructions to reproduce.

jeremytammik commented 5 months ago

the development team confirmed the issue reported in REVIT-221696 [IndependentTag TagText throws AccessViolationException], closed it, and will address it in the separate new code fix ticket REVIT-223068 [IndependentTag TagText throws AccessViolationException].

Nice3point commented 5 months ago

great news, thanks

jeremytammik commented 5 months ago

they confirm: The issue is on our end. We have identified a fix and are working on releasing it in the next update. The problem is that the system is attempting to use the Bending Detail type to access the tag data instead of the correct tag type. As a workaround, the customer can temporarily create a regular tag type instance to access the text data.

jeremytammik commented 5 months ago

Dear Roman and Maarten,

Thank you for your patience with this. The development team are analysing the code fix issue REVIT-222687 [DatumPlane.CanBeVisibleInView throws AccessViolationException] that was created to address the original ticket REVIT-221696 [IndependentTag TagText throws AccessViolationException]. However, they are having trouble reproducing this issue for Grids. They tried calling CanBeVisibleInView on every Grid for every View in the sample project and haven't had any issues. Can you provide the exact Revit version used, the exact RVT file, and the element IDs of the grids that are throwing an exception? Thank you.

Best regards,

Jeremy

Nice3point commented 5 months ago

@jeremytammik hi Jeremy. FIle: "C:\Program Files\Autodesk\Revit 2025\Samples\Snowdon Towers Sample Architectural.rvt" ElementID: 1275291 Revit version: 25.1.0.44 | 20240516_1515(x64)

The project ships with Revit. I found that this error does not appear in all projects. But it is present in this one. If the bug is not reproduced on this element, it may be that it has been fixed by a fix for IndependentTag

jeremytammik commented 5 months ago

thank you for the details. i passed them on.

jeremytammik commented 5 months ago

problem reported in REVIT-222687 [DatumPlane.CanBeVisibleInView throws AccessViolationException] was confirmed.

new code fix issue created: REVIT-223580 [DatumPlane.CanBeVisibleInView throws AccessViolationException].

Nice3point commented 5 months ago

Great 🎉 Then we are waiting for details, I wonder if the reason was the same or not. After all, if different, there are probably other properties/methods that throw AccessViolationException.

jeremytammik commented 4 months ago

work on REVIT-223580 [DatumPlane.CanBeVisibleInView throws AccessViolationException] is in progress. As a temporary workaround, you can check views for the IsTemplate property. If the value is true, then assume CanBeVisibleInView is false without making the call on that view.

jeremytammik commented 4 months ago

REVIT-223068 [IndependentTag TagText throws AccessViolationException] has been resolved and scheduled for inclusion in the next update release.

Nice3point commented 4 months ago

@jeremytammik thanks Jeremy, happy to hear it 🙂

Nice3point commented 4 months ago

I'll disable the restrictions in RevitLookup as soon as this patch comes out for Revit

maartendebeuf commented 4 months ago

Thanks Roman and Jeremy for the updates and especially the great work you put into this!

jeremytammik commented 4 months ago

REVIT-223580 [DatumPlane.CanBeVisibleInView throws AccessViolationException] has been closed now; Resolution: Fixed, Submitted Version: next major release of Revit.

jeremytammik commented 4 months ago

REVIT-223068 [IndependentTag TagText throws AccessViolationException] has been closed now; Resolution: Fixed, Submitted Versions: next major release of Revit + next update release of Revit 2025.