File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
DotNetWorker.Core/Context Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public InvocationFeatures(IEnumerable<IInvocationFeatureProvider> featureProvide
3131 }
3232 }
3333
34- return ( T ) feature ;
34+ return feature is null ? default : ( T ) feature ;
3535 }
3636
3737 public IEnumerator < KeyValuePair < Type , object > > GetEnumerator ( )
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public static class FunctionContextLoggerExtensions
1818 /// <returns>The <see cref="ILogger{T}"/>.</returns>
1919 public static ILogger < T > GetLogger < T > ( this FunctionContext context )
2020 {
21- return context . InstanceServices . GetService < ILogger < T > > ( ) ;
21+ return context . InstanceServices . GetService < ILogger < T > > ( ) ! ;
2222 }
2323
2424 /// <summary>
@@ -30,7 +30,7 @@ public static ILogger<T> GetLogger<T>(this FunctionContext context)
3030 public static ILogger GetLogger ( this FunctionContext context , string categoryName )
3131 {
3232 return context . InstanceServices
33- . GetService < ILoggerFactory > ( )
33+ . GetService < ILoggerFactory > ( ) !
3434 . CreateLogger ( categoryName ) ;
3535 }
3636 }
Original file line number Diff line number Diff line change 11// Copyright (c) .NET Foundation. All rights reserved.
22// Licensed under the MIT License. See License.txt in the project root for license information.
33
4+ using System ;
45using System . Threading . Channels ;
56using Grpc . Core ;
67using Grpc . Net . Client ;
@@ -47,7 +48,9 @@ public static IServiceCollection AddGrpc(this IServiceCollection services)
4748 services . AddSingleton < IWorker , GrpcWorker > ( ) ;
4849 services . AddSingleton < FunctionRpcClient > ( p =>
4950 {
50- IOptions < GrpcWorkerStartupOptions > argumentsOptions = p . GetService < IOptions < GrpcWorkerStartupOptions > > ( ) ;
51+ IOptions < GrpcWorkerStartupOptions > argumentsOptions = p . GetService < IOptions < GrpcWorkerStartupOptions > > ( )
52+ ?? throw new InvalidOperationException ( "gRPC Serivces are not correctly registered." ) ;
53+
5154 GrpcWorkerStartupOptions arguments = argumentsOptions . Value ;
5255
5356 GrpcChannel grpcChannel = GrpcChannel . ForAddress ( $ "http://{ arguments . Host } :{ arguments . Port } ", new GrpcChannelOptions ( )
You can’t perform that action at this time.
0 commit comments