Testing debug with a modeless form not working?
SonaBIMDev opened this issue · 15 comments
Hi @chuongmep
I've got an other pb with my solution and debugging with AIM.
I've got an IExternalCommand wich simply put a TextNote into a view and it works when I run it with the AIM.
But, I've got an other IExternalCommand wich call a method coded into IExternalApplication with make a Show of a window form.
And, in this case, it does'nt work.
Do you know why?
@pierrenavarra can show some code demo ?
Events.zip
Hi @chuongmep , here is a sample
You can click on tab "events" and click on button to show the modeless
Also, if ou do it via the AIM, you'll reproduce the pb (hope so :-))
Hmm, AIM just execute command inside Execute this :
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
//do something not startup IExternalApplication
return Result.Succeeded;
}
Reson error because AIM not startup IExternalApplication, IExternalApplication only load when you define .addin, so thisApp will be null now => not working.
Let do some thing to init class
Application app = new Application();
app.ShowForm(commandData.Application);
return Result.Succeeded;
Yes!!! It works!!
And why when I run the command via AIM it works and just after if I click on the button it make an error?
Many thx @chuongmep !!
@pierrenavarra let ensure that you have copied enough all library to folder add-in ?
I've got only one dll
it works when you click on btn and next on running command via AIM?
What XCedd.WPF.AvaonDock.dll is?
@pierrenavarra Addinmanager can't load a assembly duplicate because we can't unload assembly before, with define .addin in revit, just have way to unload addin is close revit because revit still is in .NET Framework 4.8.
https://stackoverflow.com/questions/6258160/unloading-the-assembly-loaded-with-assembly-loadfrom
Oh I see and is your link is a solution or not?
Anyway, many thx to take time to answer me :-)
@pierrenavarra it is bad solution, may be needing Autodesk update Revit support .NET Core or NET6 to develop future unload assembly
https://docs.microsoft.com/en-us/dotnet/standard/assembly/unloadability
Ok, I understand. Anyway, AIM works and permits me to debug trace my code and it's cool!
Many thx!
Thanks for compliment, let contribute if you have any idea 👏
Hi @chuongmep
I still have a pb .
Because I'm raising a DocumentClosing event on IExternalApplication...
Ok, I finded and call my Event on IExternalCommand..Sorry for disturbing