aspnet / Mvc

[Archived] ASP.NET Core MVC is a model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
5.62k stars 2.14k forks source link

NuGet reference to System.Net.Http causes telemetry to fail in default project template #8637

Closed GSPP closed 6 years ago

GSPP commented 6 years ago

On .NET 4.7.2, VS 15.8.7, Windows 7 there exists an issue which prevents a simple application from running:

  1. Create new MVC web app.
  2. Add library project and reference it.
  3. Add System.Net.Http NuGet package to both projects.
  4. Update all NuGet packages.

That's the entire setup. Now press F5. The application fails with this error:

Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

[FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.]
   Microsoft.AspNet.TelemetryCorrelation.ActivityExtensions.Extract(Activity activity, NameValueCollection requestHeaders) +0
   Microsoft.AspNet.TelemetryCorrelation.ActivityHelper.CreateRootActivity(HttpContext context) +156
   Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule.Application_BeginRequest(Object sender, EventArgs e) +93
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +200
   System.Web.<>c__DisplayClass285_0.<ExecuteStepImpl>b__0() +24
   System.Web.StepInvoker.Invoke(Action executionStep) +100
   System.Web.<>c__DisplayClass4_0.<Invoke>b__0() +17
   Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule.OnExecuteRequestStep(HttpContextBase context, Action step) +64
   System.Web.<>c__DisplayClass284_0.<OnExecuteRequestStep>b__0(Action nextStepAction) +55
   System.Web.StepInvoker.Invoke(Action executionStep) +84
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +100
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +73

Note that due to this related bug you might need to delete all bin/obj folders to be able to see this bug and not the other bug.

Eilon commented 6 years ago

This issue was moved to aspnet/Microsoft.AspNet.TelemetryCorrelation#44