Possible Bug, Extension executes the OnLogOn and OnLogOff hundreds of times
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good Morning,
I already wrote in the Recycle Bin threat something, I see as a bug in the system. I created my Vault Extension based on the example provided in the SDK.
So far, I had no problem, but yesterday we found a problem with our Recycle Bin implementation and needed to load the Groups the currently logged in User is member of.
But he has no ACL´s for "User Read" and "Admin Read". In the SDK documentation under Knowledge Base -> User Impersonation is a workaround we had to use in the end. So my OnLogOn Method was extended:
Autodesk.DataManagement.Client.Framework.Vault.Results.LogInResult results
= Autodesk.DataManagement.Client.Framework.Vault.Library.ConnectionManager.LogIn(
application.Connection.Server,
application.Connection.Vault,
"ExtensionAdmin",
"929njcicui294e", // Not the real username or password ;-)
AuthenticationFlags.ServerLicense,
null
);
if (results != null && results.Success) {
try {
var adminConnection = results.Connection.WebServiceManager;
// Next Bug, Roles and Groups are empty
boot.UserInfo = adminConnection.AdminService.GetUserInfoByUserId(application.Connection.UserID);
var allGroups = adminConnection.AdminService.GetAllGroups().ToList();
var tempGroupMemberships = new List<Autodesk.Connectivity.WebServices.Group>();
allGroups.ForEach(group => {
var members4Groups = adminConnection.AdminService.GetMemberUsersByGroupId(group.Id);
if (members4Groups != null && members4Groups
.ToList()
.Where(user => user.Name.Equals(boot.UserInfo.User.Name))
.FirstOrDefault() != null) {
tempGroupMemberships.Add(group);
}
});
boot.UserInfo.Groups = tempGroupMemberships.ToArray();
} finally {
Autodesk.DataManagement.Client.Framework.Vault.Library.ConnectionManager.LogOut(results.Connection);
}
}
Now the real hell in the Client began with NullPointer Exceptions and MessageBoxes (the OnLogOff Method is called when I LogOut from the Admin Connection)
The methods were called hundreds of times, my Screen exploded with Messageboxes from the OnLogOff Method and I had to kill Vault. Debugging it, I saw that the Method was called over and over again when the Client started up.
That shouldn´t be the case in my opinion, it should be loaded only once. We also use Vault DataStandard Customizations outside of the C# project.
When I remove the MessageBox from the Vault.Custom -> Default.ps1 -> OnLogOff method, it works again normaly.
Vault shouldn´t call the OnLogOff Methods when the Adminsession is terminated, that is a bit a sour taste in design.
Maybe somebody has an Idea how to solve such problems for a more stable system.
Best Regards
Thomas