<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>CommonServiceLocator Discussions Rss Feed</title><link>http://www.codeplex.com/CommonServiceLocator/Thread/List.aspx</link><description>CommonServiceLocator Discussions Rss Description</description><item><title>New Post: Question about use of MefServiceLocator</title><link>http://commonservicelocator.codeplex.com/discussions/442556</link><description>&lt;div style="line-height: normal;"&gt;Why doesn't the compositionContainer get resolved in Class Foo shown below?&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;    class Program
    {
        static void Main(string[] args)
        {
            Test mytest = new Test();
        }
    }

    public class Test
    {
        public Test()
        {
            ComposeMefContainer();

            Foo foo = new Foo();
        }

        private void ComposeMefContainer()
        {
            CompositionContainer _container;
            var catalog = new AggregateCatalog(new DirectoryCatalog(&amp;quot;.&amp;quot;),
                          new AssemblyCatalog(Assembly.GetExecutingAssembly()));
            _container = new CompositionContainer(catalog);
            _container.ComposeParts(this);

            var mef = new MefServiceLocator(_container);
            ServiceLocator.SetLocatorProvider(() =&amp;gt; mef);
        }
    }

    public class Foo
    {
        [Import]
        Bar abar;

        public Foo()
        {
            //I know I can do the following
            var bar = ServiceLocator.Current.GetInstance&amp;lt;Bar&amp;gt;();

            //Why doesn't this work?
            var compositionContainer = ServiceLocator.Current.GetInstance&amp;lt;CompositionContainer&amp;gt;();
            compositionContainer.SatisfyImportsOnce(this);
        }
    }

    [Export]
    public class Bar
    {
        public string Name {get; set;}

        public Bar()
        {
            Name = &amp;quot;Tom&amp;quot;;
        }
    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;</description><author>jfraschilla</author><pubDate>Sat, 04 May 2013 16:02:56 GMT</pubDate><guid isPermaLink="false">New Post: Question about use of MefServiceLocator 20130504040256P</guid></item><item><title>New Post: Is the strong naming key for Microsoft.Practices.ServiceLocation dll available?</title><link>http://commonservicelocator.codeplex.com/discussions/433250</link><description>&lt;div style="line-height: normal;"&gt;I have a .NET 4 application that uses Prism 4.0 and MEF.&lt;br /&gt;
&lt;br /&gt;
We have a weird application crash (intermittent) where there is a NullReferenceException inside Prism code while accessing ServiceLocator.Current.&lt;br /&gt;
&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
Hence the question, can the strong named key for Microsoft.Practices.ServiceLocation be shared here?&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Also the exception call stack is:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
A first chance exception has occured: System.NullReferenceException: Object reference not set to an instance of an object.&lt;br /&gt;
   at Microsoft.Practices.ServiceLocation.ServiceLocator.get_Current()&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Which lead to:&lt;/strong&gt;&lt;br /&gt;
System.ComponentModel.Composition.Primitives.ComposablePartException: An exception occurred while trying to create an instance of type 'GE.Energy.Framework.UI.Shell.Shell'. ---&amp;gt; System.NullReferenceException: Object reference not set to an instance of an object.&lt;br /&gt;
   at Microsoft.Practices.Prism.Regions.RegionManager.CreateRegion(DependencyObject element)&lt;br /&gt;
   at Microsoft.Practices.Prism.Regions.RegionManager.OnSetRegionNameCallback(DependencyObject element, DependencyPropertyChangedEventArgs args)&lt;br /&gt;
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)&lt;br /&gt;
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)&lt;br /&gt;
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)&lt;br /&gt;
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry&amp;amp; newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)&lt;br /&gt;
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)&lt;br /&gt;
   at System.Windows.Baml2006.WpfMemberInvoker.SetValue(Object instance, Object value)&lt;br /&gt;
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMember member, Object obj, Object value)&lt;br /&gt;
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)&lt;br /&gt;
   at MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.SetValue(Object obj, XamlMember property, Object value)&lt;br /&gt;
   at System.Xaml.XamlObjectWriter.SetValue(Object inst, XamlMember property, Object value)&lt;br /&gt;
   at System.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, Object value, Boolean onParent)&lt;br /&gt;
   at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)&lt;br /&gt;
   at System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx)&lt;br /&gt;
   at System.Xaml.XamlObjectWriter.WriteEndMember()&lt;br /&gt;
   at System.Xaml.XamlWriter.WriteNode(XamlReader reader)&lt;br /&gt;
   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)&lt;br /&gt;
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)&lt;br /&gt;
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)&lt;br /&gt;
   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)&lt;br /&gt;
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)&lt;br /&gt;
   at GE.Energy.Framework.UI.Shell.Shell.InitializeComponent()&lt;br /&gt;
   at GE.Energy.Framework.UI.Shell.Shell..ctor()&lt;br /&gt;
   at GE.Energy.Framework.UI.Shell.Shell..ctor(IRegionManager regionManager, IEventAggregator eventAggregator)&lt;br /&gt;
   --- End of inner exception stack trace ---&lt;br /&gt;
   at System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.CreateInstance(ConstructorInfo constructor, Object[] arguments)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This should not happen because:&lt;br /&gt;
