<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Revit Add-in with WPF fails on some PCs, works perfectly on others in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12919788#M4101</link>
    <description>&lt;P&gt;Thank you again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your detailed example is much appreciated. I attemted to quickly implement your solution, but it became clear that I need more time to do so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Additionally, another test was conducted: &lt;/U&gt;&lt;/P&gt;&lt;P&gt;the "RevitFilters" class, which is located in another vs project, was moved to the same vs project as the command.&lt;/P&gt;&lt;P&gt;The code now works as expected when implementing:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;SystemTypes = RevitFilters.GetAllSystemTypesNames(doc);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason for this issue remains unclear when using multiple VS projects.&lt;/P&gt;&lt;P&gt;It may be related to certain references or the asynchronous operations involved.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jul 2024 15:16:40 GMT</pubDate>
    <dc:creator>revitdeveloper</dc:creator>
    <dc:date>2024-07-25T15:16:40Z</dc:date>
    <item>
      <title>Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12907318#M4090</link>
      <description>&lt;P&gt;I have an Add-in that uses WPF. The WPF has 3 Dropdown selections.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;The Problem:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;On some PCs, all selection values load and display correctly in the WPF, while on other PCs, the selection remains blank.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;This is what the WPF selection looks like (without clicking on the dropdown):&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="revitdeveloper_0-1721381408461.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1388636i259EAD98BD64B0DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="revitdeveloper_0-1721381408461.png" alt="revitdeveloper_0-1721381408461.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The strange thing is if I remove the 3rd selection then it works properly on all PCs.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;This is what the WPF looks like if I remove the 3rd selection (without clicking on the dropdown):&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="revitdeveloper_1-1721381408463.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1388635i7B8C173733C7E913/image-size/medium?v=v2&amp;amp;px=400" role="button" title="revitdeveloper_1-1721381408463.png" alt="revitdeveloper_1-1721381408463.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;This is the relevant part of the code from the .xaml.cs (WPF Codebehind) class:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="revitdeveloper_2-1721381408472.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1388637iBD9C37F37B476775/image-size/medium?v=v2&amp;amp;px=400" role="button" title="revitdeveloper_2-1721381408472.png" alt="revitdeveloper_2-1721381408472.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;This is the relevant part of the code from the “IFCToRevitGetPipeAndDuctTypesIExternalEvent” class:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="revitdeveloper_3-1721381408483.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1388639i835B4A0C4C8ECBAE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="revitdeveloper_3-1721381408483.png" alt="revitdeveloper_3-1721381408483.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;This is the relevant part of the code from the “RevitFilters” class:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="revitdeveloper_4-1721381408486.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1388638iBA131D861E4956BA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="revitdeveloper_4-1721381408486.png" alt="revitdeveloper_4-1721381408486.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="revitdeveloper_5-1721381408490.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1388640i6A00CB15E805B400/image-size/medium?v=v2&amp;amp;px=400" role="button" title="revitdeveloper_5-1721381408490.png" alt="revitdeveloper_5-1721381408490.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="revitdeveloper_6-1721381408492.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1388641i2F9CDED5DE8BFFEB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="revitdeveloper_6-1721381408492.png" alt="revitdeveloper_6-1721381408492.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;I have identified where the problem begins:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;In the class “IFCToRevitGetPipeAndDuctTypesIExternalEvent” (shown in the fourth screenshot), the Execute method is not being triggered. I inserted a MessageBox within this method, but it never appeared.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Attempts Made Without Success:&lt;/U&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Created a separate IExternalEvent specifically to populate item 3.&lt;/LI&gt;&lt;LI&gt;Removed all other add-ins from the affected PCs.&lt;/LI&gt;&lt;LI&gt;Created a second “_eventCompleted.Task” exclusively for item 3.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;The issue persists inconsistently:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;It works on some PCs running Windows 10 or 11.&lt;/P&gt;&lt;P&gt;It does not work on other PCs running the same versions of Windows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you encountered a similar problem before and found a solution? This add-in is in high demand within the company, so any suggestions for resolving this issue would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if you need additional code or a more detailed explanation.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 12:39:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12907318#M4090</guid>
      <dc:creator>revitdeveloper</dc:creator>
      <dc:date>2024-07-19T12:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12907803#M4091</link>
      <description>&lt;P&gt;Did you test with the same file in multiple pcs?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose the &lt;STRONG&gt;GetAllSystemTypes&lt;/STRONG&gt; is throwing an Exception, or some Exception is happening inside the Execute.&lt;/P&gt;&lt;P&gt;At least if something fail in there the &lt;STRONG&gt;OnEventComplete&lt;/STRONG&gt; never happen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could add a try/catch inside the &lt;STRONG&gt;Execute&lt;/STRONG&gt; to show the exception if happens.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you test something like that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 14:01:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12907803#M4091</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2024-07-19T14:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12907877#M4092</link>
      <description>&lt;P&gt;Thank you for your suggestion!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It was tested with the same model.&lt;/P&gt;&lt;P&gt;You’re right, a try/catch block should have been used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will test this again on Monday when I have access to my colleague's PC.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 14:25:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12907877#M4092</guid>
      <dc:creator>revitdeveloper</dc:creator>
      <dc:date>2024-07-19T14:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12913858#M4093</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I retested the code, incorporating the try-catch block, but the selection remains empty. It appears that the Execute method is not being called. This behavior is quite strange and unusual, as the code works perfectly on my PC but not on my colleague's.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 07:25:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12913858#M4093</guid>
      <dc:creator>revitdeveloper</dc:creator>
      <dc:date>2024-07-23T07:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12914388#M4094</link>
      <description>&lt;P&gt;How and when are you creating the &lt;STRONG&gt;IFCToRevitGetPipeAndDuctTypesIExternalEvent?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you mention that is not trigger the &lt;STRONG&gt;Execute &lt;/STRONG&gt;you mean that the method Execute never starts, like if you add a message box in the start of the method that never happen I suppose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I kinda have some issues in the past that the &lt;STRONG&gt;Raise&lt;/STRONG&gt; never start the &lt;STRONG&gt;ExternalEvent, &lt;/STRONG&gt;was related with the way I was creating the &lt;STRONG&gt;ExternalEvent, &lt;/STRONG&gt;maybe that's the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could try to use some library to make easier to run Revit code using&amp;nbsp;asynchronously Task, at least to test if fix the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://github.com/ricaun-io/ricaun.Revit.UI.Tasks" target="_blank"&gt;https://github.com/ricaun-io/ricaun.Revit.UI.Tasks&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;That handle the creation of the &lt;STRONG&gt;ExternalEvent&lt;/STRONG&gt; with a &lt;STRONG&gt;Task&lt;/STRONG&gt; embedded with timeout and others stuff.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 12:11:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12914388#M4094</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2024-07-23T12:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12914979#M4095</link>
      <description>&lt;P&gt;I am creating the&amp;nbsp;&lt;STRONG&gt;IFCToRevitGetPipeAndDuctTypesIExternalEvent&lt;/STRONG&gt; in the command class:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;[Transaction(TransactionMode.Manual)]
