System.AccessViolationException
mkaec opened this issue · comments
Sometimes calling DirectoryObjectPickerDialog.ShowDialog() will cause a System.AccessViolationException. Usually, this can be replicated by multiple calls in the same session. Use of the object is wrapped in a using statement. Today, I had the application in the VS debugger and it downloaded a source code file to show me where the exception occurred.
I notice that my code is different from the example in that it uses AttributesToFetch.
directoryObjectPicker.AttributesToFetch.Add("displayName");
directoryObjectPicker.AttributesToFetch.Add("sAMAccountName");
directoryObjectPicker.AttributesToFetch.Add("objectSid");
directoryObjectPicker.AttributesToFetch.Add("objectGUID");
I had changed the code to remove use of AttributesToFetch, but it seems the crash is still randomly occurring.