【问题标题】:WPF App crashing at startup - .NET Runtime Error Event Id 1026 in event viewer logWPF 应用程序在启动时崩溃 - 事件查看器日志中的 .NET 运行时错误事件 ID 1026
【发布时间】:2018-07-19 11:52:33
【问题描述】:

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

当我在 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()

【问题讨论】:

  • 您的 ABC.Application.Helpers.ResourceManager.DomainPath 属性获取器正在引发未处理的异常。
  • 猜测一下,我们需要查看代码来配合这个。请您将其编辑到问题中吗?您可能需要及时提示,以帮助避免问题被关闭(尽管如果它仍然关闭,它可以再次重新打开)。
  • 请阅读Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - 总结是这不是解决志愿者的理想方式,并且可能会适得其反。请不要将此添加到您的问题中。
  • 您应用的配置文件中至少包含一个在 XML 上下文中无效的字符。

标签: c# .net wpf xaml registry


【解决方案1】:

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

在我的情况下,问题是没有正确关闭评论:

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

第一条评论没有正常关闭,使用Notepad++XML Tools插件验证发现问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多