From 70c8647b9b0d9677a38b157a022b1059bb56ae3b Mon Sep 17 00:00:00 2001 From: Mike Chu Date: Fri, 11 Aug 2023 09:43:16 -0400 Subject: [PATCH 1/6] Fix Rider-identified problems --- OptimizelySDK.DemoApp/Views/Shared/_Layout.cshtml | 8 ++++---- OptimizelySDK.sln | 3 --- OptimizelySDK/Config/HttpProjectConfigManager.cs | 11 +++-------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/OptimizelySDK.DemoApp/Views/Shared/_Layout.cshtml b/OptimizelySDK.DemoApp/Views/Shared/_Layout.cshtml index 6b43634ad..a8848d763 100644 --- a/OptimizelySDK.DemoApp/Views/Shared/_Layout.cshtml +++ b/OptimizelySDK.DemoApp/Views/Shared/_Layout.cshtml @@ -1,12 +1,12 @@ @{ /* - * Copyright 2017-2018, Optimizely + * Copyright 2017-2018, 2023 Optimizely * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,7 +17,7 @@ } - + @@ -37,7 +37,7 @@ @Html.ActionLink("Home", "Index", "Home", new { area = "" }, new { @class = "nav-link" }) diff --git a/OptimizelySDK.sln b/OptimizelySDK.sln index 66e8424c1..4fb4cac3a 100644 --- a/OptimizelySDK.sln +++ b/OptimizelySDK.sln @@ -16,10 +16,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject CHANGELOG.MD = CHANGELOG.MD CONTRIBUTING.md = CONTRIBUTING.md - OptimizelySDK.Package\OptimizelySDK.nuspec = OptimizelySDK.Package\OptimizelySDK.nuspec - OptimizelySDK.Package\pack.ps1 = OptimizelySDK.Package\pack.ps1 README.md = README.md - OptimizelySDK.Package\verifysn.ps1 = OptimizelySDK.Package\verifysn.ps1 keypair.snk = keypair.snk EndProjectSection EndProject diff --git a/OptimizelySDK/Config/HttpProjectConfigManager.cs b/OptimizelySDK/Config/HttpProjectConfigManager.cs index fecd0a92c..6decb2bfe 100644 --- a/OptimizelySDK/Config/HttpProjectConfigManager.cs +++ b/OptimizelySDK/Config/HttpProjectConfigManager.cs @@ -19,6 +19,7 @@ #endif using System; +using System.Linq; using System.Net; using System.Threading.Tasks; using OptimizelySDK.ErrorHandler; @@ -179,7 +180,7 @@ private string GetRemoteDatafileResponse() } var lastModified = result.Headers.GetValues("Last-Modified"); - if (!string.IsNullOrEmpty(lastModified.First())) + if (!string.IsNullOrEmpty(lastModified?.First())) { LastModifiedSince = lastModified.First(); } @@ -201,12 +202,7 @@ protected override ProjectConfig Poll() { var datafile = GetRemoteDatafileResponse(); - if (datafile == null) - { - return null; - } - - return DatafileProjectConfig.Create(datafile, Logger, ErrorHandler); + return datafile == null ? null : DatafileProjectConfig.Create(datafile, Logger, ErrorHandler); } public class Builder @@ -234,7 +230,6 @@ public class Builder private bool StartByDefault = true; private NotificationCenter NotificationCenter; - private bool IsBlockingTimeoutProvided = false; private bool IsPollingIntervalProvided = false; From 547afb368b4d7e3050685bd87dfdc8442283037a Mon Sep 17 00:00:00 2001 From: Mike Chu Date: Fri, 11 Aug 2023 11:06:35 -0400 Subject: [PATCH 2/6] Fix invalid AssemblyFileVersion as noted by GitHub --- OptimizelySDK.Net35/Properties/AssemblyInfo.cs | 2 +- OptimizelySDK.Net40/Properties/AssemblyInfo.cs | 2 +- OptimizelySDK.NetStandard16/Properties/AssemblyInfo.cs | 2 +- OptimizelySDK.NetStandard20/Properties/AssemblyInfo.cs | 2 +- OptimizelySDK.Tests/Properties/AssemblyInfo.cs | 2 +- OptimizelySDK/Properties/AssemblyInfo.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OptimizelySDK.Net35/Properties/AssemblyInfo.cs b/OptimizelySDK.Net35/Properties/AssemblyInfo.cs index c30032e87..69b04e7f4 100644 --- a/OptimizelySDK.Net35/Properties/AssemblyInfo.cs +++ b/OptimizelySDK.Net35/Properties/AssemblyInfo.cs @@ -38,5 +38,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0-beta")] +[assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0-beta")] // Used by Nuget. diff --git a/OptimizelySDK.Net40/Properties/AssemblyInfo.cs b/OptimizelySDK.Net40/Properties/AssemblyInfo.cs index 2cd7b68ac..c3e01c002 100644 --- a/OptimizelySDK.Net40/Properties/AssemblyInfo.cs +++ b/OptimizelySDK.Net40/Properties/AssemblyInfo.cs @@ -38,5 +38,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0-beta")] +[assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0-beta")] // Used by Nuget. diff --git a/OptimizelySDK.NetStandard16/Properties/AssemblyInfo.cs b/OptimizelySDK.NetStandard16/Properties/AssemblyInfo.cs index 9c98ed60b..7ba7db50d 100644 --- a/OptimizelySDK.NetStandard16/Properties/AssemblyInfo.cs +++ b/OptimizelySDK.NetStandard16/Properties/AssemblyInfo.cs @@ -38,5 +38,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("4.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0-beta")] +[assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0-beta")] // Used by Nuget. diff --git a/OptimizelySDK.NetStandard20/Properties/AssemblyInfo.cs b/OptimizelySDK.NetStandard20/Properties/AssemblyInfo.cs index 3b263f575..e493466c5 100644 --- a/OptimizelySDK.NetStandard20/Properties/AssemblyInfo.cs +++ b/OptimizelySDK.NetStandard20/Properties/AssemblyInfo.cs @@ -38,5 +38,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0-beta")] +[assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0-beta")] // Used by Nuget. diff --git a/OptimizelySDK.Tests/Properties/AssemblyInfo.cs b/OptimizelySDK.Tests/Properties/AssemblyInfo.cs index 4396ff816..8ceae6071 100644 --- a/OptimizelySDK.Tests/Properties/AssemblyInfo.cs +++ b/OptimizelySDK.Tests/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0-beta")] +[assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0-beta")] // Used by Nuget. diff --git a/OptimizelySDK/Properties/AssemblyInfo.cs b/OptimizelySDK/Properties/AssemblyInfo.cs index 44e9e2ce8..07e29d0ab 100644 --- a/OptimizelySDK/Properties/AssemblyInfo.cs +++ b/OptimizelySDK/Properties/AssemblyInfo.cs @@ -42,5 +42,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0-beta")] +[assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0-beta")] // Used by Nuget. From b051a2bc84fdd825d3e975b2c2787e3e0186d9a0 Mon Sep 17 00:00:00 2001 From: Mike Chu Date: Fri, 11 Aug 2023 11:06:49 -0400 Subject: [PATCH 3/6] Remove unused field --- OptimizelySDK/OptimizelyDecisionContext.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OptimizelySDK/OptimizelyDecisionContext.cs b/OptimizelySDK/OptimizelyDecisionContext.cs index 69b1d6f80..39c06143b 100644 --- a/OptimizelySDK/OptimizelyDecisionContext.cs +++ b/OptimizelySDK/OptimizelyDecisionContext.cs @@ -27,7 +27,6 @@ public class OptimizelyDecisionContext private string flagKey; private string ruleKey; - private string decisionKey; /// /// Represents the object is valid or not. From e8ea5e239bc8a8e7f627e490ac59fe4e5b32c468 Mon Sep 17 00:00:00 2001 From: Mike Chu Date: Fri, 11 Aug 2023 14:27:40 -0400 Subject: [PATCH 4/6] Remove App_Data from proj --- OptimizelySDK.DemoApp/OptimizelySDK.DemoApp.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/OptimizelySDK.DemoApp/OptimizelySDK.DemoApp.csproj b/OptimizelySDK.DemoApp/OptimizelySDK.DemoApp.csproj index 0f0c0d62b..002814e67 100644 --- a/OptimizelySDK.DemoApp/OptimizelySDK.DemoApp.csproj +++ b/OptimizelySDK.DemoApp/OptimizelySDK.DemoApp.csproj @@ -249,9 +249,6 @@ - - - From 5f6f190e76491fd0c9f7efd75d2285166839b4f0 Mon Sep 17 00:00:00 2001 From: Mike Chu Date: Mon, 14 Aug 2023 09:39:49 -0400 Subject: [PATCH 5/6] Upgrade Newtonsoft.Json for vulnerability in Demo & Test projs Now matching other projs at 13.0.2 --- .../OptimizelySDK.DemoApp.csproj | 3 +-- OptimizelySDK.DemoApp/packages.config | 2 +- OptimizelySDK.Tests/App.config | 27 ++++++------------- OptimizelySDK.Tests/packages.config | 16 +++++------ 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/OptimizelySDK.DemoApp/OptimizelySDK.DemoApp.csproj b/OptimizelySDK.DemoApp/OptimizelySDK.DemoApp.csproj index 002814e67..e8c284ff7 100644 --- a/OptimizelySDK.DemoApp/OptimizelySDK.DemoApp.csproj +++ b/OptimizelySDK.DemoApp/OptimizelySDK.DemoApp.csproj @@ -65,8 +65,7 @@ True - ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - True + ..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll diff --git a/OptimizelySDK.DemoApp/packages.config b/OptimizelySDK.DemoApp/packages.config index e13f02457..1592587b7 100644 --- a/OptimizelySDK.DemoApp/packages.config +++ b/OptimizelySDK.DemoApp/packages.config @@ -15,7 +15,7 @@ - + diff --git a/OptimizelySDK.Tests/App.config b/OptimizelySDK.Tests/App.config index 3d6d54127..f71b66487 100644 --- a/OptimizelySDK.Tests/App.config +++ b/OptimizelySDK.Tests/App.config @@ -6,26 +6,15 @@ -
+
- + - + @@ -36,16 +25,16 @@ - - + + - - + + - + diff --git a/OptimizelySDK.Tests/packages.config b/OptimizelySDK.Tests/packages.config index 166ddc9d0..58fe9574f 100644 --- a/OptimizelySDK.Tests/packages.config +++ b/OptimizelySDK.Tests/packages.config @@ -1,10 +1,10 @@  - - - - - - - - + + + + + + + + \ No newline at end of file From 9954086e16f4576a81ac13e2adef9f9dcbc1d414 Mon Sep 17 00:00:00 2001 From: Mike Chu Date: Tue, 15 Aug 2023 17:28:41 -0400 Subject: [PATCH 6/6] Code review changes --- OptimizelySDK.Tests/packages.config | 2 +- OptimizelySDK/Config/HttpProjectConfigManager.cs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/OptimizelySDK.Tests/packages.config b/OptimizelySDK.Tests/packages.config index 58fe9574f..4d51a3f44 100644 --- a/OptimizelySDK.Tests/packages.config +++ b/OptimizelySDK.Tests/packages.config @@ -7,4 +7,4 @@ - \ No newline at end of file + diff --git a/OptimizelySDK/Config/HttpProjectConfigManager.cs b/OptimizelySDK/Config/HttpProjectConfigManager.cs index 6decb2bfe..a3f510521 100644 --- a/OptimizelySDK/Config/HttpProjectConfigManager.cs +++ b/OptimizelySDK/Config/HttpProjectConfigManager.cs @@ -202,7 +202,12 @@ protected override ProjectConfig Poll() { var datafile = GetRemoteDatafileResponse(); - return datafile == null ? null : DatafileProjectConfig.Create(datafile, Logger, ErrorHandler); + if (datafile == null) + { + return null; + } + + return DatafileProjectConfig.Create(datafile, Logger, ErrorHandler); } public class Builder