Extend clock shimming to support TimeProvider abstract class#9
Conversation
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/d6cd3cb6-46c0-4ccb-a73f-f024d176bec3 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/d6cd3cb6-46c0-4ccb-a73f-f024d176bec3 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/d6cd3cb6-46c0-4ccb-a73f-f024d176bec3 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
This reverts commit 580d248. Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/d6cd3cb6-46c0-4ccb-a73f-f024d176bec3 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/d6cd3cb6-46c0-4ccb-a73f-f024d176bec3 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/d6cd3cb6-46c0-4ccb-a73f-f024d176bec3 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Extends the INSHIM001 clock shimming experience to also offer a TimeProvider-based code fix path (in addition to the existing IClock path), and updates analyzer/README messaging accordingly.
Changes:
- Adds a second
INSHIM001code fix option: “Use injected TimeProvider”, injecting aSystem.TimeProviderfield and rewritingUtcNow/Nowusages. - Updates the
INSHIM001diagnostic message to recommendIClockorTimeProvider. - Updates README feature text to mention support for framework abstractions like
TimeProvider.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/Inshiminator.CodeFixes/ClockCodeFixProvider.cs | Registers the new TimeProvider code action and implements the injection + replacement logic. |
| src/Inshiminator.Analyzers/ClockAnalyzer.cs | Updates the diagnostic message text for INSHIM001. |
| README.md | Mentions TimeProvider support in the “Generate” feature description. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/407b2fd1-a9d0-4f5b-b2d5-32b11b069750 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/407b2fd1-a9d0-4f5b-b2d5-32b11b069750 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/407b2fd1-a9d0-4f5b-b2d5-32b11b069750 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Applied the requested PR-thread updates in commits This includes: gating the TimeProvider code action by availability, preserving DateTime vs DateTimeOffset rewrite types, hardening constructor/assignment handling (including collisions), using semantic |
|
@copilot apply changes based on the comments in this thread |
Applied in commit I updated Screenshot: N/A (no UI changes in this PR). |
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/41f91297-e4c0-45bc-8e6f-f97c906c2a4f Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/41f91297-e4c0-45bc-8e6f-f97c906c2a4f Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Applied in commit Screenshot: N/A (no UI changes). |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/16ab3d7f-5286-4365-954f-3130e0b94c2a Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/16ab3d7f-5286-4365-954f-3130e0b94c2a Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Addressed in commit Screenshot: N/A (no UI changes). |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/310f2e07-a529-4897-aa3f-8a365dba9992 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
…lizer fix Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/310f2e07-a529-4897-aa3f-8a365dba9992 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/310f2e07-a529-4897-aa3f-8a365dba9992 Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
tests/Inshiminator.Analyzers.Tests/ClockCodeFixTests.cs:1061
- This test input declares
private readonly CustomTimeProvider _timeProvider;but does not assign it in the constructor, which is a compile-time error for readonly fields. To keep the scenario realistic and ensure the test compiles, either assign_timeProviderin the constructor or removereadonlyfrom the pre-fix input.
private readonly CustomTimeProvider _timeProvider;
public Test(string name)
{
}
tests/Inshiminator.Analyzers.Tests/ClockCodeFixTests.cs:1121
- The pre-fix test code includes an unassigned readonly field (
private readonly MyApp.CustomTimeProvider _timeProvider;), which will not compile. Consider making the field non-readonly in the test input or initializing/assigning it so the test represents a valid starting point for the code fix.
private readonly MyApp.CustomTimeProvider _timeProvider;
public Test(string name)
{
}
Agent-Logs-Url: https://github.com/JerrettDavis/In-Shim-Inator/sessions/1fdd6a48-cc14-44c4-ad30-9af35683279d Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.