RevitLookup icon indicating copy to clipboard operation
RevitLookup copied to clipboard

Revit crashes if i snoop a Bending Detail Schematic

Open maartendebeuf opened this issue 1 year ago • 32 comments

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).

'<<End update Provider-triggered panels>> '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*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< Exception caught from managed method RevitDBAPI::Void _CxxThrowException(Void*, _s__ThrowInfo*) <System.Runtime.InteropServices.SEHException> <External component has thrown an exception.> ' 0:< <<Begin update Provider-triggered panels>> ' '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

maartendebeuf avatar Apr 30 '24 06:04 maartendebeuf

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 avatar Apr 30 '24 10:04 Nice3point

@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 avatar Apr 30 '24 11:04 Nice3point

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

Nice3point avatar Apr 30 '24 11:04 Nice3point

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)

maartendebeuf avatar Apr 30 '24 13:04 maartendebeuf

@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

Nice3point avatar Apr 30 '24 15:04 Nice3point

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:

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

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

jeremytammik avatar Apr 30 '24 15:04 jeremytammik

@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 avatar Apr 30 '24 18:04 Nice3point

@jeremytammik

Addin solution with example: TagTextBug.zip

Select Debug R25 configuration and run debug.

Only Revit 2025. Bundled Snowdon Towers Structural project

Nice3point avatar Apr 30 '24 18:04 Nice3point

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?

jeremytammik avatar May 01 '24 08:05 jeremytammik

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

Nice3point avatar May 01 '24 08:05 Nice3point

@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?

Nice3point avatar May 08 '24 21:05 Nice3point

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

jeremytammik avatar May 15 '24 10:05 jeremytammik

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.

jeremytammik avatar May 24 '24 06:05 jeremytammik

@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 avatar May 24 '24 18:05 Nice3point

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

Nice3point avatar May 24 '24 18:05 Nice3point

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

jeremytammik avatar May 31 '24 11:05 jeremytammik

thank you for the detailed instructions to reproduce.

jeremytammik avatar May 31 '24 11:05 jeremytammik

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].

jeremytammik avatar Jun 12 '24 09:06 jeremytammik

great news, thanks

Nice3point avatar Jun 12 '24 10:06 Nice3point

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 avatar Jun 13 '24 09:06 jeremytammik

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

jeremytammik avatar Jun 25 '24 15:06 jeremytammik

@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

Nice3point avatar Jun 25 '24 20:06 Nice3point

thank you for the details. i passed them on.

jeremytammik avatar Jun 26 '24 07:06 jeremytammik

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

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

jeremytammik avatar Jun 26 '24 18:06 jeremytammik

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.

Nice3point avatar Jun 26 '24 19:06 Nice3point

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 avatar Jul 02 '24 15:07 jeremytammik

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

jeremytammik avatar Jul 03 '24 09:07 jeremytammik

@jeremytammik thanks Jeremy, happy to hear it 🙂

Nice3point avatar Jul 03 '24 09:07 Nice3point

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

Nice3point avatar Jul 03 '24 09:07 Nice3point

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

maartendebeuf avatar Jul 04 '24 07:07 maartendebeuf