Eptagone / Vite.AspNetCore

Small library to integrate Vite into ASP.NET projects
MIT License
264 stars 35 forks source link

.NET 9 SDK - hot reload and ViteTagHelperMonitor warning #136

Closed seangwright closed 4 days ago

seangwright commented 6 days ago

Describe the bug When running a .NET 8 app using the .NET 9 SDK, I see this error in the console.

Expected to find a static method 'ClearCache' or 'UpdateApplication' on type 'Vite.AspNetCore.ViteTagHelperMonitor, Vite.AspNetCore, Version=2.3.0.0, Culture=neutral, PublicKeyToken=null' but neither exists.

This appears after a hot-reload when running the app via dotnet watch

To Reproduce Steps to reproduce the behavior:

  1. Add this library to an ASPNET Core app
  2. Install the .NET 9 SDK
  3. Run the app with dotnet watch
  4. Perform a code update that would trigger a hot reload in a .cshtml file
  5. See the warning in the console

Expected behavior No warning

Screenshots n/a

Device (please complete the following information):

Additional context I found this article https://learn.microsoft.com/en-us/visualstudio/debugger/hot-reload-metadataupdatehandler?view=vs-2022#add-the-metadataupdatehandler and I think it applies to this file https://github.com/Eptagone/Vite.AspNetCore/blob/main/src/Vite.AspNetCore/Services/ViteTagHelperMonitor.cs