【发布时间】:2020-12-21 01:50:51
【问题描述】:
我正在研究 Service Fabric(我的第一个 Service Fabric 项目)。我收到了这个奇怪的错误,提示 Microsoft.ServiceFabric.Data.Impl.pdb 未加载。我确信它在我的代码中没有错误,因为我试图评论我的部分代码并且该错误总是出现。 正如我现在所理解的那样,它不是我的代码的某个部分是一个问题,它更多地发生在某个后台线程中,这不是我在做的,而是 Service Fabric 线程。这只是我目前的结论,可能完全错误。
但是当我在没有断点的情况下调试我的项目时,我的应用程序就会退出(与有人按下停止调试按钮的效果相同)。
有谁知道为什么会发生这种情况或这意味着什么。或者我怎样才能获得有关我得到的错误的更多信息。
编辑
程序.cs
try
{
// The ServiceManifest.XML file defines one or more service type names.
// Registering a service maps a service type name to a .NET type.
// When Service Fabric creates an instance of this service type,
// an instance of the class is created in this host process.
ServiceRuntime.RegisterServiceAsync("CECacheMicroserviceType",
context => new CECacheMicroservice(context)).GetAwaiter().GetResult();
ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(CECacheMicroservice).Name);
// Prevents this host process from terminating so services keep running.
Thread.Sleep(Timeout.Infinite);
}
catch (Exception e)
{
ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
throw;
}
【问题讨论】:
-
你能分享你
Program.cs文件的内容吗? -
我添加了 Program.cs 内容。我没有更改任何内容。
-
如果在 Program.cs 的
catch中添加断点会发生什么?您是否获得更多信息、异常类型、堆栈跟踪? -
嗯,什么也没发生,它永远不会到达断点,应用程序只是停止工作。
-
这意味着错误来自try块之外的某个地方。
标签: c# azure azure-service-fabric service-fabric-stateful service-fabric-stateless