Closed
Description
Installed VS: d15prerel 26426.1-Preview with the following workloads:
- Universal Windows Platform development
- .NET desktop development
- Desktop development with C++
- ASP.NET and web development
- Office/SharePoint development
- Mobile development with JavaScript
- Visual Studio extension development
- Linux development with C++
Note that VS isn't actually used in this repro, I just used it as a vehicle to get the tools.
Repro Steps
- Open a new command window (non-admin).
mkdir Bug
cd Bug
dotnet new sln
md WebApp
cd WebApp
dotnet new mvc --framework netcoreapp2.0
cd ..
md ClassLibrary
cd ClassLibrary
dotnet new classlib --framework netcoreapp2.0
- Edit Class1.cs, add the following to the class, and save:
public string GetHello()
{
return "Hello from class library";
}
cd ..\WebApp
dotnet add reference ..\ClassLibrary\ClassLibrary.csproj
cd ..
dotnet sln add WebApp\WebApp.csproj
dotnet sln add ClassLibrary\ClassLibrary.csproj
cd WebApp
- Edit Controllers\HomeController.cs and update the
About()
method to the following, and save:
public IActionResult About()
{
var c = new ClassLibrary.Class1();
Console.WriteLine(c.GetHello());
ViewData["Message"] = c.GetHello();
return View();
}
cd ..
dotnet build
cd WebApp
dotnet run
- Open a browser and load
http://localhost:5000
(or whatever port the web server is listening on). - In the banner, click "About".
Expected Behavior
The "About" page includes the "Hello from class library" message.
Actual Behavior
An exception is thrown and the page does not render properly because ClassLibrary1 is not found:
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
An unhandled exception has occurred: Could not load file or assembly 'ClassLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'ClassLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'ClassLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
at WebApp.Controllers.HomeController.About()
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Core.Internal.ResourceInvoker.<InvokeNextResourceFilter>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Core.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Core.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Core.Internal.ResourceInvoker.<InvokeFilterPipelineAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Core.Internal.ResourceInvoker.<InvokeAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext()
Metadata
Metadata
Assignees
Labels
No labels