NET-11: Migrate HomeController to .NET Core 6#20
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
NET-11: Migrate HomeController to .NET Core 6#20devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Port HomeController (5 actions: Index, About, Contact, Internals,
CodeView) and associated Razor views from ASP.NET MVC 5 (System.Web.Mvc)
to ASP.NET Core 6 (Microsoft.AspNetCore.Mvc) in a new SampleWebApp.Core
project hosted alongside the legacy SampleWebApp project.
- Add minimal SampleWebApp.Core ASP.NET Core 6 MVC project (net6.0):
Program.cs, Properties/launchSettings.json, appsettings*.json,
_ViewImports/_ViewStart, classic '{controller=Home}/{action=Index}/{id?}'
routing.
- Port HomeController.cs to Microsoft.AspNetCore.Mvc with IActionResult
return type; preserve action semantics and ViewBag.Message usage.
- Port InternalsInfo with cross-platform memory metrics via
GC.GetGCMemoryInfo() instead of the Windows-only PerformanceCounter.
- Port all 5 Home views and Views/Shared/_Layout.cshtml with original
Bootstrap 3 markup; replace MVC5 @Styles.Render / @Scripts.Render with
direct link/script tags pointing at wwwroot/lib assets.
- Bundle minimal static assets in wwwroot/ (site.css, Bootstrap 3.3.2
CSS/JS, jQuery 1.10.2) copied from the legacy project.
- Add Tests.Core xUnit project with unit tests for the 5 actions
(view type, default view name, ViewBag.Message, InternalsInfo model).
- Pin SDK to 6.0 via global.json and add SampleWebApp.Core.sln.
Legacy SampleWebApp (.NET Framework 4.5.1) project untouched; subsequent
phases will migrate the remaining controllers (Posts/Tags/Blogs/etc).
Builds clean (0 warnings, 0 errors); all 5 tests pass; routes /,
/Home/About, /Home/Contact, /Home/Internals, /Home/CodeView return HTTP
200 and render the expected content.
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates
HomeController(5 actions:Index,About,Contact,Internals,CodeView) and its associated Razor views from ASP.NET MVC 5 (System.Web.Mvc) to ASP.NET Core 6 (Microsoft.AspNetCore.Mvc) per NET-11. The legacySampleWebApp(.NET Framework 4.5.1) project is left untouched — the new code lives in a parallelSampleWebApp.Coreproject alongside a newTests.CorexUnit project.What changed
SampleWebApp.Core/project (net6.0,Microsoft.NET.Sdk.Web):Program.cs— minimal hosting;AddControllersWithViews(); classic{controller=Home}/{action=Index}/{id?}route to preserve URLs.Controllers/HomeController.cs— 5 actions ported, signatures changedActionResult→IActionResult; behavior preserved (incl.ViewBag.MessageonAbout).Models/InternalsInfo.cs— replaced the Windows-onlyPerformanceCounter("Memory", "Available MBytes")with cross-platformGC.GetGCMemoryInfo().TotalAvailableMemoryBytes; kept the four public properties so views bind unchanged.Views/Home/*.cshtml(Index, About, Contact, Internals, CodeView) — content preserved 1:1 from the legacy project.Views/Shared/_Layout.cshtml— original Bootstrap 3 markup kept; replaced@Styles.Render/@Scripts.Renderwith direct<link>/<script>tags and droppedWebUiInitialise.HostType(footer hardcoded for now).Views/_ViewImports.cshtml,Views/_ViewStart.cshtml— standard .NET Core boilerplate.wwwroot/css/site.css+wwwroot/lib/{bootstrap,jquery}— Bootstrap 3.3.2 + jQuery 1.10.2 copied verbatim from the legacy project for visual parity.appsettings.json,appsettings.Development.json,Properties/launchSettings.json.Tests.Core/project (xUnit,net6.0) with one test per action verifying view name + model.global.jsonpins SDK to 6.0 (withrollForward: latestFeature).SampleWebApp.Core.slnso the new projects can be built/tested independently of the legacySampleWebApp.sln.Acceptance criteria
IActionResult,View()/View(model)).Home/Index|About|Contact|Internals|CodeView); links to not-yet-migrated controllers (Posts/Tags/Blogs/PostsAsync/TagsAsync) intentionally preserved per Phase 1 design and will 404 until later phases ship.dotnet build→ 0 warnings, 0 errors).Local verification
Review & Testing Checklist for Human
SampleWebApp.Coreis what we want long-term (matches prior abandoned attempts; alternative open)._Layout.cshtmlstill links toPosts/Tags/Blogs/PostsAsync/TagsAsync(these will 404 until Phase 2+). The plan comment on NET-11 listed this as the by-design Phase 1 behavior.InternalsInfo.AvailableMbytesnow reflectsGC.GetGCMemoryInfo().TotalAvailableMemoryBytes(process-wide memory budget) instead of system-wide "Available MBytes" — confirm this semantic shift is acceptable. If we need exact parity on Windows, we can guard withOperatingSystem.IsWindows()and useSystem.Diagnostics.PerformanceCounterNuGet there._Layoutbody padding).SampleWebApp.Core.slnshould be merged into the existingSampleWebApp.slnlater or kept as a parallel solution during the migration.Notes
SampleWebApp/(.NET Framework 4.5.1) project; both projects coexist during the migration.master, so the minimal.NET Core 6project scaffolding needed to host HomeController is included here. If the team wants NET-10 to land as its own PR first, this PR can be rebased onto it.@Html.ActionLink(rather than<a asp-controller=... asp-action=...>tag helpers) to keep the diff minimal and preserve identical view source to the legacy app. Migrating to tag helpers can be a follow-up.Link to Devin session: https://app.devin.ai/sessions/5e9a777792fc44a088ccc73cd827ebc1
Devin Review