Cannot run debug mode in Visual Studio (Revit 2025)

Cannot run debug mode in Visual Studio (Revit 2025)

000853959
Enthusiast Enthusiast
716 Views
7 Replies
Message 1 of 8

Cannot run debug mode in Visual Studio (Revit 2025)

000853959
Enthusiast
Enthusiast

Good day everone: 

everytime I start debugging, it gives me Fatal Error, I tried all debug options though. Anyone have an idea of whats hapening? I can run it from VS , However, when I start debug, it crashes and pops up the following message! I use Revit 2025

 

debug error.png

0 Likes
717 Views
7 Replies
Replies (7)
Message 2 of 8

moturi.magati.george
Autodesk
Autodesk

Hi @000853959,

It might be difficult for us to debug your issue. Kindly attach or send me the minimum sample for us to have a look and advice.

  Moturi George,     Developer Advocacy and Support,  ADN Open
0 Likes
Message 3 of 8

ricaun
Advisor
Advisor

Are you using Visual Studio 2022?

 

The error say something with NET Framework, you are building your addin with net8.0 right?

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 4 of 8

000853959
Enthusiast
Enthusiast

Correct! Iam using VS 2022 .NET 8.0 with Revit 2025. any ideas?

0 Likes
Message 5 of 8

000853959
Enthusiast
Enthusiast

Hello there:

absolutely, here is my txt file. Iam uncertain if you need more docs.🤔 

0 Likes
Message 6 of 8

000853959
Enthusiast
Enthusiast

.

0 Likes
Message 7 of 8

000853959
Enthusiast
Enthusiast

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;

 

namespace selectElement
{
[Transaction(TransactionMode.Manual)]
public class selectElement : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
// get document and ui document

UIDocument uidoc = commandData.Application.ActiveUIDocument;
Document doc = commandData.Application.ActiveUIDocument.Document;


try
{
// select the element

Reference reff = uidoc.Selection.PickObject(ObjectType.Element);
ElementId eleId = reff.ElementId;

//get element from element ID

Element ele = doc.GetElement(eleId);

//show element name, element category, element ID

TaskDialog.Show("Element Information", "Element Name: " + ele.Name + Environment.NewLine
+ "Element Category: " + ele.Category.Name + Environment.NewLine
+ "Element ID: " + eleId);


return Result.Succeeded;

}
catch (Exception e)
{
message = e.Message;
return Result.Failed;
}


}
}
}

0 Likes
Message 8 of 8

moturi.magati.george
Autodesk
Autodesk

Hi @000853959 

I tested your class and it seems to be working fine.

Find attached

  Moturi George,     Developer Advocacy and Support,  ADN Open
0 Likes