Standard: Could not load file or assembly 'System, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

Created on 16 Aug 2017  路  13Comments  路  Source: dotnet/standard

Hello:

I'm getting the follows error after upgrade EFCore 2.0 and .NetStandard 2.0 in my Visual Studio 2017 v15.3 solution and .NetFrwk 4.6.2. What I'm missing?

By reflection I'm trying to load the app's modules and in runtime at the time to add netandard 2.0 to the AppDomain is trying to resolve "System, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", Why?

Thank you in advance

FATAL: Could not load file or assembly 'System, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
Stack tarce: at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at Apollo.Desktop.DatabaseModuleCatalog.InnerModuleInfoLoader.<>c__DisplayClass1_0.b__5(FileInfo file) in C:\Workspaces\Apollo_TFS_2015\Visual Studio 2017\Apollo ERP\Src\Wpf\Apollo.Desktop\DatabaseModuleCatalog.cs:line 173
at System.Linq.Enumerable.d__162.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at Apollo.Desktop.DatabaseModuleCatalog.InnerModuleInfoLoader.GetModuleInfos() in C:\Workspaces\Apollo_TFS_2015\Visual Studio 2017\Apollo ERP\Src\Wpf\Apollo.Desktop\DatabaseModuleCatalog.cs:line 117
at Apollo.Desktop.DatabaseModuleCatalog.InnerLoad() in C:\Workspaces\Apollo_TFS_2015\Visual Studio 2017\Apollo ERP\Src\Wpf\Apollo.Desktop\DatabaseModuleCatalog.cs:line 56

All 13 comments

@yarmenteros are you running on .NET Framework 4.6.2? What is the code you are using to load the assembly? Also do you know what is referencing System version 0.0.0.0? Is it netstandard.dll?

Thank you for your time.

Yes, is netstandard.dll who is referencing System version 0.0.0.0
image

thank you @danmosemsft

Fusion Logs:
FusionLogs.txt

Also in Fusion Log output is showing issues with the load with the follows assemblies:

  • System.Transactions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  • System.ValueTuple, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
  • System.Data, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  • System, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  • System.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

@weshaggard should this work (unify and find in GAC)?

LOG: DisplayName = System, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
 (Fully-specified)
LOG: Appbase = file:///C:/Workspaces/Apollo_TFS_2015/Visual Studio 2017/ApolloERP/Src/Wpf/Apollo.Desktop/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = Apollo.Desktop.exe
Calling assembly : (Unknown).
===
LOG: This is an inspection only bind.
LOG: Using application configuration file: C:\Workspaces\Apollo_TFS_2015\Visual Studio 2017\ApolloERP\Src\Wpf\Apollo.Desktop\bin\Debug\Apollo.Desktop.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: GAC Lookup was unsuccessful.

@yarmenteros what is in Apollo.Desktop.exe.Config?

@danmosemsft This is my app config file:
Apollo.Desktop.exe.config.txt

Hmm, I don't see a binding redirect for System. @weshaggard should I expect to see one? (I would think not)
I see eg

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Data.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
      </dependentAssembly>
    </assemblyBinding>

@danmosemsft All binding redirect are in the generated app config, none in the project app.config file.
If I add the binding redirect for System it should works? What version of System is the correct for binding redirect?

Thank you

@yarmenteros based on your screenshot it appears as though you are loading this assembly via ReflectionOnlyLoad APIs in which case you have to subscribe to the ReflectionOnlyAssemblyResolve (https://msdn.microsoft.com/en-us/library/system.appdomain.reflectiononlyassemblyresolve(v=vs.110).aspx) event and unify the versions manually.

You can call ApplyPolicy https://msdn.microsoft.com/en-us/library/system.appdomain.applypolicy(v=vs.110).aspx on the assembly identity to get a version that the regular assembly load would unify to.

Thank you so much, calling ApplyPolicy for the Current AppDomian fixed the issue. _args.Name_ is "System, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and after applied the Policy is "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",

Assembly.ReflectionOnlyLoad(AppDomain.CurrentDomain.ApplyPolicy(args.Name));

Thank you both @weshaggard and @danmosemsft

@yarmenteros glad that's fixed. I'll close please reopen if not fully resolved

I'm seeing this error in Azure Functions (4.6.1), referencing a .NET Standard class library. It fails when an EFCore operation takes place. I'm not using tuples/valuetuples in my code.

Was this page helpful?
0 / 5 - 0 ratings