&lt;em&gt;Configuring ServiceLocator singleton&lt;/em&gt; had happened just before that which means that the ServiceLocator is set.&lt;br /&gt;
&lt;/div&gt;</description><author>freaksterrao</author><pubDate>Fri, 15 Feb 2013 09:38:19 GMT</pubDate><guid isPermaLink="false">New Post: Is the strong naming key for Microsoft.Practices.ServiceLocation dll available? 20130215093819A</guid></item><item><title>New Post: Portable version to support all platforms</title><link>http://commonservicelocator.codeplex.com/discussions/347703</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Cool! I found it. Thanks for the quick reply&lt;/p&gt;
&lt;/div&gt;</description><author>FelixM</author><pubDate>Sat, 02 Feb 2013 14:10:56 GMT</pubDate><guid isPermaLink="false">New Post: Portable version to support all platforms 20130202021056P</guid></item><item><title>New Post: Portable version to support all platforms</title><link>http://commonservicelocator.codeplex.com/discussions/347703</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I packaged them up as Portable.CommonServiceLocator on NuGet until the official package is updated.&lt;/p&gt;
&lt;/div&gt;</description><author>onovotny</author><pubDate>Sat, 02 Feb 2013 14:05:03 GMT</pubDate><guid isPermaLink="false">New Post: Portable version to support all platforms 20130202020503P</guid></item><item><title>New Post: Portable version to support all platforms</title><link>http://commonservicelocator.codeplex.com/discussions/347703</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;it's great that you built a PCL Version! However, it doesn't seem to be available on NuGet. Are there any plans to provide it via NuGet?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;/div&gt;</description><author>FelixM</author><pubDate>Sat, 02 Feb 2013 13:54:38 GMT</pubDate><guid isPermaLink="false">New Post: Portable version to support all platforms 20130202015438P</guid></item><item><title>New Post: License</title><link>http://commonservicelocator.codeplex.com/discussions/431400</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;.&lt;/p&gt;
&lt;/div&gt;</description><author>roman_d_boiko</author><pubDate>Wed, 30 Jan 2013 13:32:32 GMT</pubDate><guid isPermaLink="false">New Post: License 20130130013232P</guid></item><item><title>New Post: License</title><link>http://commonservicelocator.codeplex.com/discussions/431400</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Would you mind changing license to MIT? Since CommonServiceLocator is referenced from Portable MVVM Light project which is MIT-licensed, everybody who uses the latter must now also accept Ms-PL which differs significantly.&lt;/p&gt;
&lt;/div&gt;</description><author>roman_d_boiko</author><pubDate>Wed, 30 Jan 2013 12:26:51 GMT</pubDate><guid isPermaLink="false">New Post: License 20130130122651P</guid></item><item><title>New Post: Portable version to support all platforms</title><link>http://commonservicelocator.codeplex.com/discussions/347703</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;The PCL version has been updated to include the NeutralResourcesLanguageAttribute.&lt;/p&gt;
&lt;/div&gt;</description><author>fcheung</author><pubDate>Tue, 27 Nov 2012 21:39:11 GMT</pubDate><guid isPermaLink="false">New Post: Portable version to support all platforms 20121127093911P</guid></item><item><title>New Post: Portable version to support all platforms</title><link>http://commonservicelocator.codeplex.com/discussions/347703</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;The new PCL version is missing the NeutralResourcesLanguageAttribute. That's generating a compiler warning:&lt;/p&gt;
&lt;p&gt;Warning&amp;nbsp;1&amp;nbsp;The assembly "C:\Users\Public\Downloads\CodePlex\MVVMLight\GalaSoft.MvvmLight\Portable\packages\Portable.CommonServiceLocator.1.2\lib\portable-net4+sl4+wp7+win8\Microsoft.Practices.ServiceLocation.dll" does not have a NeutralResourcesLanguageAttribute on it. To be used in an app package, portable libraries must define a NeutralResourcesLanguageAttribute on their main assembly (ie, the one containing code, not a satellite assembly).&amp;nbsp;C:\Users\Public\Downloads\CodePlex\MVVMLight\GalaSoft.MvvmLight\Portable\packages\Portable.CommonServiceLocator.1.2\lib\portable-net4+sl4+wp7+win8\Microsoft.Practices.ServiceLocation.dll&amp;nbsp;GalaSoft.MvvmLight.Test.Portable.WinRT&lt;/p&gt;
&lt;p&gt;Can you please add the attribute and re-release the PCL binary?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;/div&gt;</description><author>onovotny</author><pubDate>Sat, 06 Oct 2012 17:55:28 GMT</pubDate><guid isPermaLink="false">New Post: Portable version to support all platforms 20121006055528P</guid></item><item><title>New Post: Passing constructor arguments with StructureMap Adapter</title><link>http://commonservicelocator.codeplex.com/discussions/68485</link><description>&lt;div style="line-height: normal;"&gt;&lt;pre&gt;&lt;span style="color: blue;"&gt;Hello&lt;br /&gt;&lt;br /&gt;I have a class with parameter in a constructor&lt;br /&gt;This &lt;/span&gt;&lt;span style="color: blue;"&gt;class &lt;/span&gt;&lt;span style="color: blue;"&gt;is Export by Interface in prism application -&amp;gt; [Export(typeof(interface))]&lt;br /&gt;&lt;br /&gt;But I can't get this instance by ServiceLocator;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var&lt;/span&gt; newInstance = ServiceLocator.Current.GetInstance&amp;lt;Interface&amp;gt;(my parameter); ???????&lt;br /&gt;&lt;br /&gt;??????&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When remove parameter in a constructor my getinstance it's ok.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial;"&gt;&lt;span style="font-size: 14px;"&gt;&lt;span id="ID0EHD"&gt;how will we do it?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Thanks.&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</description><author>Elmer59</author><pubDate>Thu, 13 Sep 2012 09:16:34 GMT</pubDate><guid isPermaLink="false">New Post: Passing constructor arguments with StructureMap Adapter 20120913091634A</guid></item><item><title>New Post: Portable version to support all platforms</title><link>http://commonservicelocator.codeplex.com/discussions/347703</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Just wanted to update on this as with the RTM bits, IServiceProvider is in the PCL, so it's possible to target .NET 4, SL4, WP7 and Windows Store as-is. It would be great if you could publish an official portable version signed with the same key.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;</description><author>onovotny</author><pubDate>Wed, 29 Aug 2012 18:42:28 GMT</pubDate><guid isPermaLink="false">New Post: Portable version to support all platforms 20120829064228P</guid></item><item><title>New Post: ServiceLocatorImplBase seems to break the contract of IServiceProvider</title><link>http://commonservicelocator.codeplex.com/discussions/389293</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;This has been discussed before &lt;a title="Query methods " href="http://commonservicelocator.codeplex.com/discussions/44293/"&gt;here&lt;/a&gt;, and this design flaw has been &lt;a title="Sounds like we might have messed up here." href="http://commonservicelocator.codeplex.com/discussions/44293/#post564150"&gt;confirmed&lt;/a&gt; by &lt;a title="Glenn Block" href="http://www.codeplex.com/site/users/view/gblock"&gt;Glenn Block&lt;/a&gt;, the coordinator of the CSL.&lt;/p&gt;
&lt;p&gt;Fixing this is a big breaking change, but not changing this IMO is not really an option, since the current implementation makes the abstraction unusable. For this reason the &lt;a title="NuGet - CommonServiceLocator.SimpleInjectorAdapter" href="http://nuget.org/packages/CommonServiceLocator.SimpleInjectorAdapter"&gt;CSL Adapter&lt;/a&gt; for the &lt;a title="Simple Injector" href="http://simpleinjector.codeplex.com"&gt;Simple Injector&lt;/a&gt; does not inherit form the ServiceLocatorImplBase. Although the behavior of the Simple Injector adapter correctly implements the IServiceProvider contract, it is still unusable, simply because &lt;span style="text-decoration: underline;"&gt;all other&lt;/span&gt; implementations break the contract.&lt;/p&gt;&lt;/div&gt;</description><author>dot_NET_junkie</author><pubDate>Mon, 30 Jul 2012 15:15:57 GMT</pubDate><guid isPermaLink="false">New Post: ServiceLocatorImplBase seems to break the contract of IServiceProvider 20120730031557P</guid></item><item><title>New Post: ServiceLocatorImplBase seems to break the contract of IServiceProvider</title><link>http://commonservicelocator.codeplex.com/discussions/389293</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;IServiceLocator extends the&amp;nbsp;BCL interface IServiceProvider. The IServiceProvider.GetService (Type) method is very similar to IServiceLocator.GetInstance (Type), therefore, ServiceLocatorImplBase's implementation of GetService simply delegates to GetInstance.&lt;/p&gt;
&lt;p&gt;However,&amp;nbsp;GetInstance is documented to never&amp;nbsp;return null (it must throw an ActivationException). GetService, on the other hand,
&lt;a href="http://msdn.microsoft.com/en-us/library/system.iserviceprovider.getservice(v=vs.90).aspx"&gt;
is documented to return null&lt;/a&gt; if there is no service object (no exceptions are documented).&lt;/p&gt;
&lt;p&gt;Therefore, it appears that ServiceLocatorImplBase, and with it probably nearly all implementations of IServiceLocator, break the IServiceProvider contract.&lt;/p&gt;
&lt;p&gt;Has this been discussed before? Can it still be fixed?&lt;/p&gt;
&lt;/div&gt;</description><author>FabianSchmied</author><pubDate>Fri, 27 Jul 2012 12:08:28 GMT</pubDate><guid isPermaLink="false">New Post: ServiceLocatorImplBase seems to break the contract of IServiceProvider 20120727120828P</guid></item><item><title>New Post: Are there plans to support Windsor Castle 3.0?</title><link>http://commonservicelocator.codeplex.com/discussions/356057</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Windsor Castle 3.0 was released in Dec 2011.&amp;nbsp; Are there any plans to update CommonServiceLocator.WindsorAdapter.dll to support Windsor Castle 3.0?&lt;/p&gt;
&lt;/div&gt;</description><author>ffoozle</author><pubDate>Wed, 16 May 2012 19:09:04 GMT</pubDate><guid isPermaLink="false">New Post: Are there plans to support Windsor Castle 3.0? 20120516070904P</guid></item><item><title>New Post: Portable version to support all platforms</title><link>http://commonservicelocator.codeplex.com/discussions/347703</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;I added an issue for this: &lt;a href="http://commonservicelocator.codeplex.com/workitem/15106"&gt;Portable version to support all platforms&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let's vote.&lt;/p&gt;&lt;/div&gt;</description><author>dot_NET_junkie</author><pubDate>Sat, 28 Apr 2012 14:05:11 GMT</pubDate><guid isPermaLink="false">New Post: Portable version to support all platforms 20120428020511P</guid></item><item><title>New Post: Portable version to support all platforms</title><link>http://commonservicelocator.codeplex.com/discussions/347703</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;+1&lt;/p&gt;&lt;/div&gt;</description><author>kyleburns</author><pubDate>Fri, 27 Apr 2012 12:20:06 GMT</pubDate><guid isPermaLink="false">New Post: Portable version to support all platforms 20120427122006P</guid></item><item><title>New Post: Portable version to support all platforms</title><link>http://commonservicelocator.codeplex.com/discussions/347703</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;+1&lt;/p&gt;&lt;/div&gt;</description><author>JimJams</author><pubDate>Thu, 08 Mar 2012 15:04:36 GMT</pubDate><guid isPermaLink="false">New Post: Portable version to support all platforms 20120308030436P</guid></item><item><title>New Post: Portable version to support all platforms</title><link>http://commonservicelocator.codeplex.com/discussions/347703</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;I wanted to propose using the new VS 11 Portable libraries to enable a single instance of the CommonServiceLocator to&amp;nbsp;work with .NET 4, SL4+, WP7.1+, WinRT and XBox 360.&lt;/p&gt;
&lt;p&gt;&lt;span style="color: black;"&gt;The only breaking change is that IServiceProvider has been removed from WinRT and so isn't available for portable libraries. From an API perspective, in my test build, I simply moved the single GetService method to the IServiceLocator interface instead.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Between using it as a Portable Library and the removal of IServiceProivder, the changes would warrant a version bump to 2.0 to prevent accidental conflicts. If you can get that built and put on to NuGet, it would enable you to have a single binary that all platforms can reference.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 11pt; color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;</description><author>onovotny</author><pubDate>Wed, 07 Mar 2012 18:04:15 GMT</pubDate><guid isPermaLink="false">New Post: Portable version to support all platforms 20120307060415P</guid></item><item><title>New Post: Update for the NuGet package for .NET 2 support ?</title><link>http://commonservicelocator.codeplex.com/discussions/258764</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;The current CommonServiceLocator package targets only specific framework versions NET35 &amp;amp; SL30.&lt;/p&gt;
&lt;p&gt;A project for .NET20 can't use the nuget package (quite ironic since the release provided here is only for .net 2)&lt;/p&gt;
&lt;/div&gt;</description><author>styx31</author><pubDate>Tue, 24 May 2011 08:48:45 GMT</pubDate><guid isPermaLink="false">New Post: Update for the NuGet package for .NET 2 support ? 20110524084845A</guid></item><item><title>New Post: Query methods</title><link>http://commonservicelocator.codeplex.com/Thread/View.aspx?ThreadId=44293</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Sounds like we might have messed up here. The idea of throwing an exception was an explicit design goal that we all agreed on. Making it implement IServiceProvider was more of a convenience, but sounds like this was overlooked. I imagine 90% or more of the
 people who use CSL don't use it as an IServiceProvider, however this is a good catch.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;</description><author>gblock</author><pubDate>Thu, 10 Feb 2011 19:46:52 GMT</pubDate><guid isPermaLink="false">New Post: Query methods 20110210074652P</guid></item></channel></rss>