Unable to login to Vault 2025 with .net 8 Console App

Unable to login to Vault 2025 with .net 8 Console App

mfoster9TD82
Advocate Advocate
342 Views
2 Replies
Message 1 of 3

Unable to login to Vault 2025 with .net 8 Console App

mfoster9TD82
Advocate
Advocate

Hello, 
I'm in the process of converting my Vault apps to .net 8 but I've run into this exception and haven't been able to find anything about it.
When trying to login with the dialog box in a console app with:

Autodesk.DataManagement.Client.Framework.Vault.Forms.Library.Login(...)

I keep getting this exception thrown:

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at DynamicClass.__get_handle(System.Drawing.Icon)
   at DevExpress.Utils.Helpers.IconGuard.IsDisposedOrInvalid(System.Drawing.Icon)
   at DevExpress.XtraEditors.FormIconOptions+FormIconHelper.GetIconHandleSafely(System.Drawing.Icon)
   at DevExpress.XtraEditors.FormIconOptions.CheckUpdateIcon()
   at DevExpress.XtraEditors.FormIconOptions.get_Icon()
   at DevExpress.XtraEditors.FormIconOptions.get_UseIconImage()
   at DevExpress.XtraEditors.FormIconOptions.UpdateIcon(Boolean)
   at DevExpress.XtraEditors.FormIconOptions.InitializeIcon(Boolean)
   at DevExpress.XtraEditors.FormIconOptions..ctor(DevExpress.XtraEditors.IFormIconOptionsOwner, Boolean)
   at DevExpress.XtraEditors.FormIconOptions..ctor(DevExpress.XtraEditors.IFormIconOptionsOwner)
   at DevExpress.XtraEditors.XtraForm.CreateIconOptions()
   at DevExpress.XtraEditors.XtraForm..ctor()
   at Autodesk.DataManagement.Client.Framework.Forms.SkinUtils.ThemedXtraForm..ctor()
   at Autodesk.DataManagement.Client.Framework.Vault.Forms.Dialogs.LoginDialog..ctor(Autodesk.DataManagement.Client.Framework.Vault.Forms.ViewModels.LoginViewModel)
   at Autodesk.DataManagement.Client.Framework.Vault.Forms.Library.Login2(Autodesk.DataManagement.Client.Framework.Vault.Forms.Settings.LoginSettings)
   at Autodesk.DataManagement.Client.Framework.Vault.Forms.Library.Login(Autodesk.DataManagement.Client.Framework.Vault.Forms.Settings.LoginSettings)
   at ConsoleApp1.Program.GetVaultConnection()
   at ConsoleApp1.Program.Main(System.String[])


I've added all the requirements mentioned in this post and I've added the System.Drawing.Common package, and still nothing.

It works just fine in a WPF and WinForms, just not console app.

Is there a way to login to vault with the dialog box with a console app, or do I need to use a different method? I need to use windows Authentication to login to vault, and the dialog box has been the easiest way of doing that.

0 Likes
Accepted solutions (1)
343 Views
2 Replies
Replies (2)
Message 2 of 3

Markus.Koechl
Autodesk
Autodesk
Accepted solution

Did you compare the .NET 8 login samples posted with this Blog?

You may try to leverage this code for the console application: 

            mServerId.DataServer = this.txtServer.Text;
            mServerId.FileServer = this.txtServer.Text;
            mUserName = this.txtUserName.Text;
            mPassword = this.txtPassword.Text;
            mVaultName = this.txtVaultName.Text;
            ACW.LicensingAgent mLicAgent = ACW.LicensingAgent.Client; //Client | Server | None
            ACWTools.WebServiceManager? mVault = null;

            ACWTools.WinAuthCredentials winAuthCredentials = new ACWTools.WinAuthCredentials(mServerId, mVaultName, null, mLicAgent);

            try
            {
                mVault = new ACWTools.WebServiceManager(winAuthCredentials);
            }
            catch (Exception)
            {
                mUserFeedback(null);
                return;
            }

            // get connection
            conn = new Vault.Currency.Connections.Connection(mVault, mVaultName, mVault.SecurityService.Session.User.Id,
                mServerId.DataServer, Vault.Currency.Connections.AuthenticationFlags.Standard);

 



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes
Message 3 of 3

mfoster9TD82
Advocate
Advocate

Great, that worked. Thanks!

0 Likes