winform调用wpf异常问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了winform调用wpf异常问题相关的知识,希望对你有一定的参考价值。
异常信息,请问是怎么回事。 我从新建了一个新的usercontrol只有一个button是没问题的
未处理 System.NullReferenceException
Message=未将对象引用设置到对象的实例。
Source=WindowsBase
StackTrace:
在 System.Windows.Markup.ReflectionHelper.IsPublicType(Type type)
在 System.Windows.Markup.XamlTypeMapper.UpdateAttachedPropertyMethdodInfo(BamlAttributeInfoRecord attributeInfo, Boolean isSetter)
在 System.Windows.Markup.XamlTypeMapper.UpdateAttachedPropertyGetter(BamlAttributeInfoRecord attributeInfo)
在 System.Windows.Markup.PropertyDefinition.get_AttachedPropertyGetter()
在 System.Windows.Markup.BamlCollectionHolder.InitDefaultValue()
在 System.Windows.Markup.BamlCollectionHolder..ctor(BamlRecordReader reader, Object parent, Int16 attributeId, Boolean needDefault)
在 System.Windows.Markup.BamlRecordReader.ReadPropertyIListStartRecord(BamlPropertyIListStartRecord bamlPropertyIListStartRecord)
在 System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
在 System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
在 System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
在 System.Windows.Markup.TreeBuilder.Parse()
在 System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
在 System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
在 Accs.WpfControls.FeatureMenu.InitializeComponent() 位置 d:\ACCS-GINO\AccsWpfControls\FeatureMenu.xaml:行号 1
在 Accs.WpfControls.FeatureMenu..ctor() 位置 D:\ACCS-GINO\AccsWpfControls\FeatureMenu.xaml.cs:行号 24
在 WPFTest.Form1.InitializeComponent() 位置 E:\WPFTest\WPFTest\Form1.Designer.cs:行号 34
在 WPFTest.Form1..ctor() 位置 E:\WPFTest\WPFTest\Form1.cs:行号 15
在 WPFTest.Program.Main() 位置 E:\WPFTest\WPFTest\Program.cs:行号 17
在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException:
Message=未将对象引用设置到对象的实例,
说明你这个类没有new一个对象,大概你只定义了吧?
以上是关于winform调用wpf异常问题的主要内容,如果未能解决你的问题,请参考以下文章