|
Post by holisticdeveloper on Mar 7, 2012 21:02:15 GMT -5
Hi, I've found a case where using Directory.CreateDirectory causes an access violation when my app shuts down. To repro the problem, create a new VB6 Windows app. Add a module with the following code: Option Explicit
Public Sub Main() Dim localDirectory As String localDirectory = "C:\Documents and Settings\Stratagen\Local Settings\Application Data\StrataGen Systems\ADEPT 4 Client\Apps"
VBCorLib.Directory.CreateDirectory localDirectory End Sub Then set Sub Main as the startup object. Given that the directory "C:\Documents and Settings\Stratagen\Local Settings\Application Data\StrataGen Systems\ADEPT 4 Client" already exists and is empty, the app will create the "Apps" subfolder but will throw an access violation when ending. Note, I'm running version 2.3.1 as posted on this thread: killian35.proboards.com/index.cgi?board=Help&action=display&thread=98
|
|
|
Post by Kelly Ethridge on Mar 8, 2012 2:19:34 GMT -5
Are you sure you have permission to create that directory? Can you create it using the same thing in .NET?
|
|
|
Post by holisticdeveloper on Mar 8, 2012 2:44:12 GMT -5
permissions are not a problem -- replacing the CreateDirectory call with MkDir (the native VB/VBA function) works just fine.
|
|
|
Post by Kelly Ethridge on Mar 8, 2012 5:17:35 GMT -5
I get a memory access violation on an XP machine. I don't know why, but if you set the resulting DirectoryInfo to a variable and display the Name property in a MsgBox it doesn't crash. If you create the directory using the DirectoryInfo instead of Directory, it works.
Dim d As DirectoryInfo Set d = Cor.NewDirectoryInfo(localDirectory) d.Create
|
|
|
Post by holisticdeveloper on Mar 8, 2012 13:09:49 GMT -5
It's not urgent for me at the moment; I've put a comment in our code as to why were using MkDir for now. But I thought I would report it so that hopefully you could find a fix at some point. PS - Thanks again for creating this great library!
|
|
|
Post by holisticdeveloper on Mar 21, 2012 17:07:56 GMT -5
I've run into another recurrence of this problem that happens when using almost any method from the "static" Directory, File, or Path objects. I've made as simple of a repro as I can, but I can't get it to cause the crash on another machine. By commenting out various bits of VBCorLib code and compiling a private version of it, it seems to be related to the Path object's use of the mPath StringBuilder. If I can get it to repro on other machines I'll let you know.
|
|