Skip to content

Commit

Permalink
Resolves 1793 build warnings in Library project (dnnsoftware#4204)
Browse files Browse the repository at this point in the history
* Resolves 1793 build warnings in DotNetNuke.Collections

This PR covers pretty much all the Collections folder. I am no expert in this area, so any feedback on the documentation is welcome

* Update DNN Platform/Library/Collections/LockingStrategy.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Collections/MonitorLock.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Collections/MonitorLock.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Collections/NaiveLockingList.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Collections/NaiveLockingList.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Collections/SharedList.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Common/Lists/CachedCountryList.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Common/Lists/ListInfo.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Common/NavigationManager.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Common/ServiceScopeContainer.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Collections/ReaderWriterSlimLock.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Update DNN Platform/Library/Collections/SharedDictionary.cs

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>

* Implemented CLSCompliant attribute on DotNetNuke.Abstractions and DotNetNuke.DependencyInjection

* Marked IDNNStartup as not CSL Compliant

* Update DNN Platform/Library/Services/Journal/JournalControllerImpl.cs

Co-authored-by: David Poindexter <dpoindexter@nvisionative.com>

* Update DNN Platform/Library/Services/Scheduling/DNNScheduler.cs

Co-authored-by: David Poindexter <dpoindexter@nvisionative.com>

* Update DNN Platform/Library/Services/Search/Internals/LuceneControllerImpl.cs

Co-authored-by: David Poindexter <dpoindexter@nvisionative.com>

Co-authored-by: Brian Dukes <bdukes@engagesoftware.com>
Co-authored-by: David Poindexter <dpoindexter@nvisionative.com>
  • Loading branch information
3 people authored Oct 18, 2020
1 parent 621ba3a commit a37c4f8
Show file tree
Hide file tree
Showing 591 changed files with 11,211 additions and 6,828 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

using System;

[assembly: CLSCompliant(true)]
42 changes: 23 additions & 19 deletions DNN Platform/DotNetNuke.DependencyInjection/IDnnStartup.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.DependencyInjection
{
using Microsoft.Extensions.DependencyInjection;
namespace DotNetNuke.DependencyInjection
{
using System;

/// <summary>
/// An interface for adding extension points to the DNN Startup Logic.
/// </summary>
public interface IDnnStartup
{
/// <summary>
/// Configure additional services for the host or web application.
/// This method will be called during the Application Startup phase
/// and services will be available anywhere in the application.
/// </summary>
/// <param name="services">
/// Service Collection used to registering services in the container.
/// </param>
void ConfigureServices(IServiceCollection services);
}
}
using Microsoft.Extensions.DependencyInjection;

/// <summary>
/// An interface for adding extension points to the DNN Startup Logic.
/// </summary>
[CLSCompliant(false)]
public interface IDnnStartup
{
/// <summary>
/// Configure additional services for the host or web application.
/// This method will be called during the Application Startup phase
/// and services will be available anywhere in the application.
/// </summary>
/// <param name="services">
/// Service Collection used to registering services in the container.
/// </param>
[CLSCompliant(false)]
void ConfigureServices(IServiceCollection services);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

using System;

[assembly: CLSCompliant(true)]
1 change: 0 additions & 1 deletion DNN Platform/Library/Collections/IIndexable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace DotNetNuke.Collections
{

/// <summary>
/// This interface is used to make a class indexable.
/// </summary>
Expand Down
11 changes: 7 additions & 4 deletions DNN Platform/Library/Collections/ISharedCollectionLock.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Collections.Internal
{
namespace DotNetNuke.Collections.Internal
{
using System;

public interface ISharedCollectionLock : IDisposable
/// <summary>
/// Represents a shared collection lock.
/// </summary>
public interface ISharedCollectionLock : IDisposable
{
}
}
}
24 changes: 16 additions & 8 deletions DNN Platform/Library/Collections/LockingStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace DotNetNuke.Collections.Internal
{
public enum LockingStrategy
{
ReaderWriter = 0,
Exclusive,
}
}
namespace DotNetNuke.Collections.Internal
{
/// <summary>Represents a locking strategy.</summary>
public enum LockingStrategy
{
/// <summary>
/// A read/write locking strategy.
/// </summary>
ReaderWriter = 0,

/// <summary>
/// An exclusive strategy.
/// </summary>
Exclusive,
}
}
50 changes: 29 additions & 21 deletions DNN Platform/Library/Collections/LockingStrategyFactory.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Collections.Internal
{
namespace DotNetNuke.Collections.Internal
{
using System;

internal class LockingStrategyFactory
{
public static ILockStrategy Create(LockingStrategy strategy)
{
switch (strategy)
{
case LockingStrategy.ReaderWriter:

return new ReaderWriterLockStrategy();
case LockingStrategy.Exclusive:

return new ExclusiveLockStrategy();
default:

throw new ArgumentOutOfRangeException();
}
}
}
}
/// <summary>
/// Factory class for LockingStrategies.
/// </summary>
internal class LockingStrategyFactory
{
/// <summary>
/// Creates a new locking strategy.
/// </summary>
/// <param name="strategy">The <see cref="LockingStrategy"/> to instantiate.</param>
/// <returns>An instance of <see cref="ILockStrategy"/> that uses the specified strategy.</returns>
public static ILockStrategy Create(LockingStrategy strategy)
{
switch (strategy)
{
case LockingStrategy.ReaderWriter:

return new ReaderWriterLockStrategy();
case LockingStrategy.Exclusive:

return new ExclusiveLockStrategy();
default:

throw new ArgumentOutOfRangeException();
}
}
}
}
84 changes: 48 additions & 36 deletions DNN Platform/Library/Collections/MonitorLock.cs
Original file line number Diff line number Diff line change
@@ -1,41 +1,53 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Collections.Internal
{
namespace DotNetNuke.Collections.Internal
{
using System;

internal class MonitorLock : IDisposable, ISharedCollectionLock
{
private ExclusiveLockStrategy _lockStrategy;

// To detect redundant calls
private bool _isDisposed;

public MonitorLock(ExclusiveLockStrategy lockStrategy)
{
this._lockStrategy = lockStrategy;
}

public void Dispose()
{
// Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
this.Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (!this._isDisposed)
{
if (disposing)
{
this._lockStrategy.Exit();
this._lockStrategy = null;
}
}

this._isDisposed = true;
}
}
}
/// <summary>
/// An <see cref="ISharedCollectionLock"/> implementation which uses an <see cref="ExclusiveLockStrategy"/>.
/// </summary>
internal class MonitorLock : IDisposable, ISharedCollectionLock
{
private ExclusiveLockStrategy lockStrategy;

// To detect redundant calls
private bool isDisposed;

/// <summary>
/// Initializes a new instance of the <see cref="MonitorLock"/> class.
/// </summary>
/// <param name="lockStrategy">An <see cref="ExclusiveLockStrategy"/> instance to use.</param>
public MonitorLock(ExclusiveLockStrategy lockStrategy)
{
this.lockStrategy = lockStrategy;
}

/// <inheritdoc/>
public void Dispose()
{
// Do not change this code. Put cleanup code in Dispose(bool disposing) below.
this.Dispose(true);
GC.SuppressFinalize(this);
}

/// <summary>
/// Releases resources before final disposal.
/// </summary>
/// <param name="disposing">A value indicating if the instance is currently beeing disposed.</param>
protected virtual void Dispose(bool disposing)
{
if (!this.isDisposed)
{
if (disposing)
{
this.lockStrategy.Exit();
this.lockStrategy = null;
}
}

this.isDisposed = true;
}
}
}
Loading

0 comments on commit a37c4f8

Please sign in to comment.