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

  • SEARCH
  • Home
  • 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 8707811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:57:37+00:00 2026-06-13T03:57:37+00:00

The following expression is occasionally throwing the below exception: NetworkInterface[] interfacesToUse = (from outer

  • 0

The following expression is occasionally throwing the below exception:

NetworkInterface[] interfacesToUse = (from outer in NetworkInterface.GetAllNetworkInterfaces()
                                                  select outer).ToArray();

IPv4InterfaceStatistics[] stats = (from current in interfacesToUse select current.GetIPv4Statistics()).ToArray();

Base Exception Type:
System.Net.NetworkInformation.NetworkInformationException
(0x80004005): The system cannot find the file specified at
System.Net.NetworkInformation.SystemIPv4InterfaceStatistics.GetIfEntry(Int64
index) at
System.Net.NetworkInformation.SystemNetworkInterface.GetIPv4Statistics()
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at
System.Linq.Buffer
1..ctor(IEnumerable1 source) at
System.Linq.Enumerable.ToArray[TSource](IEnumerable
1 source)

Stack Trace: at
System.Net.NetworkInformation.SystemIPv4InterfaceStatistics.GetIfEntry(Int64
index) at
System.Net.NetworkInformation.SystemNetworkInterface.GetIPv4Statistics()
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at
System.Linq.Buffer
1..ctor(IEnumerable1 source) at
System.Linq.Enumerable.ToArray[TSource](IEnumerable
1 source)

I have been unable to locate any documentation that may provide some insight into this error.

  • 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-13T03:57:38+00:00Added an answer on June 13, 2026 at 3:57 am

    occasionally

    I wonder why it occasionally happens. Do you use the code as shown? The method SystemIPv4InterfaceStatistics.GetIfEntry(Int64 index), which is from .NET 3.5, calls the GetIfEntry function in Iphlpapi.dll. Starting with .NET 4, the function GetIfEntry2 is called. According to your stack trace, I assume you’re using .NET 3.5.

    Error 2, which is translated to “The system cannot find the file specified” (but it really is just ERROR_NOT_FOUND) is returned when an unknown index is passed into GetIfEntry().

    This should not happen in .NET, since NetworkInterface.GetAllNetworkInterfaces() should only return network interfaces already known to the system, so all their (private) index properties should be set to an index known to the system.


    Edit: reproduced the error, using this code:

    var interfaces = NetworkInterface.GetAllNetworkInterfaces();
    
    while (true)
    {
    
        foreach (var i in interfaces)
        {
            var s = i.GetIPv4Statistics();
    
            Console.WriteLine("Received: {0}, Sent: {1}", s.BytesReceived, s.BytesSent);
        }                
    }
    

    When I start a VPN connection I have an extra interface which will be printed. The second I disable this connection, the GetIPv4Statistics() on that interface will throw the exception you mention.

    I guess it depends on what you’re doing on the machine this code runs on. I think you’ll have to call NetworkInterface.GetAllNetworkInterfaces() every time you want to get the interface data.

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

Sidebar

Related Questions

Consider the following expression: from p in db.People select new Person { Name =
I am using the following Expression to select all hyperlinks //a[@href] How can I
How do i Evaluate the following expression from a string to a answer as
I have the following expression List<string> Images = Regex.Matches(html, @(?<=/PI/).*(?=/500/)).Cast<Match>().Select(m => m.Value).ToList(); It is
I have the following expression to strip HTML tags away from data retrieved. How
I'm using the following expression: /^[alopinme]{5}$/ This regexp take me words from a set
I use the following expression to select all the links in this path: $J('#leftmenu
I have the following expression var q = from c in D1 join dp
Following on from this question I asked yesterday: Can I shorten this regular expression?
What does the following expression in a .ps1(powershell script) file mean? $row=.+\\(.+\.exe); From what

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.