Version 23321 of System.Diagnostics.TraceSource is missing DNXCore50 folder
We have a project that references System.Diagnostics.TraceSource 4.0.0-beta-* and specifies dnxcore50. On Monday, 2015-09-21 a "restore" operation brought System.Diagnostics.TraceSource 4.0.0-beta-23321 down to my system. But the Lib folder is missing the DNXCore50 folder. So when my project tries to load that assembly, it is failing because it can't find it.
Does System.Diagnostics.TraceSource no longer support dnxcore50? In other words, is this by design? Or is there a problem with 23321?
I should also mention that when I modified our project.json file to specifically reference 4.0.0-beta-23318 (the previous version), everything works fine.
cc @ericstj @chcosta
This is a result of us doing some refactoring of our packages to support x-plat. I believe if you specify the "win7" in your runtime sections it should be able to correctly resolve this. Have a look at the "runtime.win7.System.Diagnostics.TraceSource" package which is where the library exists. We did move it from dnxcore50 to dotnet directory under the runtimes\win7\lib\dotnet.
I think this problem goes beyond just the missing DLL.
We have an xunit test suite that uses System.Diagnostics.TraceSource. When executing with the "clr" runtime, either beta6 or beta7, everything works. When executing with the "coreclr" runtime, the tests time out, which means that the trace events were either not sent or not received. If we target build 23318 or earlier, both clr and coreclr work.
If it is missing a dll how did you run the tests?
I don't see any code changes to the library recently so I wonder if there isn't something else going on that is causing the timeout.
This is fallout from the x-plat work that is going on. Many of the packages are being refactored into OS specific runtime packages. This means the runtime assets (implementation assemblies) are removed from the reference package and placed in a runtime-specific package. In order to get the correct runtime package for your platform you need to make sure that you have a runtime specified in your project.json and when building you need to make sure you build for that runtime.
@ericstj I have to plead ignorance here. I have no idea what you mean by specifying a runtime in a project.json. Do you mean global.json? Can you provide an example? And why win7? Does that mean windows 7 or beta7 on windows?
See https://github.com/dotnet/buildtools/blob/master/src/Microsoft.DotNet.Build.Tasks/Targets/tool-runtime/project.json#L13 as an example. You need a runtime section that defines the runtimes you want to run on. win7 in this case means windows 7 or higher.
Unfortunately that doesn't seem to make a difference. I think there are two separate issues here. The first is what Jim pointed out. In VS when it goes to discover the tests we get the following errors:
------ Discover test started ------
------ Test started: Project: Samples ------
Starting Microsoft.DNX.TestHost [C:\Users\dmetzgar\.dnx\runtimes\dnx-coreclr-win-x64.1.0.0-beta7\bin\dnx.exe --appbase "C:\dev\wf\tests\Samples" Microsoft.DNX.ApplicationHost --port 40400 Microsoft.DNX.TestHost --port 40496]
Connected to Microsoft.Framework.TestHost
Discovering tests in 'C:\dev\wf\tests\Samples\project.json'
------ Test started: Project: TestCases.Activities ------
Starting Microsoft.DNX.TestHost [C:\Users\dmetzgar\.dnx\runtimes\dnx-coreclr-win-x64.1.0.0-beta7\bin\dnx.exe --appbase "C:\dev\wf\tests\TestCases.Activities" Microsoft.DNX.ApplicationHost --port 40400 Microsoft.DNX.TestHost --port 40502]
System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.TraceSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Diagnostics.TraceSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileNotFoundException: Could not load the specified file.
File name: 'System.Diagnostics.TraceSource'
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at Microsoft.Dnx.TestHost.Program.<>c__DisplayClass2_0.<<Main>b__0>d.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.Dnx.TestHost.Program.<>c__DisplayClass2_0.<Main>b__0()
at Microsoft.Dnx.Runtime.Common.CommandLine.CommandLineApplication.<>c__DisplayClass68_0.<OnExecute>b__0()
at Microsoft.Dnx.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
at Microsoft.Dnx.ApplicationHost.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, FrameworkName targetFramework)
at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework)
at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)
System.IO.FileNotFoundException: Could not load the specified file.
File name: 'System.Diagnostics.TraceSource'
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
Unable to start Microsoft.DNX.TestHost
========== Discover test finished: 0 found (0:00:10.2030012) ==========
Maybe this is a Microsoft.DNX.TestHost issue?
The other problem is when you go from the command line and just execute the xunit tests with dnx. When I have dnvm use a clr runtime it works, but with a coreclr runtime it does not. There are no exception messages. If we change to an earlier version of the System.Diagnostics.TraceSource package it works with both clr and coreclr.
Our test scenario is a bit complex so I'll attempt to create a simpler repro of the second issue.
You need to specify a runtime and deploy for that runtime. If you're missing an asset from a package it usually means you aren't resolving the right asset from nuget. You can examine the list of assets in the project.lock.json. Specifically, look for the System.Diagnostics.TraceSource section under the target you are deploying for your tests.
@jimcarley Let me know if the issue is still unresolved. I believe this was just a case of a project being restored without a runtime and noticed when we moved our implementations to runtime-specific (eg: windows) packages.
@ericstj All is good. Thanks.
I am experiencing an issue with System.Diagnostics.TraceSource.dll missing. Running Win7 using VS2015 Pro.
I downloaded the beta Core-4.0.0-alpha001 Castle.Core source and compiled.
at Castle.Core.Logging.TraceLogger..cctor() --- End of inner exception stack trace --- at Castle.Core.Logging.TraceLogger..ctor(String name, LoggerLevel level) at Castle.DynamicProxy.ProxyGenerator..ctor(IProxyBuilder builder) at Castle.DynamicProxy.ProxyGenerator..ctor() at Kofax.Carbon.CarbonFactory.<>c.<.cctor>b__4_0() in C:\Workspaces\Atalasoft\Internal Systems\Boarman\Kofax.Carbon\Kofax.Carbon\CarbonFactory.cs:line 10 at System.Lazy
1.CreateValue() at System.Lazy1.LazyInitValue() at System.Lazy`1.get_Value() at Kofax.Carbon.CarbonFactory.get_ProxyEngine() in C:\Workspaces\Atalasoft\Internal Systems\Boarman\Kofax.Carbon\Kofax.Carbon\CarbonFactory.cs:line 15 at Kofax.Carbon.CarbonFactory.CreateObservableProxy[TObservable](IInterceptor Interceptor) in C:\Workspaces\Atalasoft\Internal Systems\Boarman\Kofax.Carbon\Kofax.Carbon\CarbonFactory.cs:line 19 at Kofax.Carbon.Mutator.MakeObservableTObservable in C:\Workspaces\Atalasoft\Internal Systems\Boarman\Kofax.Carbon\Kofax.Carbon\Mutator.cs:line 33 at Kofax.Carbon.UnitTests.CarbonProxyTests.IsObservableTrue() in C:\Workspaces\Atalasoft\Internal Systems\Boarman\Kofax.Carbon\Kofax.Carbon.UnitTests\CarbonProxyTests.cs:line 25 Result Message:
Test method Kofax.Carbon.UnitTests.CarbonProxyTests.IsObservableTrue threw exception: System.TypeInitializationException: The type initializer for 'Castle.Core.Logging.TraceLogger' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.TraceSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value HKLM\Software\Microsoft\Fusion!EnableLog to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].