C# WPF应用程序在启动时崩溃-事件查看器日志中的.NET运行时错误事件Id 1026

C# WPF应用程序在启动时崩溃-事件查看器日志中的.NET运行时错误事件Id 1026,c#,.net,wpf,xaml,registry,C#,.net,Wpf,Xaml,Registry,我有一个WPF应用程序具有.NET运行时4.5.1。它在开发机器上运行良好 当我在Windows 10计算机上安装并尝试启动应用程序时,它会崩溃,然后我检查了事件查看器日志,发现一个.net运行时错误,如下所示: Event ID : 1026 Source : .NET Runtime Application: ABC.EXE Framework Version: v4.0.30319 Description: The process was terminated due to an unh

我有一个WPF应用程序具有.NET运行时4.5.1。它在开发机器上运行良好

当我在Windows 10计算机上安装并尝试启动应用程序时,它会崩溃,然后我检查了事件查看器日志,发现一个.net运行时错误,如下所示:

Event ID : 1026
Source : .NET Runtime

Application: ABC.EXE
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Xml.XmlException
at System.Xml.XmlTextReaderImpl.Throw(System.Exception)
at System.Xml.XmlTextReaderImpl.Throw(System.String, System.String[])
at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Char[], Int32, Int32)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Configuration.XmlUtil..ctor(System.IO.Stream, System.String, 
Boolean, System.Configuration.ConfigurationSchemaErrors)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()

Exception Info: System.Configuration.ConfigurationErrorsException
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors
(System.Configuration.ConfigurationSchemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(System.String)

Exception Info: System.Configuration.ConfigurationErrorsException
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(System.String)
at System.Configuration.ConfigurationManager.get_AppSettings()
at ABC.Application.Helpers.ResourceManager.get_DomainPath()
at ABC.Presentation.App..ctor()
at ABC.Presentation.App.Main()

我也有同样的问题,并且app.config中存在XML语法错误,请确保配置文件中没有任何可能导致此问题的错误

在我的案例中,问题在于评论未正确关闭:

<!-- commented configuration /> <!-- another comment -->


第一条评论没有正确关闭,使用了
Notepad++
XML工具
插件对其进行验证并发现问题。

您的
ABC.Application.Helpers.ResourceManager.DomainPath
属性getter引发了一个未处理的异常。据猜测,我们需要查看代码才能处理此异常。请你把它编辑成问题好吗?您可能需要及时回答,以帮助避免问题被关闭(尽管如果问题仍然关闭,它可以重新打开)。请阅读-总结是,这不是解决志愿者问题的理想方式,可能会对获得答案产生反作用。请避免将此添加到您的问题中。您的应用程序的配置文件至少包含一个在XML上下文中无效的字符。