DirectoryCatalog fails to create the catalog if the path is network based.

Oct 13, 2009 at 10:36 PM

The DirectoryCatalog constructor that takes a path fails when the path is on a network. I have tried both ways \\machinename\sharename\.... and also a drive allocation on machine such as z:\ is \\machinename\sharename. I am trying to debug my code from my PC running VS2008 on my PC and trying to debug my bits on an instrument, (remote debugging through msvcmon). In my VS2008 i set the debug settings to point to my share folder that contains the bits. The following is the exception i get.

System.IO.DirectoryNotFoundException was caught
  Message="Could not find a part of the path 'Z:\\BENTO\\DEV\\ATLAS1\\BENTO\\DEV\\ATLAS1\\BENTO\\SIGNALSOLUTION\\BENTO\\MAINAPPLICATION\\BIN\\DEBUG\\APPLICATIONS\\DIGITALVIDEOFEATURE'."
  Source="mscorlib"
  StackTrace:
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption)
       at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
       at System.IO.Directory.GetFiles(String path, String searchPattern)
       at System.ComponentModel.Composition.Hosting.DirectoryCatalog.GetFiles() in D:\Src\Mef\MEF_PreBeta_2\src\ComponentModel\System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs:line 467
       at System.ComponentModel.Composition.Hosting.DirectoryCatalog.Initialize(String path, String searchPattern) in D:\Src\Mef\MEF_PreBeta_2\src\ComponentModel\System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs:line 489
       at System.ComponentModel.Composition.Hosting.DirectoryCatalog..ctor(String path, String searchPattern) in D:\Src\Mef\MEF_PreBeta_2\src\ComponentModel\System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs:line 104
       at System.ComponentModel.Composition.Hosting.DirectoryCatalog..ctor(String path) in D:\Src\Mef\MEF_PreBeta_2\src\ComponentModel\System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs:line 64

 

the path is a valid path, and the Z:\ network drive is a valid location.

Is this supposed to work?

Oct 15, 2009 at 11:35 PM

Hi there,

I can't really pinpoint why this would fail - we're not doing anything fancy regarding paths, so yes this should work. Could you check this troubleshooting article?

http://msdn.microsoft.com/en-us/library/53fkz89b.aspx

 

Thanks

Oct 15, 2009 at 11:40 PM
It could have something to do with CAS permissions.
I know that accessing assemblies on network shares is problematic without the proper credentials.
Just a thought.
On Thu, Oct 15, 2009 at 6:35 PM, haveriss <notifications@codeplex.com> wrote:

From: haveriss

Hi there,

I can't really pinpoint why this would fail - we're not doing anything fancy regarding paths, so yes this should work. Could you check this troubleshooting article?

http://msdn.microsoft.com/en-us/library/53fkz89b.aspx

 

Thanks

Read the full discussion online.

To add a post to this discussion, reply to this email (MEF@discussions.codeplex.com)

To start a new discussion for this project, email MEF@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Oct 16, 2009 at 1:34 AM

Hi Nadendla

Is it absolutely necessary that you access the files on a network share? In general we recommend that folks that need to access network files copy those down to a local cache rather than access of the network. This way you avoid any file locks which would prevent the network files from being update. Also depending on the version of .NET you are running, there are CAS issues when accessing remote files. Do you have .NET 3.5 or .NET 3.5 SP1?

I believe in .NET 3.5 SP1 that based on user feedback, we actually opened that up to work as is detailed in this post: http://blogs.msdn.com/brada/archive/2008/08/13/net-framework-3-5-sp1-allows-managed-code-to-be-launched-from-a-network-share.aspx

Thanks

Glenn

Oct 16, 2009 at 9:59 PM

Thanks for your replies everybody. I did track the exception down to the call

Directory.GetFiles()... in DirectoryCatalog. I am not sure why it fails there.

I modified my code to not use the DirectoryCatalog, and do my own directory traversal and searching to find the assemblies again using the same API

directory.GetFiles() and then create the AssemblyCatalog's from the list of files i found. Interestingly when i run it with this change it is happy and no exceptions. I will look into the links you sent and see if i can find more.

 

Thanks again.

Rama.

Oct 19, 2009 at 4:44 PM

Was the path correct? It looks like you've duplicated a portion of it: 'Z:\\BENTO\\DEV\\ATLAS1\\BENTO\\DEV\\ATLAS1\\BENTO\\SIGNALSOLUTION\\BENTO\\MAINAPPLICATION\\BIN\\DEBUG\\APPLICATIONS\\DIGITALVIDEOFEATURE'