Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

NullReferenceException on InitializeComponent()

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support
View previous topic :: View next topic  
Author Message
sbeanland



Joined: 01 Aug 2013
Posts: 2

PostPosted: Thu Aug 01, 2013 4:15 pm    Post subject: NullReferenceException on InitializeComponent() Reply with quote

Hi, this is a bit of an edge case, but we're running destruction tests on our application, hoping to stamp any edge case issues out.

We have the ability to open a new window by pressing a key combination. If that key combination is held down, many many windows can of course pop up one after another. When doing so, eventually we get a crash. The debugger stops at InitializeComponent on a window and pops up a NullReferenceException. Sometimes this happens after a couple dozen windows, sometimes it doesn't happen til well over 100 are opened. Below is a partial stack trace. Let me know if you need any more information.

Quote:
2013-08-01 09:55:30:327 System.NullReferenceException: Object reference not set to an instance of an object.
at Infralution.Localization.Wpf.MarkupExtensionManager.CleanupInactiveExtensions()
at Infralution.Localization.Wpf.MarkupExtensionManager.RegisterExtension(ManagedMarkupExtension extension)
at Infralution.Localization.Wpf.ManagedMarkupExtension..ctor(MarkupExtensionManager manager)
at Infralution.Localization.Wpf.UICultureExtension..ctor()
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.InvokeDelegate(Action`1 action, Object argument)
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.CallCtorDelegate(XamlTypeInvoker type)
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.CreateInstance(XamlTypeInvoker type)
at System.Xaml.Schema.XamlTypeInvoker.CreateInstance(Object[] arguments)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor(XamlType xamlType, Object[] args)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args)
at MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.CreateInstance(XamlType xamlType, Object[] args)
at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx)
at System.Xaml.XamlObjectWriter.WriteEndObject()
at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadDeferredContent(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings parentSettings, Uri baseUri)
at System.Windows.ResourceDictionary.CreateObject(KeyRecord key)
at System.Windows.ResourceDictionary.OnGettingValue(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.OnGettingValuePrivate(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.FetchResource(Object resourceKey, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean canCacheAsThemeResource, Boolean& canCache)
at System.Windows.FrameworkElement.FindResourceInternal(FrameworkElement fe, FrameworkContentElement fce, DependencyProperty dp, Object resourceKey, Object unlinkedParent, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, DependencyObject boundaryElement, Boolean isImplicitStyleLookup, Object& source)
at System.Windows.FrameworkElement.TryFindResource(Object resourceKey)


EDIT: As a bit of added information, we're using the Infragistics XamDataGrid in many places, and using localized strings for column headers. Not sure if this is relevant to the problem, but figured I'd put it out there anyway.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Aug 01, 2013 10:29 pm    Post subject: Reply with quote

That is very strange. I have had a look at the method throwing the exception and I can't see any obvious code that code that could fail with a NullReference error. I suggest that you download the source code for the Infralution.Localization.Wpf assembly from http://www.codeproject.com/Articles/35159/WPF-Localization-Using-RESX-Files and compile against it. That way you should be able to run the code in a debugger and see exactly where it is failing.

Alternatively if you could replicate the issue in a sample project that you could email to support@infralution.com then we would be happy to look at the issue.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
sbeanland



Joined: 01 Aug 2013
Posts: 2

PostPosted: Mon Aug 05, 2013 1:21 pm    Post subject: Reply with quote

We're still looking into this, but we suspect it's related to how we load windows on multiple threads, and resources trying to be loaded while other windows are still in the process of doing the same, causing some sort of race condition. We are probably going to put some workarounds in place so that pressing a key combination doesn't repeatedly open windows while held down. That should avoid the problem for now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group