Skip to content

NET-11: Migrate HomeController to .NET Core 6#20

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1778526451-net11-homecontroller-net6
Open

NET-11: Migrate HomeController to .NET Core 6#20
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1778526451-net11-homecontroller-net6

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented May 11, 2026

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 legacy SampleWebApp (.NET Framework 4.5.1) project is left untouched — the new code lives in a parallel SampleWebApp.Core project alongside a new Tests.Core xUnit project.

What changed

  • New 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 changed ActionResultIActionResult; behavior preserved (incl. ViewBag.Message on About).
    • Models/InternalsInfo.cs — replaced the Windows-only PerformanceCounter("Memory", "Available MBytes") with cross-platform GC.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.Render with direct <link> / <script> tags and dropped WebUiInitialise.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.
  • New Tests.Core/ project (xUnit, net6.0) with one test per action verifying view name + model.
  • global.json pins SDK to 6.0 (with rollForward: latestFeature).
  • SampleWebApp.Core.sln so the new projects can be built/tested independently of the legacy SampleWebApp.sln.

Acceptance criteria

  • All 5 action methods functional in .NET Core (returns IActionResult, View() / View(model)).
  • All views render correctly with proper styling (verified by HTTP smoke test below — all 5 routes return 200 with expected content, Bootstrap CSS loaded).
  • Navigation between actions works properly (links to 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.
  • No compilation errors or warnings (dotnet build → 0 warnings, 0 errors).
  • Maintains original functionality and behavior.

Local verification

$ dotnet build SampleWebApp.Core.sln -c Release
Build succeeded. 0 Warning(s), 0 Error(s)

$ dotnet test SampleWebApp.Core.sln -c Release --no-build
Passed!  - Failed: 0, Passed: 5, Skipped: 0, Total: 5

$ dotnet format SampleWebApp.Core.sln --verify-no-changes
(clean — exit 0)

$ dotnet run --project SampleWebApp.Core --no-launch-profile --urls http://127.0.0.1:5187
GET /                -> 200  (renders "Welcome to the Sample MVC Web Application - basic version")
GET /Home/About      -> 200  ("About this site")
GET /Home/Contact    -> 200  ("About the Author")
GET /Home/Internals  -> 200  (Renders InternalsInfo: WorkerThreads, AvailableThreads, AvailableMbytes, HeapMemoryUsedKbytes)
GET /Home/CodeView   -> 200  ("Introduction to GenericServices")
GET /lib/bootstrap/css/bootstrap.min.css -> 200

Review & Testing Checklist for Human

  • Confirm the assumed project name SampleWebApp.Core is what we want long-term (matches prior abandoned attempts; alternative open).
  • Confirm it's acceptable that the navbar in _Layout.cshtml still links to Posts/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.AvailableMbytes now reflects GC.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 with OperatingSystem.IsWindows() and use System.Diagnostics.PerformanceCounter NuGet there.
  • Spot-check view rendering in a real browser (Bootstrap 3 navbar collapse, dropdown menus, _Layout body padding).
  • Decide whether SampleWebApp.Core.sln should be merged into the existing SampleWebApp.sln later or kept as a parallel solution during the migration.

Notes

  • This PR does not touch the legacy SampleWebApp/ (.NET Framework 4.5.1) project; both projects coexist during the migration.
  • NET-11 declared a dependency on "Project Setup and Infrastructure task completion" (NET-10). NET-10's only Done subtask (NET-15) was never merged to master, so the minimal .NET Core 6 project 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.
  • Views still use @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.
  • Subtasks completed by this PR:
    • NET-18 (Controller Structure Migration)
    • NET-19 (Action Methods Migration)
    • NET-20 (View Migration)

Link to Devin session: https://app.devin.ai/sessions/5e9a777792fc44a088ccc73cd827ebc1


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

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.
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants