Skip to content

Commit

Permalink
Fixed code analysis issues by updating DebuggerDisplay attributes to …
Browse files Browse the repository at this point in the history
…use properties directly instead of private methods.
  • Loading branch information
alexmg committed Jan 26, 2014
1 parent 7d0485e commit 25e3bb1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace Autofac.Integration.Web
/// Provides an implementation of <see cref="Autofac.IContainer"/> which uses the configured
/// <see cref="IContainerProvider"/> to route calls to the current request container.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay()}")]
[DebuggerDisplay("Tag = {Tag}")]
[SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "Disposing of this wrapper container should not result in the whole application container being disposed.")]
public class ContainerProviderContainer : IContainer
{
Expand Down Expand Up @@ -200,10 +200,5 @@ public object ResolveComponent(IComponentRegistration registration, IEnumerable<
public void Dispose()
{
}

string DebuggerDisplay()
{
return Tag.ToString();
}
}
}
7 changes: 1 addition & 6 deletions Core/Source/Autofac/Core/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Autofac.Core
/// <summary>
/// Standard container implementation.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay()}")]
[DebuggerDisplay("Tag = {Tag}, IsDisposed = {IsDisposed}")]
public class Container : Disposable, IContainer, IServiceProvider
{
readonly IComponentRegistry _componentRegistry;
Expand Down Expand Up @@ -211,10 +211,5 @@ public object GetService(Type serviceType)
{
return ((IServiceProvider)_rootLifetimeScope).GetService(serviceType);
}

string DebuggerDisplay()
{
return Tag.ToString();
}
}
}
8 changes: 1 addition & 7 deletions Core/Source/Autofac/Core/Lifetime/LifetimeScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Autofac.Core.Lifetime
/// <summary>
/// Lifetime scope implementation.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay()}")]
[DebuggerDisplay("Tag = {Tag}, IsDisposed = {IsDisposed}")]
public class LifetimeScope : Disposable, ISharingLifetimeScope, IServiceProvider
{
/// <summary>
Expand Down Expand Up @@ -355,11 +355,5 @@ public object GetService(Type serviceType)
/// Fired when a resolve operation is beginning in this scope.
/// </summary>
public event EventHandler<ResolveOperationBeginningEventArgs> ResolveOperationBeginning;


string DebuggerDisplay()
{
return Tag.ToString();
}
}
}
35 changes: 27 additions & 8 deletions Extras/Source/Autofac.Extras.Multitenant/MultitenantContainer.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
using System;
// This software is part of the Autofac IoC container
// Copyright © 2014 Autofac Contributors
// http://autofac.org
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Autofac;
using Autofac.Core;
using Autofac.Core.Lifetime;
using Autofac.Core.Resolving;
Expand Down Expand Up @@ -49,7 +73,7 @@ namespace Autofac.Extras.Multitenant
/// </para>
/// </remarks>
/// <seealso cref="Autofac.Extras.Multitenant.ConfigurationActionBuilder"/>
[DebuggerDisplay("{DebuggerDisplay()}")]
[DebuggerDisplay("Tag = {Tag}, IsDisposed = {IsDisposed}")]
public class MultitenantContainer : Disposable, IContainer
{
/// <summary>
Expand Down Expand Up @@ -420,10 +444,5 @@ public object ResolveComponent(IComponentRegistration registration, IEnumerable<
{
return this.GetCurrentTenantScope().ResolveComponent(registration, parameters);
}

string DebuggerDisplay()
{
return Tag.ToString();
}
}
}

0 comments on commit 25e3bb1

Please sign in to comment.