public class IFCToRevitCommand : IExternalCommand
{
    public static Document Doc { get; set; }
    public static UIDocument UiDoc { get; set; }
    private static Autodesk.Revit.ApplicationServices.Application Rapp { get; set; }
    private static ExternalCommandData CommandData { get; set; }
    private static string RefMessage { get; set; }

    private static string DocumentTitle { get; set; }


    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {
        // Prepare variables
        UIApplication uiApp = commandData.Application;
        UIDocument uiDoc = uiApp.ActiveUIDocument;
        Document doc = uiDoc.Document;
        Autodesk.Revit.ApplicationServices.Application app = uiApp.Application;

        // Set property values
        CommandData = commandData;
        Doc = doc;
        UiDoc = uiDoc;
        Rapp = app;
        RefMessage = message;

        // Create ExternalEvents
        IExternalEventHandler handler_iFCToRevitGetPipeTypesIExternalEvent = new IFCToRevitGetPipeAndDuctTypesIExternalEvent();
        ExternalEvent iFCToRevitGetPipeTypesExternalEvent = ExternalEvent.Create(handler_iFCToRevitGetPipeTypesIExternalEvent);

        IExternalEventHandler handler_iFCToRevitIExternalEvent = new IFCToRevitIExternalEvent();
        ExternalEvent iFCToRevitExternalEvent = ExternalEvent.Create(handler_iFCToRevitIExternalEvent);


        // Initialise WPF
        IFCToRevitWPF iFCToRevitWPF = new IFCToRevitWPF(commandData, elements, uiDoc, uiApp, iFCToRevitGetPipeTypesExternalEvent, iFCToRevitExternalEvent);
        iFCToRevitWPF.Show();

        return Result.Succeeded;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the WPF .xaml.cs (code-behind) class,&amp;nbsp; the variables passed from the command class are initialised through the constructor. Additionally, in the constructor, I also initialize an ExternalEvent property. This allows me to raise the ExternalEvent in the "RaiseExternalEventAsync()" method of the code-behind.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public partial class IFCToRevitWPF
{
    public static UIDocument UiDoc { get; set; }
    public static Document Doc { get; set; }
    public static ExternalCommandData CommandData { get; set; }
    public static string RefMessage = "";
    public static ElementSet ElementSetProperty { get; set; }
    public static UIApplication UiApp { get; set; }

    public static string SelectedPipeType { get; set; }

    public static string SelectedDuctType { get; set; }

    public static string SelectedSystemType { get; set; }

    public static ExternalEvent IFCToRevitGetPipeTypesExternalEvent { get; set; }
    public static ExternalEvent IFCToRevitExternalEvent { get; set; }

    private TaskCompletionSource&amp;lt;bool&amp;gt; _eventCompleted;


    public IFCToRevitWPF(
        ExternalCommandData commandDataMK,
        ElementSet elementsMK,
        UIDocument uiDocMK,
        UIApplication uiAppMK,
        ExternalEvent iFCToRevitGetPipeTypesExternalEvent,
        ExternalEvent iFCToRevitExternalEvent
        )
    {

        CommandData = commandDataMK;
        ElementSetProperty = elementsMK;
        UiDoc = uiDocMK;
        Doc = uiDocMK.Document;
        UiApp = uiAppMK;
        IFCToRevitGetPipeTypesExternalEvent = iFCToRevitGetPipeTypesExternalEvent;
        IFCToRevitExternalEvent = iFCToRevitExternalEvent;

        _eventCompleted = new TaskCompletionSource&amp;lt;bool&amp;gt;();
        IFCToRevitGetPipeAndDuctTypesIExternalEvent.EventCompleted += OnEventCompleted;

        InitializeComponent();
        ApplicationThemeManager.Apply(this);

    }

    private void OnEventCompleted(object sender, EventArgs e)
    {
        _eventCompleted.TrySetResult(true);
    }

    private async void RaiseExternalEventAsync()
    {

        // Raise the external event and wait for it to complete asynchronously
        IFCToRevitGetPipeTypesExternalEvent.Raise();
        await _eventCompleted.Task;

        // Load ComboBox items after the event completes
        SelectPipeType_ComboBox.ItemsSource = IFCToRevitGetPipeAndDuctTypesIExternalEvent.PipeTypes;
        SelectDuctType_ComboBox.ItemsSource = IFCToRevitGetPipeAndDuctTypesIExternalEvent.DuctTypes;
        SelectSystemType_ComboBox.ItemsSource = IFCToRevitGetPipeAndDuctTypesIExternalEvent.SystemTypes;

    }

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have more of an idea now based on what you see in my code, please let me know.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you for the suggestion of the library that can handle all the async operations, this looks very cool!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If I have the time I will look into it more, maybe it is the solution.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 16:15:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12914979#M4095</guid>
      <dc:creator>revitdeveloper</dc:creator>
      <dc:date>2024-07-23T16:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12915024#M4096</link>
      <description>&lt;P&gt;Why do you have so many static properties. &lt;span class="lia-unicode-emoji" title=":grinning_squinting_face:"&gt;😆&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing you could try is to move the creation of the &lt;STRONG&gt;ExternalEvent&lt;/STRONG&gt; to be inside the constructor of the Window, and make the &lt;STRONG&gt;ExternalEvent&lt;/STRONG&gt; not static.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And you probably could remove the static &lt;EM&gt;&lt;STRONG&gt;Doc&lt;/STRONG&gt; &lt;/EM&gt;inside the&lt;STRONG&gt; IExternalEvent.Execute&lt;/STRONG&gt; and get the document using the &lt;STRONG&gt;UIApplication&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By default I only pass the &lt;STRONG&gt;UIApplication&lt;/STRONG&gt; in the constructor of the Window, with that I have access to the document, uidocument and so on.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 16:47:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12915024#M4096</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2024-07-23T16:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12915489#M4097</link>
      <description>&lt;P&gt;I like to use properties so I can pass values to other classes but also encapsulate the variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code now looks like this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public partial class IFCToRevitWPF
{
    public static UIDocument UiDoc { get; set; }
    public static Document Doc { get; set; }
    public static ExternalCommandData CommandData { get; set; }
    public static string RefMessage = "";
    public static ElementSet ElementSetProperty { get; set; }
    public static UIApplication UiApp { get; set; }

    public static string SelectedPipeType { get; set; }

    public static string SelectedDuctType { get; set; }

    public static string SelectedSystemType { get; set; }

    public ExternalEvent IFCToRevitGetPipeTypesExternalEvent { get; set; }
    public ExternalEvent IFCToRevitExternalEvent { get; set; }

    private TaskCompletionSource&amp;lt;bool&amp;gt; _eventCompleted;


    public IFCToRevitWPF(
        ExternalCommandData commandDataMK,
        ElementSet elementsMK,
        UIDocument uiDocMK,
        UIApplication uiAppMK
        )
    {

        IExternalEventHandler handler_iFCToRevitGetPipeTypesIExternalEvent = new IFCToRevitGetPipeAndDuctTypesIExternalEvent();
        ExternalEvent iFCToRevitGetPipeTypesExternalEvent = ExternalEvent.Create(handler_iFCToRevitGetPipeTypesIExternalEvent);
        IFCToRevitGetPipeTypesExternalEvent = iFCToRevitGetPipeTypesExternalEvent;

        IExternalEventHandler handler_iFCToRevitIExternalEvent = new IFCToRevitIExternalEvent();
        ExternalEvent iFCToRevitExternalEvent = ExternalEvent.Create(handler_iFCToRevitIExternalEvent);
        IFCToRevitExternalEvent = iFCToRevitExternalEvent;

        CommandData = commandDataMK;
        ElementSetProperty = elementsMK;
        UiDoc = uiDocMK;
        Doc = uiDocMK.Document;
        UiApp = uiAppMK;

        _eventCompleted = new TaskCompletionSource&amp;lt;bool&amp;gt;();
        IFCToRevitGetPipeAndDuctTypesIExternalEvent.EventCompleted += OnEventCompleted;

        InitializeComponent();
        ApplicationThemeManager.Apply(this);

    }

    private void OnEventCompleted(object sender, EventArgs e)
    {
        _eventCompleted.TrySetResult(true);
    }

    private async void RaiseExternalEventAsync()
    {

        // Raise the external event and wait for it to complete asynchronously
        IFCToRevitGetPipeTypesExternalEvent.Raise();
        await _eventCompleted.Task;

        SelectPipeType_ComboBox.ItemsSource = IFCToRevitGetPipeAndDuctTypesIExternalEvent.PipeTypes;
        SelectDuctType_ComboBox.ItemsSource = IFCToRevitGetPipeAndDuctTypesIExternalEvent.DuctTypes;
        SelectSystemType_ComboBox.ItemsSource = IFCToRevitGetPipeAndDuctTypesIExternalEvent.SystemTypes;

    }

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;[Transaction(TransactionMode.ReadOnly)]
public class IFCToRevitGetPipeAndDuctTypesIExternalEvent : IExternalEventHandler
{
    public static List&amp;lt;string&amp;gt; PipeTypes { get; set; }
    public static List&amp;lt;string&amp;gt; DuctTypes { get; set; }

    public static List&amp;lt;string&amp;gt; SystemTypes { get; set; }

    public static event EventHandler EventCompleted;



    public void Execute(UIApplication app)
    {
        UIDocument uiDoc = app.ActiveUIDocument;
        Document doc = uiDoc.Document;

        try
        {
            PipeTypes = RevitFilters.GetAllPipeTypesNames(doc);
            DuctTypes = RevitFilters.GetAllDuctTypesNames(doc);
            SystemTypes = RevitFilters.GetAllSystemTypesNames(doc);

            OnEventCompleted();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "IFCToRevitGetPipeAndDuctTypesIExternalEvent: Error");
        }

        
    }

    private static void OnEventCompleted()
    {
        EventCompleted?.Invoke(null, EventArgs.Empty);
    }


    public string GetName()
    {
        return "This text does not matter, only needed to execute the IExternalEventHandler: `TransferParameterValuesIExternalEvent.cs`";
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately the result is the same.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 20:34:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12915489#M4097</guid>
      <dc:creator>revitdeveloper</dc:creator>
      <dc:date>2024-07-23T20:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12915578#M4098</link>
      <description>&lt;P&gt;How are you executing the &lt;STRONG&gt;RaiseExternalEventAsync?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;Raise()&lt;/STRONG&gt; return &lt;STRONG&gt;ExternalEventRequest &lt;/STRONG&gt;basically a status about the &lt;STRONG&gt;ExternalEvent&lt;/STRONG&gt;, do something to show if is &lt;STRONG&gt;ExternalEventRequest.Accepted&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I'm thinking that the &lt;STRONG&gt;ExternalEvent&lt;/STRONG&gt; was working fine all along, add &lt;STRONG&gt;MessageBox&lt;/STRONG&gt; in the start and end to make sure.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public void Execute(UIApplication app)
{
   MessageBox.Show("Start", "Execute");
...
   MessageBox.Show("End", "Execute");
}&lt;/LI-CODE&gt;&lt;P&gt;It's strange that some pc work and other don't, odd. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 21:38:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12915578#M4098</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2024-07-23T21:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12916498#M4099</link>
      <description>&lt;P&gt;I found the solution,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for whatever reason when adding the method directly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;List&amp;lt;string&amp;gt; mepSystemTypes = new FilteredElementCollector(doc)
    .OfClass(typeof(MEPSystemType))
    .Cast&amp;lt;MEPSystemType&amp;gt;()
    .Select(st =&amp;gt; st.Name)
    .ToList();

SystemTypes = mepSystemTypes;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of calling the method from another class:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;SystemTypes = RevitFilters.GetAllSystemTypesNames(doc);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works, this is the full Execute method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public void Execute(UIApplication app)
{
    try
    {
        PipeTypes = RevitFilters.GetAllPipeTypesNames(doc);
        DuctTypes = RevitFilters.GetAllDuctTypesNames(doc);

        List&amp;lt;string&amp;gt; mepSystemTypes = new FilteredElementCollector(doc)
            .OfClass(typeof(MEPSystemType))
            .Cast&amp;lt;MEPSystemType&amp;gt;()
            .Select(st =&amp;gt; st.Name)
            .ToList();

        SystemTypes = mepSystemTypes;


        OnEventCompleted();
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message, "IFCToRevitGetPipeAndDuctTypesIExternalEvent: Error");
    }

    
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess it is an issue concerning the references, maybe they are not being found.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Nonetheless, it would be intriguing to understand why this is the case.&lt;BR /&gt;Do you or anyone else have any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 10:44:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12916498#M4099</guid>
      <dc:creator>revitdeveloper</dc:creator>
      <dc:date>2024-07-24T10:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12917283#M4100</link>
      <description>&lt;P&gt;That's seems a really random fix, does not make sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try to replace the &lt;STRONG&gt;ExternalEvent&amp;nbsp;&lt;/STRONG&gt;and make your code less static and make the code less entangled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this code with &lt;A href="https://gist.github.com/ricaun/7c7fcabb4cb320f9e69a3917e8e24d90" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;AsyncExternalEventHandler&lt;/STRONG&gt;&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public partial class IFCToRevitWPF
{
    private readonly UIApplication UiApp;
    private readonly AsyncExternalEventHandler IFCToRevitGetPipeTypesExternalEvent;
    public IFCToRevitWPF(UIApplication uiAppMK)
    {
        this.UiApp = uiAppMK;
        this.IFCToRevitGetPipeTypesExternalEvent = new AsyncExternalEventHandler(ExecuteIFCToRevitGetPipeTypes);

        InitializeComponent();
    }

    private void ExecuteIFCToRevitGetPipeTypes(UIApplication uiapp)
    {
        Document document = uiapp.ActiveUIDocument.Document;
        SelectPipeType_ComboBox.ItemsSource = RevitFilters.GetAllPipeTypesNames(document);
        SelectDuctType_ComboBox.ItemsSource = RevitFilters.GetAllDuctTypesNames(document);
        SelectSystemType_ComboBox.ItemsSource = RevitFilters.GetAllSystemTypes(document);
    }

    private async void RaiseExternalEventAsync()
    {
        await IFCToRevitGetPipeTypesExternalEvent.RaiseAsync();
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can find the code &lt;A href="https://gist.github.com/ricaun/7c7fcabb4cb320f9e69a3917e8e24d90#file-asyncexternaleventhandler-cs" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;AsyncExternalEventHandler.cs &lt;/STRONG&gt;&lt;/A&gt;here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know why your code works and the other approach does not, probably you are doing something strange with &lt;STRONG&gt;ExternalEvent&lt;/STRONG&gt; and Revit just ignore or something...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 14:41:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12917283#M4100</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2024-07-24T14:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Revit Add-in with WPF fails on some PCs, works perfectly on others</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12919788#M4101</link>
      <description>&lt;P&gt;Thank you again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your detailed example is much appreciated. I attemted to quickly implement your solution, but it became clear that I need more time to do so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Additionally, another test was conducted: &lt;/U&gt;&lt;/P&gt;&lt;P&gt;the "RevitFilters" class, which is located in another vs project, was moved to the same vs project as the command.&lt;/P&gt;&lt;P&gt;The code now works as expected when implementing:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;SystemTypes = RevitFilters.GetAllSystemTypesNames(doc);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason for this issue remains unclear when using multiple VS projects.&lt;/P&gt;&lt;P&gt;It may be related to certain references or the asynchronous operations involved.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 15:16:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-add-in-with-wpf-fails-on-some-pcs-works-perfectly-on/m-p/12919788#M4101</guid>
      <dc:creator>revitdeveloper</dc:creator>
      <dc:date>2024-07-25T15:16:40Z</dc:date>
    </item>
  </channel>
</rss>

