Closed rootchord closed 8 years ago
What is the detail of the exception? Usually that tells you exactly why it occurred.
Here is the detail:
System.AccessViolationException was unhandled HResult=-2147467261 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source=FRAC StackTrace: at Pri.LongPath.NativeMethods.GetSecurityDescriptorLength(IntPtr byteArray) at Pri.LongPath.Directory.GetAccessControl(String path, AccessControlSections includeSections) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\LongPath\Directory.cs:line 914 at Pri.LongPath.Directory.GetAccessControl(String path) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\LongPath\Directory.cs:line 868 at Pri.LongPath.DirectoryInfo.GetAccessControl() in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\LongPath\DirectoryInfo.cs:line 208 at FRAC.FRACMainForm.CheckAccess(DirectoryInfo directory) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 156 at FRAC.FRACMainForm.ProcessFolder(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 68 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 131 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.ProcessFolderRecursively(DirectoryInfo root) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 141 at FRAC.FRACMainForm.StartButton_Click(Object sender, EventArgs e) in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Form1.cs:line 217 at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at FRAC.Program.Main() in REDACTED\Documents\Visual Studio 2010\Projects\FRAC\FRAC\Program.cs:line 18 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
Sorry, accidentally closed it.
Any Ideas?
Still having the same issue, any guidance?
Unfortunately I'm unable to reproduce this so it's hard to do the right thing when it happens. Is there any other detail you can provide, like type of file system being accessed (local, share, soft-link, etc.)? Is it within a domain (security policies that get pushed, etc.). What type of security is on the directories being scanned?
Well upon further investigation it looks like it's related to the issue with UNC paths. The error happens as soon as the UNC path exceeds 250 characters. If this sounds right, i'll close this issue.
I'm seeing the same behavior and I'm fairly certain it only happens when the UNC path exceeds 250 characters. Is there a good way around this or a fix?
Edit: I should say I get the same error message on File.GetAccessRule(\\server\share)
Please try latest code with UNC and reparse point support. I cannot reproduce this with the latest build.
I wrote a simple program that reads folder permissions recursively for a large network share. Everything goes fine until it gets to a certain point then it throws an AccessViolationException pointing to this line:
var length = NativeMethods.GetSecurityDescriptorLength(byteArray);
Any Ideas?