Skip to content

Commit

Permalink
Fix crash/freeze on systems with no AdskIdentityManager or any adsk p…
Browse files Browse the repository at this point in the history
…roduct (DynamoDS#15042)

* Update IDSDKManager.cs

* Update IDSDKManager.cs

* add logs
  • Loading branch information
zeusongit authored Mar 22, 2024
1 parent 97e2d46 commit ea1238e
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/DynamoCore/Core/IDSDKManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using Autodesk.IDSDK;
using Dynamo.Configuration;
using DynamoServices;
using Greg;
using Greg.AuthProviders;
using RestSharp;
Expand Down Expand Up @@ -213,14 +214,14 @@ private string IDSDK_GetToken()

private bool Initialize()
{
if (Client.IsInitialized()) return true;
idsdk_status_code bRet = Client.Init();

if (Client.IsSuccess(bRet))
try
{
if (Client.IsInitialized())
if (Client.IsInitialized()) return true;
idsdk_status_code bRet = Client.Init();

if (Client.IsSuccess(bRet))
{
try
if (Client.IsInitialized())
{
IntPtr hWnd = Process.GetCurrentProcess().MainWindowHandle;
if (hWnd != null)
Expand All @@ -238,13 +239,15 @@ private bool Initialize()
return ret;
}
}
catch (Exception)
{
return false;
}
}
DynamoConsoleLogger.OnLogMessageToDynamoConsole("Auth Service (IDSDK) could not be initialized!");
return false;
}
catch (Exception)
{
DynamoConsoleLogger.OnLogMessageToDynamoConsole("An error occurred while initializing Auth Service (IDSDK).");
return false;
}
return false;
}
private bool Deinitialize()
{
Expand Down

0 comments on commit ea1238e

Please sign in to comment.