小编jul*_*zzz的帖子

GetManifestResourceNames 返回空数组

我正在尝试将xml文件加载到方法中来处理它。我有两个项目:SignalServerDbLibrary。里面DbLibrary有一个类SQLQuery,有一个方法GetResourceTextFile(string xmlFile)。该方法的调用如下SignalServer

SQLQueries.GetResourceTextFile("SignalServer.HubQueries.xml");
Run Code Online (Sandbox Code Playgroud)

在此方法中,我尝试从 xml 文件加载资源:

using (Stream resourceStream = Assembly.GetCallingAssembly()
                                                   .GetManifestResourceStream(xmlFile)){}
Run Code Online (Sandbox Code Playgroud)

然而,GetManifestResourceStream似乎没有获得任何传递给它的资源。事实上,当我使用以下内容进行调试时:

string [] p = Assembly.GetCallingAssembly().GetManifestResourceNames();
Run Code Online (Sandbox Code Playgroud)

数组为空。

我尝试加载的文件位于 SignalServer 目录中。为什么看不到它GetManifestResourceStream,我该如何解决这个问题?谢谢!

c# xml reflection

7
推荐指数
0
解决办法
3376
查看次数

grpc 未处理异常 StatusCode=调用从 proto 文件生成的方法时未知

我有一个C#的客户端和服务器,并得到类型的未处理的异常Grpc.Core.RpcExceptionStatus(StatusCode=Unknown, Detail="Exception was thrown by handler.")调用时,SendMessage在客户端功能(从生成的文件)。

堆栈跟踪是:

Got response: True
RPC failed Grpc.Core.RpcException: Status(StatusCode=Unknown, Detail="Exception was thrown by handler.")
   at Grpc.Core.Internal.AsyncCall`2.UnaryCall(TRequest msg) in T:\src\github\grpc\src\csharp\Grpc.Core\Internal\AsyncCall.cs:line 75
   at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request) in T:\src\github\grpc\src\csharp\Grpc.Core\DefaultCallInvoker.cs:line 46
   at Grpc.Core.Interceptors.InterceptingCallInvoker.<BlockingUnaryCall>b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext`2 ctx) in T:\src\github\grpc\src\csharp\Grpc.Core\Interceptors\InterceptingCallInvoker.cs:line 51
   at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request, ClientInterceptorContext`2 context, BlockingUnaryCallContinuation`2 continuation) in T:\src\github\grpc\src\csharp\Grpc.Core\ClientBase.cs:line 174
   at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request) in T:\src\github\grpc\src\csharp\Grpc.Core\Interceptors\InterceptingCallInvoker.cs:line 48
   at MessageService.MessageServiceClient.SendMessage(Message request, …
Run Code Online (Sandbox Code Playgroud)

c# protocol-buffers grpc

5
推荐指数
1
解决办法
4508
查看次数

标签 统计

c# ×2

grpc ×1

protocol-buffers ×1

reflection ×1

xml ×1