บริบท
VS 2019, .NET Core 3 Preview 5 ฉันได้สร้าง ASP MVC Web App ใหม่ล่าสุด ตอนนี้กำลังตรวจสอบรหัสเริ่มต้น:
// ...
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
//...
เมื่อฉันพยายามดูว่าวิธีการขยายเหล่านั้นกำลังทำอะไรอยู่ ฉันจะไปที่แหล่งที่มา (ในกรณีของฉัน ctrl+click และนั่นเรียกใช้ตัวถอดรหัส JetBrain) ฉันได้รับสิ่งนี้:
// Decompiled with JetBrains decompiler
// Type: Microsoft.AspNetCore.Builder.AuthAppBuilderExtensions
// Assembly: Microsoft.AspNetCore.Authentication, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// MVID: A1CE531C-37CE-4C8A-B143-24C2AC9CFE19
// Assembly location: C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\3.0.0-preview5-19227-01\ref\netcoreapp3.0\Microsoft.AspNetCore.Authentication.dll
namespace Microsoft.AspNetCore.Builder
{
/// <summary>
/// Extension methods to add authentication capabilities to an HTTP application pipeline.
/// </summary>
public static class AuthAppBuilderExtensions
{
/// <summary>
/// Adds the <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationMiddleware" /> to the specified <see cref="T:Microsoft.AspNetCore.Builder.IApplicationBuilder" />, which enables authentication capabilities.
/// </summary>
/// <param name="app">The <see cref="T:Microsoft.AspNetCore.Builder.IApplicationBuilder" /> to add the middleware to.</param>
/// <returns>A reference to this instance after the operation has completed.</returns>
public static IApplicationBuilder UseAuthentication(
this IApplicationBuilder app)
{
throw null;
}
}
}
คำถาม
เมื่อฉันดีบักโค้ด ฉันไม่ได้รับ Exception
ดังนั้นจึงดูเหมือนว่าโค้ดไม่ได้กำลังทำงานอยู่ ข้อสรุปของฉันว่าสิ่งที่โครงการอ้างถึงนั้นเป็นแอสเซมบลีที่ว่างเปล่าจำลอง (ดูบรรทัดความคิดเห็น // Assembly location: C:\Program Files...
ในแหล่งที่มาที่ถอดรหัสแล้ว) แต่ฉันไม่เข้าใจกลไกว่าทำไมแอสเซมบลีอื่นรันไทม์จึงถูกโหลด
ใครช่วยอธิบายสิ่งที่เกิดขึ้นจริงที่นี่ได้ไหม
Microsoft.AspNetCore.Authentication.dll
ในไดเร็กทอรี bin ของคุณ - person CodeCaster   schedule 08.05.2019ref
dll แต่src
dll ? - person Legends   schedule 01.10.2019