Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:29:44+00:00 2026-06-05T15:29:44+00:00

I am running a very simple program, which is trying to list files in

  • 0

I am running a very simple program, which is trying to list files in a folder on the same machine, which is specified using UNC format(as described in http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx):


static string rootDir = @"\\?\d:\share\input";

static void Main(string[] args) { char[] invlidChars = Path.GetInvalidPathChars(); foreach (char invChar in invlidChars) { if (rootDir.Contains(invChar.ToString())) { Console.WriteLine("InvChar - {0}", invChar); } } string[] matchFiles = Directory.GetFiles(rootDir); }

However the Directory.GetFiles() does not work and throws an ArgumentException(which is thrown when – path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.). The Console.Writeline() does not print anything, which confirms that there are no invalid chars in the path. I get the same exception when I use
“\\UNC\?\d:\share\input” or
“\\UNC\?\machinename\share\input” or
“\\?\machinename\share\input”.

The “d:\share\input” is indeed a shared folder.

Does anybody know what could be wrong?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:29:45+00:00Added an answer on June 5, 2026 at 3:29 pm

    The problem is that \\?\ is a windows API convention that is not supported by .NET. If you read carefully in your link \\?\ does not denote a UNC path, but is a special convention for windows API:

    For file I/O, the “\\?\” prefix to a path string tells the Windows
    APIs to disable all string parsing and to send the string that follows
    it straight to the file system.

    A .NET compatible UNC format would be \\machinename\d$\share\input. See this answer for more info.

    The reason it is not supported by .NET is most likely that the extended path convention is not available on all platforms and therefore cannot be guaranteed to work by the framework.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running a very simple C++ program: #include <list> #include <vector> int main(int
I’m trying to compile a very simple Hello world OpenGL 3.3 program using FreeGLUT.
I have a very simple test program, running on Solaris 5.8: #include <stdio.h> #include
I have a FindFile routine in my program which will list files, but if
I'm trying out a very simple Java program that uses Scanner and its method
I'm running into some trouble with the copy_file function. My program is very simple,
I wrote a very simple program named test.py which looks like this: print 'hello
I have a very simple WCF service running that has a single method that
I'm trying to speed up my code because it's running very long. I already
I'm running a very basic fetch request that returns about 2000 objects. I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.