Commit ad64141
authored
Upgrade to .NET 10 and modernize project infrastructure (#48)
* Upgrade to .NET 10, API Versioning 10, and modernize code
Upgraded all projects to .NET 10 (net10.0) and updated API Versioning packages to 10.0.0-preview.1. Overhauled .editorconfig for modern C# style, formatting, and naming conventions. Refactored codebase for .NET 10 compatibility, including property-based API Versioning usage, improved minimal API/controller patterns, and streamlined test host setup. Suppressed CA1707 in test projects. Performed general code cleanup, improved documentation, and ensured consistency across all files.
* Replace .sln with .slnx XML-based solution file
Removed the legacy Visual Studio .sln file and added a new .slnx solution file in XML format. The new file organizes projects and solution items into folders, providing a clearer and more structured project hierarchy. This change supports modern tooling and improves solution maintainability.
* Upgrade tests to xUnit v3 and update async test patterns
Replaced xUnit v2 packages with xunit.v3 and updated xunit.runner.visualstudio. Refactored test code to use TestContext.Current.CancellationToken for async HTTP calls, ensuring compatibility with xUnit v3. Removed xunit.runner.json (no longer needed in v3). Simplified global.json by removing msbuild-sdks. Added copilot-instructions.md to document FluentAssertions version constraint. Cleaned up unused usings and updated test.props references.
* Update dependency versions and clarify package constraints
Updated multiple package versions in Directory.Packages.props, including Azure.Core, Microsoft.Extensions.*, OpenTelemetry, and test dependencies. Revised copilot-instructions.md to clarify FluentAssertions upgrade limits and added a constraint for Swashbuckle.AspNetCore due to breaking changes in Microsoft.OpenApi v2.
* Add Api.http with sample requests for API endpoint testing
Added Api.http file containing example HTTP requests for /hello-world and /WeatherForecast endpoints, including variations with API versioning, custom actions, and resource IDs. This file aids in manual API testing and serves as documentation for available endpoints.
* Switch sample to .NET Aspire Dashboard for metrics
Replaced Docker Compose/Prometheus/Zipkin setup with .NET Aspire Dashboard for local metrics viewing. Updated README instructions and removed related config files to simplify observability setup.
* Update service names and simplify dashboard run command
Removed unnecessary env vars from run.cmd docker command. Updated OpenTelemetry resource serviceName values in Program.cs for clarity. Minor formatting and whitespace adjustments.
* Retrieve logger from DI and fix catch block formatting
Explicitly build the service provider and obtain an ILogger<Program> instance for logging. Also, adjust the catch block's closing brace for correct formatting.
* Add minimal API SLI tests and improve SLI test coverage
- Add ServiceLevelIndicatorMinimalApiTests for minimal API SLI scenarios, including custom operation names, route param extraction, and enrichment.
- Refactor ServiceLevelIndicatorAspTests: centralize metric validation, set MeterListener callback in constructor, and add tests for 404/500 cases.
- Fix typos in ServiceLevelIndicator and documentation (CustomerResourceId).
- Add unit tests for default meter usage, Record overloads, and MeasuredOperation double-dispose.
- Update README and controller XML docs for correct tag names and typos.
- Add /server_error endpoint to TestController for 500 error SLI testing.
* Enforce single [CustomerResourceId] per endpoint/action
Add validation to prevent multiple [CustomerResourceId] attributes on a single endpoint or controller action, throwing InvalidOperationException if violated. Update middleware and tests to reflect this constraint, and allow AddAttribute to accept nullable values. Improve test coverage and error reporting for this scenario.
* Add XML docs, logging, and code quality improvements
- Add comprehensive XML documentation to public APIs for better IntelliSense and maintainability.
- Log warnings in ServiceLevelIndicatorMiddleware when enrichments throw exceptions.
- Refactor ServiceLevelIndicatorConvention to apply parameter metadata to all selectors and enforce single CustomerResourceIdAttribute.
- Simplify ServiceLevelIndicatorOptions.Meter to an auto-property.
- Validate required options in ServiceLevelIndicator constructor.
- Apply minor code cleanups, formatting, and explicit access modifiers.
- No breaking changes to the public API surface.1 parent c095254 commit ad64141
75 files changed
Lines changed: 1345 additions & 961 deletions
File tree
- .github
- ServiceLevelIndicators.Asp.ApiVersioning
- src
- tests
- ServiceLevelIndicators.Asp
- src
- tests
- ServiceLevelIndicators
- src
- tests
- build
- sample
- ConsoleApp
- DockerOpenTelemetry
- GenerateSli
- MinApi
- WebApiVersioned
- Controllers/2023-06-06
- WebApi
- Controllers
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
32 | 30 | | |
33 | 31 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
| 307 | + | |
308 | 308 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
313 | 315 | | |
314 | | - | |
| 316 | + | |
315 | 317 | | |
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
Lines changed: 16 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
60 | | - | |
| 59 | + | |
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
| |||
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
85 | | - | |
| 84 | + | |
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
| |||
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
108 | | - | |
| 107 | + | |
109 | 108 | | |
110 | 109 | | |
111 | 110 | | |
| |||
128 | 127 | | |
129 | 128 | | |
130 | 129 | | |
131 | | - | |
| 130 | + | |
132 | 131 | | |
133 | 132 | | |
134 | 133 | | |
| |||
142 | 141 | | |
143 | 142 | | |
144 | 143 | | |
145 | | - | |
| 144 | + | |
146 | 145 | | |
147 | 146 | | |
148 | 147 | | |
| |||
167 | 166 | | |
168 | 167 | | |
169 | 168 | | |
170 | | - | |
| 169 | + | |
171 | 170 | | |
172 | 171 | | |
173 | 172 | | |
| |||
176 | 175 | | |
177 | 176 | | |
178 | 177 | | |
179 | | - | |
180 | | - | |
181 | | - | |
| 178 | + | |
182 | 179 | | |
183 | 180 | | |
184 | 181 | | |
| |||
197 | 194 | | |
198 | 195 | | |
199 | 196 | | |
200 | | - | |
201 | | - | |
202 | | - | |
| 197 | + | |
203 | 198 | | |
204 | 199 | | |
205 | 200 | | |
206 | 201 | | |
207 | 202 | | |
208 | 203 | | |
209 | | - | |
210 | | - | |
211 | | - | |
| 204 | + | |
212 | 205 | | |
213 | 206 | | |
214 | 207 | | |
215 | 208 | | |
216 | | - | |
217 | | - | |
218 | | - | |
| 209 | + | |
219 | 210 | | |
220 | 211 | | |
221 | 212 | | |
| |||
236 | 227 | | |
237 | 228 | | |
238 | 229 | | |
239 | | - | |
240 | | - | |
241 | | - | |
| 230 | + | |
242 | 231 | | |
243 | 232 | | |
244 | 233 | | |
245 | 234 | | |
246 | 235 | | |
247 | 236 | | |
248 | | - | |
249 | | - | |
250 | | - | |
| 237 | + | |
251 | 238 | | |
252 | 239 | | |
253 | 240 | | |
| |||
286 | 273 | | |
287 | 274 | | |
288 | 275 | | |
289 | | - | |
| 276 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
0 commit comments