Is the strong naming key for Microsoft.Practices.ServiceLocation dll available?

Feb 15, 2013 at 8:38 AM
I have a .NET 4 application that uses Prism 4.0 and MEF.

We have a weird application crash (intermittent) where there is a NullReferenceException inside Prism code while accessing ServiceLocator.Current.

I wanted to do some changes in that code to introduce Interlocked.Exchange to see if it helps. However, the source code does not include the strong named key which means that I have to create a new key and rebuild everything that refers to Microsoft.Practices.ServiceLocation. (e.g. Prism dlls, my application dlls etc)

Hence the question, can the strong named key for Microsoft.Practices.ServiceLocation be shared here?

Also the exception call stack is:

A first chance exception has occured: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Practices.ServiceLocation.ServiceLocator.get_Current()

Which lead to:
System.ComponentModel.Composition.Primitives.ComposablePartException: An exception occurred while trying to create an instance of type 'GE.Energy.Framework.UI.Shell.Shell'. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Practices.Prism.Regions.RegionManager.CreateRegion(DependencyObject element)
at Microsoft.Practices.Prism.Regions.RegionManager.OnSetRegionNameCallback(DependencyObject element, DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.Baml2006.WpfMemberInvoker.SetValue(Object instance, Object value)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMember member, Object obj, Object value)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
at MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.SetValue(Object obj, XamlMember property, Object value)
at System.Xaml.XamlObjectWriter.SetValue(Object inst, XamlMember property, Object value)
at System.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, Object value, Boolean onParent)
at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)
at System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx)
at System.Xaml.XamlObjectWriter.WriteEndMember()
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.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at GE.Energy.Framework.UI.Shell.Shell.InitializeComponent()
at GE.Energy.Framework.UI.Shell.Shell..ctor()
at GE.Energy.Framework.UI.Shell.Shell..ctor(IRegionManager regionManager, IEventAggregator eventAggregator)
--- End of inner exception stack trace ---
at System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.CreateInstance(ConstructorInfo constructor, Object[] arguments)



This should not happen because:
Configuring ServiceLocator singleton had happened just before that which means that the ServiceLocator is set.