Content-Length: 332394 | pFad | https://github.com/dotnet/tye/commit/1d31bba9ac44d7878332e9accc859bb2116cc601

F3 Fix nullability issues · dotnet/tye@1d31bba · GitHub
Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Commit

Permalink
Fix nullability issues
Browse files Browse the repository at this point in the history
  • Loading branch information
John Luo committed Sep 28, 2020
1 parent d6a273f commit 1d31bba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Microsoft.Tye.Core/ConfigModel/ConfigApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void Validate()
var probes = new[] { (Name: "liveness", Probe: service.Liveness), (Name: "readiness", Probe: service.Readiness) }.Where(p => p.Probe != null).ToArray();
foreach (var probe in probes)
{
context = new ValidationContext(probe.Probe);
context = new ValidationContext(probe.Probe!);
if (!Validator.TryValidateObject(probe.Probe, context, results, validateAllProperties: true))
{
throw new TyeYamlException(
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Tye.Hosting/HttpProxyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public async Task StartAsync(Application application)

var uri = new UriBuilder(uris[next].Uri)
{
Path = (string)context.Request.RouteValues["path"],
Path = (string)context.Request.RouteValues["path"]!,
Query = context.Request.QueryString.Value
};

Expand Down
12 changes: 6 additions & 6 deletions src/Microsoft.Tye.Hosting/TyeDashboardApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ private Task Service(HttpContext context)
{
var app = context.RequestServices.GetRequiredService<Application>();

var name = (string)context.Request.RouteValues["name"];
var name = (string?)context.Request.RouteValues["name"];
context.Response.ContentType = "application/json";

if (!app.Services.TryGetValue(name, out var service))
if (string.IsNullOrEmpty(name) || !app.Services.TryGetValue(name, out var service))
{
context.Response.StatusCode = 404;
return JsonSerializer.SerializeAsync(context.Response.Body, new
Expand Down Expand Up @@ -215,10 +215,10 @@ private Task Logs(HttpContext context)
{
var app = context.RequestServices.GetRequiredService<Tye.Hosting.Model.Application>();

var name = (string)context.Request.RouteValues["name"];
var name = (string?)context.Request.RouteValues["name"];
context.Response.ContentType = "application/json";

if (!app.Services.TryGetValue(name, out var service))
if (string.IsNullOrEmpty(name) || !app.Services.TryGetValue(name, out var service))
{
context.Response.StatusCode = 404;
return JsonSerializer.SerializeAsync(context.Response.Body, new
Expand Down Expand Up @@ -265,10 +265,10 @@ private Task Metrics(HttpContext context)

var sb = new StringBuilder();

var name = (string)context.Request.RouteValues["name"];
var name = (string?)context.Request.RouteValues["name"];
context.Response.ContentType = "application/json";

if (!app.Services.TryGetValue(name, out var service))
if (string.IsNullOrEmpty(name) || !app.Services.TryGetValue(name, out var service))
{
context.Response.StatusCode = 404;
return JsonSerializer.SerializeAsync(context.Response.Body, new
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Tye.Hosting/TyeHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ private static void DumpDiagnostics(HostOptions options, Microsoft.Extensions.Lo
providerText.AddRange(
new[] { options.DistributedTraceProvider, options.LoggingProvider, options.MetricsProvider }
.Where(p => p is object)
.Cast<string>());
.Cast<string>()!);

foreach (var text in providerText)
{
Expand Down

0 comments on commit 1d31bba

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/dotnet/tye/commit/1d31bba9ac44d7878332e9accc859bb2116cc601

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy