Docs: Error when running this example - .NET Core 3.1 console applications

Created on 23 Oct 2019  Â·  6Comments  Â·  Source: dotnet/docs

  1. Start named pipe server.
  2. Start named pipe client without args.

Console output client process:

*** Named pipe client stream with impersonation example ***

Spawning client processes...


Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Unhandled Exception:Unhandled Exception: Unhandled Exception:  System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Area - .NET Guide P1 doc-bug

Most helpful comment

@Legends Thanks for closing the issue, but I'm going to reopen it to put it on our backlog as a reminder to update the doc.

All 6 comments

Installing System.Runtime v.4.3.1.0 and adding this app.config to my client project also didn't help:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
      </dependentAssembly>      
    </assemblyBinding>
  </runtime>
</configuration>

@JeremyKuhne, @carlossanlop Can you advise how to run this example?

The code needs updated. Environment.CommandLine returns the name of the dll on .NET Core. This can be done by adding the following line in the client after getting the command line:

C# currentProcessName = Path.ChangeExtension(currentProcessName, ".exe");

https://github.com/dotnet/coreclr/issues/20562 and https://github.com/dotnet/corefx/issues/29014 discuss this behavior.

cc: @jkotas

@Legends Thanks for closing the issue, but I'm going to reopen it to put it on our backlog as a reminder to update the doc.

Hi @tdykstra

I think the code needs to be changed here.
Can I proceed with making the changes?

@SumanjaliDamarla Yes, please do, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gmatv picture gmatv  Â·  3Comments

svick picture svick  Â·  3Comments

LJ9999 picture LJ9999  Â·  3Comments

skylerberg picture skylerberg  Â·  3Comments

ite-klass picture ite-klass  Â·  3Comments