<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>
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
private CompositionHost(LifetimeContext rootLifetimeContext)
{
- if(rootLifetimeContext == null)
- {
- throw new ArgumentNullException(nameof(rootLifetimeContext));
- }
-
+ Debug.Assert(rootLifetimeContext != null);
_rootLifetimeContext = rootLifetimeContext;
}
using System.Collections.Generic;
using System.Composition.Hosting.Util;
+using System.Diagnostics;
using System.Linq;
using System.Text;
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)
{
// 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
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)
{
{
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.