Skip to content

Commit

Permalink
Remove dead code from Composition.Hosting (dotnet#35131)
Browse files Browse the repository at this point in the history
  • Loading branch information
hughbe authored and stephentoub committed Feb 7, 2019
1 parent a27099d commit 4d18056
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 20 deletions.
6 changes: 0 additions & 6 deletions src/System.Composition.Hosting/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,6 @@
<data name="Formatter_ListSeparatorWithSpace" xml:space="preserve">
<value>, </value>
</data>
<data name="Dependency_Not_In_Error_State" xml:space="preserve">
<value>Dependency is not in an error state.</value>
</data>
<data name="Sharing_Lock_Required" xml:space="preserve">
<value>Sharing lock is required</value>
</data>
<data name="Sharing_Lock_Taken" xml:space="preserve">
<value>Sharing lock already taken in this operation.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Composition.Hosting.Providers.ExportFactory;
using System.Composition.Hosting.Providers.ImportMany;
using System.Composition.Hosting.Providers.Lazy;
using System.Diagnostics;
using System.Linq;

namespace System.Composition.Hosting
Expand All @@ -24,11 +25,7 @@ public sealed class CompositionHost : CompositionContext, IDisposable

private CompositionHost(LifetimeContext rootLifetimeContext)
{
if(rootLifetimeContext == null)
{
throw new ArgumentNullException(nameof(rootLifetimeContext));
}

Debug.Assert(rootLifetimeContext != null);
_rootLifetimeContext = rootLifetimeContext;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System.Collections.Generic;
using System.Composition.Hosting.Util;
using System.Diagnostics;
using System.Linq;
using System.Text;

Expand Down Expand Up @@ -168,10 +169,7 @@ public override string ToString()

internal void DescribeError(StringBuilder message)
{
if(!IsError)
{
throw new Exception(SR.Dependency_Not_In_Error_State);
}
Debug.Assert(IsError, "Should be in error state.");

if (_oversuppliedTargets != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;

namespace System.Composition.Hosting.Core
Expand Down Expand Up @@ -84,10 +85,7 @@ public void AddPostCompositionAction(Action action)

internal void EnterSharingLock(object sharingLock)
{
if (sharingLock == null)
{
throw new ArgumentException(SR.Sharing_Lock_Required);
}
Debug.Assert(sharingLock != null, "Expected a sharing lock to be passed.");

if (_sharingLock == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace System.Composition.Hosting.Providers.Metadata
{
internal static class MetadataViewProvider
{
private static readonly MethodInfo s_getMetadataValueMethod = typeof(MetadataViewProvider).GetTypeInfo().GetDeclaredMethod("GetMetadataValue");
private static readonly MethodInfo s_getMetadataValueMethod = typeof(MetadataViewProvider).GetTypeInfo().GetDeclaredMethod(nameof(GetMetadataValue));

// While not called through the composition pipeline, we use the dependency mechanism to surface errors
// with appropriate context information.
Expand Down

0 comments on commit 4d18056

Please sign in to comment.