From ea6c4663237b616c7d0448cdfd69a025438f2ebd Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 16 May 2018 10:06:51 +0200 Subject: [PATCH] Fixes up some warnings --- .../CtorInvokeBenchmarks.cs | 2 +- .../Services/ThreadSafetyServiceTest.cs | 32 +++++++++---------- src/Umbraco.Tests/Testing/UmbracoTestBase.cs | 2 +- .../UmbracoExamine/ExamineBaseTest.cs | 13 ++++++-- .../Packages/DirectoryBrowser.aspx.cs | 2 +- .../Application/UmbracoApplicationActions.js | 7 +--- .../Application/UmbracoClientManager.js | 6 +--- .../Application/UmbracoUtils.js | 4 +-- .../umbraco_client/modal/modal.js | 4 +-- .../Editors/ContentTypeControllerBase.cs | 19 ++++------- 10 files changed, 42 insertions(+), 49 deletions(-) diff --git a/src/Umbraco.Tests.Benchmarks/CtorInvokeBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/CtorInvokeBenchmarks.cs index 77d20e2e62..4855b161df 100644 --- a/src/Umbraco.Tests.Benchmarks/CtorInvokeBenchmarks.cs +++ b/src/Umbraco.Tests.Benchmarks/CtorInvokeBenchmarks.cs @@ -40,7 +40,7 @@ namespace Umbraco.Tests.Benchmarks private Func _expressionMethod4; private Func _emittedCtor; - [Setup] + [GlobalSetup] public void Setup() { var ctorArgTypes = new[] { typeof(IFoo) }; diff --git a/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs b/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs index ae6a54e8e0..984de8d182 100644 --- a/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs +++ b/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs @@ -74,22 +74,22 @@ namespace Umbraco.Tests.Services // comment out to trace locks return done; - new Thread(() => - { - using (var scope = ScopeProvider.CreateScope()) - while (done.IsSet == false) - { - var db = scope.Database; - var info = db.Query("SELECT * FROM sys.lock_information;"); - Console.WriteLine("LOCKS:"); - foreach (var row in info) - { - Console.WriteLine("> " + row.request_spid + " " + row.resource_type + " " + row.resource_description + " " + row.request_mode + " " + row.resource_table + " " + row.resource_table_id + " " + row.request_status); - } - Thread.Sleep(50); - } - }).Start(); - return done; + //new Thread(() => + //{ + // using (var scope = ScopeProvider.CreateScope()) + // while (done.IsSet == false) + // { + // var db = scope.Database; + // var info = db.Query("SELECT * FROM sys.lock_information;"); + // Console.WriteLine("LOCKS:"); + // foreach (var row in info) + // { + // Console.WriteLine("> " + row.request_spid + " " + row.resource_type + " " + row.resource_description + " " + row.request_mode + " " + row.resource_table + " " + row.resource_table_id + " " + row.request_status); + // } + // Thread.Sleep(50); + // } + //}).Start(); + //return done; } [Test] diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs index 2f00d065cd..b5f3de72a4 100644 --- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs +++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs @@ -94,7 +94,7 @@ namespace Umbraco.Tests.Testing protected IProfiler Profiler => Container.GetInstance(); - protected ProfilingLogger ProfilingLogger => Container.GetInstance(); + protected virtual ProfilingLogger ProfilingLogger => Container.GetInstance(); protected CacheHelper CacheHelper => Container.GetInstance(); diff --git a/src/Umbraco.Tests/UmbracoExamine/ExamineBaseTest.cs b/src/Umbraco.Tests/UmbracoExamine/ExamineBaseTest.cs index 4016510f40..ef51a9e071 100644 --- a/src/Umbraco.Tests/UmbracoExamine/ExamineBaseTest.cs +++ b/src/Umbraco.Tests/UmbracoExamine/ExamineBaseTest.cs @@ -20,10 +20,17 @@ namespace Umbraco.Tests.UmbracoExamine public void InitializeFixture() { var logger = new Logger(new FileInfo(TestHelper.MapPathForTest("~/unit-test-log4net.config"))); - ProfilingLogger = new ProfilingLogger(logger, new LogProfiler(logger)); + _profilingLogger = new ProfilingLogger(logger, new LogProfiler(logger)); + } + + private ProfilingLogger _profilingLogger; + protected override ProfilingLogger ProfilingLogger + { + get + { + return _profilingLogger; + } } - - protected ProfilingLogger ProfilingLogger { get; private set; } /// /// sets up resolvers before resolution is frozen diff --git a/src/Umbraco.Web.UI/umbraco/developer/Packages/DirectoryBrowser.aspx.cs b/src/Umbraco.Web.UI/umbraco/developer/Packages/DirectoryBrowser.aspx.cs index 6be42a0ad9..5166bb7dc6 100644 --- a/src/Umbraco.Web.UI/umbraco/developer/Packages/DirectoryBrowser.aspx.cs +++ b/src/Umbraco.Web.UI/umbraco/developer/Packages/DirectoryBrowser.aspx.cs @@ -93,7 +93,7 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Packages { _sb.Append("" + oDir.Name + " (Include entire folder)"); } - catch (Exception ex) + catch (Exception) { _sb.Append("" + oDir.Name + " (Access Denied)"); } diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js index 0fc433a98e..5abf321d74 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js +++ b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js @@ -1,9 +1,4 @@ -/// -/// -/// -/// - -Umbraco.Sys.registerNamespace("Umbraco.Application"); +Umbraco.Sys.registerNamespace("Umbraco.Application"); Umbraco.Application.Actions = function() { /// diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js index d9f9402f1c..8bfa00aa7f 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js +++ b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js @@ -1,8 +1,4 @@ -/// -/// -/// - -Umbraco.Sys.registerNamespace("Umbraco.Application"); +Umbraco.Sys.registerNamespace("Umbraco.Application"); (function($) { Umbraco.Application.ClientManager = function() { diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoUtils.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoUtils.js index 3752d2e24e..fa1ac17915 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoUtils.js +++ b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoUtils.js @@ -1,4 +1,4 @@ -/// +/// Umbraco.Sys.registerNamespace("Umbraco.Utils"); @@ -8,4 +8,4 @@ Umbraco.Utils.generateRandom = function() { var z = day.getTime(); var y = (z - (parseInt(z / 1000, 10) * 1000)) / 10; return y; -} \ No newline at end of file +} diff --git a/src/Umbraco.Web.UI/umbraco_client/modal/modal.js b/src/Umbraco.Web.UI/umbraco_client/modal/modal.js index d792352355..87c4e4bdff 100644 --- a/src/Umbraco.Web.UI/umbraco_client/modal/modal.js +++ b/src/Umbraco.Web.UI/umbraco_client/modal/modal.js @@ -1,4 +1,4 @@ -/// +/// Umbraco.Sys.registerNamespace("Umbraco.Controls"); @@ -399,4 +399,4 @@ hs = function(w, t, c) { }); }); }; -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs b/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs index 030d59de8f..35ae95a069 100644 --- a/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs +++ b/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs @@ -157,7 +157,7 @@ namespace Umbraco.Web.Editors if (ModelState.IsValid == false) { - throw CreateModelStateValidationException(ctId, contentTypeSave, ct); + throw CreateModelStateValidationException(ctId, contentTypeSave, ct); } //filter out empty properties @@ -178,7 +178,7 @@ namespace Umbraco.Web.Editors } catch (Exception ex) { - var responseEx = CreateInvalidCompositionResponseException(ex, contentTypeSave, ct, ctId); + var responseEx = CreateInvalidCompositionResponseException(ex, contentTypeSave, ct, ctId); if (responseEx != null) throw responseEx; } @@ -215,7 +215,7 @@ namespace Umbraco.Web.Editors } catch (Exception ex) { - var responseEx = CreateInvalidCompositionResponseException(ex, contentTypeSave, ct, ctId); + var responseEx = CreateInvalidCompositionResponseException(ex, contentTypeSave, ct, ctId); if (responseEx != null) throw responseEx; } @@ -247,11 +247,10 @@ namespace Umbraco.Web.Editors /// /// /// - protected HttpResponseMessage PerformMove( + protected HttpResponseMessage PerformMove( MoveOrCopy move, Func getContentType, Func>> doMove) - where TContentType : IContentTypeComposition { var toMove = getContentType(move.Id); if (toMove == null) @@ -382,7 +381,6 @@ namespace Umbraco.Web.Editors /// If the exception is an InvalidCompositionException create a response exception to be thrown for validation errors /// /// - /// /// /// /// @@ -390,9 +388,8 @@ namespace Umbraco.Web.Editors /// /// /// - private HttpResponseException CreateInvalidCompositionResponseException( + private HttpResponseException CreateInvalidCompositionResponseException( Exception ex, TContentTypeSave contentTypeSave, TContentType ct, int ctId) - where TContentType : class, IContentTypeComposition where TContentTypeDisplay : ContentTypeCompositionDisplay where TContentTypeSave : ContentTypeSave where TPropertyType : PropertyTypeBasic @@ -409,7 +406,7 @@ namespace Umbraco.Web.Editors if (invalidCompositionException != null) { AddCompositionValidationErrors(contentTypeSave, invalidCompositionException.PropertyTypeAliases); - return CreateModelStateValidationException(ctId, contentTypeSave, ct); + return CreateModelStateValidationException(ctId, contentTypeSave, ct); } return null; } @@ -418,13 +415,11 @@ namespace Umbraco.Web.Editors /// Used to throw the ModelState validation results when the ModelState is invalid /// /// - /// /// /// /// /// - private HttpResponseException CreateModelStateValidationException(int ctId, TContentTypeSave contentTypeSave, TContentType ct) - where TContentType : class, IContentTypeComposition + private HttpResponseException CreateModelStateValidationException(int ctId, TContentTypeSave contentTypeSave, TContentType ct) where TContentTypeDisplay : ContentTypeCompositionDisplay where TContentTypeSave : ContentTypeSave {