Another breath-taking bugfix.

Another breath-taking bugfix.

--- informant-core/Fetcher.cs
+++ informant-core/Fetcher.cs
@@ -171,6 +171,7 @@
             comp = comp.Replace(" ", string.Empty);
             //TO-DO: Parse VPlan
             int stringcnt = 5;
+			bool silentLast = false;
             if (!silent)
                 del();
             string haystack = comp;
@@ -277,10 +278,12 @@
                     else
                     {
                         if (!silent) refreshOne(new Data());
+						if (iOuter == (stringcnt - 1))
+							silentLast = true;
                     }
                 }
                 iOuter++;
-                if (iOuter == stringcnt && daysRec == 1 && mode != 0)
+				if (iOuter == stringcnt && (daysRec == 1 || silentLast) && mode != 0)
                 {
                     getTimes(Group, true);
                     globData = v1;


Optimize Span.Clear() on AMD64 (#10110)

Optimize Span.Clear() on AMD64 (#10110)

* optimize Span.Clear() by using initblk

--- src/mscorlib/src/System/Span.cs
+++ src/mscorlib/src/System/Span.cs
@@ -612,7 +612,13 @@
         {
             if (byteLength == 0)
                 return;
-
+
+#if AMD64
+            if (byteLength > 4096) goto PInvoke;
+            Unsafe.InitBlockUnaligned(ref b, 0, (uint)byteLength);
+            return;
+#endif // AMD64
+            // TODO: Optimize this method on X86 machine
             // Note: It's important that this switch handles lengths at least up to 22.
             // See notes below near the main loop for why.


tighten access to user account properties

--- BrockAllen.MembershipReboot/Models/UserAccount.cs
+++ BrockAllen.MembershipReboot/Models/UserAccount.cs
@@ -37,7 +37,7 @@
         [Key]
         [Column(Order=1)]
         [StringLength(50)]
-        public virtual string Tenant { get; set; }
+        public virtual string Tenant { get; private set; }
         [Key]
         [Column(Order = 2)]
         [StringLength(100)]
@@ -51,7 +51,7 @@

         public virtual bool IsAccountVerified { get; private set; }
         public virtual bool IsLoginAllowed { get; set; }
-        public virtual bool IsAccountClosed { get; set; }
+        public virtual bool IsAccountClosed { get; internal set; }

         public virtual DateTime? LastLogin { get; private set; }
         public virtual DateTime? LastFailedLogin { get; private set; }


Named fields

Named fields

--- DragonSpark/Compose/Model/OperationResultSelector.cs
+++ DragonSpark/Compose/Model/OperationResultSelector.cs
@@ -49,7 +49,7 @@
 			return result;
 		}

-		public new OperationResultSelector<_, (_, T)> Introduce()
+		public new OperationResultSelector<_, (_ In, T Out)> Introduce()
 			=> new DragonSpark.Model.Operations.Introduce<_, T>(Get()).Then();

 		public OperationResultSelector<_, TTo> Select<TTo>(Func<T, TTo> select)


manifest was in a wrong folder. Fixed.

manifest was in a wrong folder. Fixed.

--- ez-xl/ExcelWriter.cs
+++ ez-xl/ExcelWriter.cs
@@ -78,7 +78,7 @@
                     else
                     {
                         using (var outStream = entry.Open())
-                        using (var destStream = result.CreateEntry(entry.Name, CompressionLevel.Optimal).Open())
+                        using (var destStream = result.CreateEntry(entry.FullName, CompressionLevel.Optimal).Open())
                         {
                             outStream.CopyTo(destStream);
                         }


Remove unused variable - Fixes #191

Remove unused variable - Fixes #191

--- Assets/RedBlueGames/MulliganRenamer/Editor/SavePresetWindow.cs
+++ Assets/RedBlueGames/MulliganRenamer/Editor/SavePresetWindow.cs
@@ -39,7 +39,6 @@
         private bool textFieldNeedsFocus;
         private string enteredName;
         private List<string> existingPresetNames;
-        private Vector2 startingMinSize;

         /// <summary>
         /// Set the value for the name to edit.
@@ -69,7 +68,6 @@
         {
             this.existingPresetNames = new List<string>();
             this.textFieldNeedsFocus = true;
-            this.startingMinSize = this.minSize;
         }

         private void OnGUI()


fix when WaitForSeconds and in EditMode

fix when WaitForSeconds and in EditMode

--- Assets/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs
+++ Assets/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs
@@ -91,6 +91,7 @@
                         var accessor = typeof(WaitForSeconds).GetField("m_Seconds", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic);
                         var second = (float)accessor.GetValue(waitForSeconds);
                         queueWorker.Enqueue(() => ConsumeEnumerator(UnwrapWaitForSeconds(second, routine)));
+                        return;
                     }
                     else if (type == typeof(Coroutine))
                     {


Fixed bug where Click events weren't generated on "this" for IWindow.

--- FRBDK/Glue/Glue/CodeGeneration/EventCodeGenerator.cs
+++ FRBDK/Glue/Glue/CodeGeneration/EventCodeGenerator.cs
@@ -100,7 +100,7 @@
                 wasEventAdded = true;
             }

-            else if (string.IsNullOrEmpty(ers.SourceObject))
+            else if (string.IsNullOrEmpty(ers.SourceObject) || ers.SourceObject == "<NONE>")
             {

                 string leftSide = null;


Specify more path variables in cake script

--- build.cake
+++ build.cake
@@ -6,6 +6,7 @@
 #tool "nuget:?package=Codecov"

 GitVersion gitVersion;
+const string ArtifactsFolder = "./artifacts";
 const string CoverageReportXmlFile = "./artifacts/Stranne.VasttrafikNET_coverage.xml";
 const string CoverageReportFolder = "./artifacts/report";
 const string CoverageReportZipFile = "./artifacts/test-report.zip";
@@ -13,8 +14,8 @@
 Task("Clean")
     .Does(() =>
 {
-    EnsureDirectoryExists("./artifacts");
-    CleanDirectories("./artifacts");
+    EnsureDirectoryExists(ArtifactsFolder);
+    CleanDirectories(ArtifactsFolder);
 });

 Task("Version")
@@ -91,7 +92,7 @@
             .Append("/p:PackageVersion=" + gitVersion.MajorMinorPatch + gitVersion.PreReleaseTagWithDash),
         NoBuild = true,
         Configuration = "Release",
-        OutputDirectory = new DirectoryPath("./artifacts")
+        OutputDirectory = new DirectoryPath(ArtifactsFolder)
     });
 });

@@ -99,7 +100,7 @@
     .IsDependentOn("Create-Test-Report")
     .Does(() =>
 {
-    Zip("./artifacts/report", CoverageReportZipFile);
+    Zip(CoverageReportFolder, CoverageReportZipFile);
 });

 Task("Send-To-Codecov")


Explanatory comments

Explanatory comments

--- build.cake
+++ build.cake
@@ -405,17 +405,20 @@
         });
     });

+// Unlike other tasks, this one does not depend on creation of the
+// image directory. I think this is the direction we want to go
+// for all the different packages, but it's for a separate change.
 Task("PackageChocolatey")
 	.Description("Creates chocolatey packages of the console runner")
 	.Does(() =>
 	{
+	    // Using image dir just as a place to hold this one file for now
 		var currentImageDir = IMAGE_DIR + "NUnit-" + packageVersion + "/";

 		EnsureDirectoryExists(PACKAGE_DIR);

-		// Note: Since cake does not yet support a working directory and separate output directory for chocolatey, the following copying and hacks are needed.
-
 		// List with the extensions (name, version, primary dll) we are installing
+		// We need this to download the extensions and to produce the addins file
 		var extensions = new Tuple<string, string, string>[] {
 			new Tuple<string, string, string>(
 				"NUnit.Extension.VSProjectLoader",
@@ -480,6 +483,8 @@
 			new ChocolateyNuSpecContent { Source = BIN_DIR + "Mono.Cecil.dll", Target="tools" }
 		};

+		// Used for the creation of the package. Duplicates what is in the extensions
+		// structure, unfortunately. Should be changed.
 		var extensionContent = new []
 		{
 			new ChocolateyNuSpecContent { Source = BIN_DIR + "nunit.engine.addins", Target="tools" },


Add netstandard1.3 mapping to build.cake

--- build.cake
+++ build.cake
@@ -93,6 +93,7 @@
         var mapping = new Dictionary<String, String>
         {
             { "net46", "net46" },
+            { "netstandard1.3", "netstandard1.3" },
             { "netstandard2.0", "netstandard2.0" }
         };


chore: upload to coverall wip

chore: upload to coverall wip

--- build.cake
+++ build.cake
@@ -1,6 +1,7 @@
 #addin Cake.Coveralls

-#tool "nuget:?package=coveralls.io"
+#tool coveralls.net
+#tool coveralls.io
 #tool "nuget:?package=GitReleaseNotes"
 #tool "nuget:?package=GitVersion.CommandLine"
 // #tool "nuget:?package=gitlink"
@@ -111,7 +112,7 @@
     });

 Task("Test")
-    .IsDependentOn("Package")
+    // .IsDependentOn("Package")
     .Does(() => {
             OpenCover(tool => tool.DotNetCoreTest("./tests/AppVeyorPoc.Tests/project.json"),
                 new FilePath("./coverage.xml"),
@@ -123,14 +124,22 @@
                 .WithFilter("-[xunit*]*")
             );

-            if(BuildSystem.IsRunningOnAppVeyor)
+            var token = EnvironmentVariable("COVERALLS_REPO_TOKEN");
+            if(token != null)
             {
-                var token = EnvironmentVariable("COVERALLS_REPO_TOKEN");
+                Information("Pushing to coveralls.io");
+                // CoverallsNet("coverage.xml", CoverallsNetReportType.OpenCover, new CoverallsNetSettings()
+                // {
+                //     RepoToken = token
+                // });

-                CoverallsNet("coverage.xml", CoverallsNetReportType.OpenCover, new CoverallsNetSettings()
+                CoverallsIo("coverage.xml", new CoverallsIoSettings()
                 {
                     RepoToken = token
                 });
+            }else
+            {
+                Information("No coveralls token. Skipping coveralls.io publication...");
             }
     });


Include Sytem.ValueTuple.dll in the .NET 4.5 ZIP

--- build.cake
+++ build.cake
@@ -397,7 +397,8 @@
     "Microsoft.Threading.Tasks.Extensions.dll",
     "System.IO.dll",
     "System.Runtime.dll",
-    "System.Threading.Tasks.dll"
+    "System.Threading.Tasks.dll",
+    "System.ValueTuple.dll"
 };

 Task("CreateImage")


Initial implementation of redirects

Initial implementation of redirects

--- CalDavSynchronizer/DataAccess/CalDavDataAccess.cs
+++ CalDavSynchronizer/DataAccess/CalDavDataAccess.cs
@@ -63,7 +63,7 @@
         request.PreAuthenticate = true;
         request.Credentials = new NetworkCredential (_username, _password);
       }
-
+      request.AllowAutoRedirect = false;
       return request;
     }

@@ -384,7 +384,19 @@
         }
       }

-      return request.GetResponse();
+      WebResponse response = request.GetResponse();
+      if (((HttpWebResponse)response).StatusCode == HttpStatusCode.Moved || ((HttpWebResponse)response).StatusCode == HttpStatusCode.Redirect)
+      {
+        if (!string.IsNullOrEmpty(response.Headers["Location"]))
+        {
+          return ExecuteCalDavRequest(new Uri(response.Headers["Location"]), modifier, requestBody);
+        }
+        else
+        {
+          s_logger.Warn("Ignoring Redirection without Location header.");
+        }
+      }
+      return response;
     }

     private static XmlDocumentWithNamespaceManager CreateCalDavXmlDocument (Stream calDavXmlStream)


Switch to NUnit3Result instead of OutputFile

--- build.cake
+++ build.cake
@@ -104,18 +104,19 @@
     Test = "Selenium.WebDriver.Equip.Tests.PageNotLoadedExceptionTests",//,Selenium.WebDriver.Equip.Tests.Elements,Selenium.WebDriver.Equip.Tests.Extensions,Selenium.WebDriver.Equip.Tests.PageNotLoadedExceptionTests",
     Where = "cat != LocalOnly and cat != HeadLess", // this removes all test catagories that cant run on build server
     WorkingDirectory = testProjectDir,
-    OutputFile = resultFile
-    });
-  },
-  new FilePath("./OcResult.xml"),
-  new OpenCoverSettings()
-    .WithFilter("+[Selenium.WebDriver.Equip]*")
-    .WithFilter("+[Selenium.WebDriver]*")
-    .WithFilter("+[Equip]*"));
-
-//if (AppVeyor.IsRunningOnAppVeyor) {
-//  AppVeyor.UploadTestResults(resultFile, AppVeyorTestResultsType.NUnit3);
-//}
+    //OutputFile = resultFile,
+    Results = new[] {new NUnit3Result { FileName = resultFile }}
+    });
+  },
+  new FilePath("./OcResult.xml"),
+  new OpenCoverSettings()
+    .WithFilter("+[Selenium.WebDriver.Equip]*")
+    .WithFilter("+[Selenium.WebDriver]*")
+    .WithFilter("+[Equip]*"));
+
+if (AppVeyor.IsRunningOnAppVeyor) {
+  AppVeyor.UploadTestResults(resultFile, AppVeyorTestResultsType.NUnit3);
+}
 });

 Task("Package")


Slack message tweaks

Slack message tweaks

--- build.cake
+++ build.cake
@@ -255,7 +255,7 @@
     }
     else
     {
-        text = "Published version " + version + " of " + appName;
+        text = "Published version " + appName + " v" + version;
     }

 	// Post Message


Updated Flyway to 6.4.4

Updated Flyway to 6.4.4

--- build.cake
+++ build.cake
@@ -34,7 +34,7 @@
     .IsDependentOn("Clean-Output")
     .Does(() =>
 {
-    var version = "6.4.3";
+    var version = "6.4.4";

     // Handle the file without jre
     {


Better remove event

Better remove event

--- Client/Systems/VesselFlightStateSys/VesselFlightStateSystem.cs
+++ Client/Systems/VesselFlightStateSys/VesselFlightStateSystem.cs
@@ -223,14 +223,8 @@

         private void TryRemoveCallback(Vessel vesselToRemove)
         {
-            try
-            {
+            if (vesselToRemove.OnFlyByWire.GetInvocationList().All(d => d.Method.Name != nameof(LunaOnVesselFlyByWire)))
                 vesselToRemove.OnFlyByWire -= FlyByWireDictionary[vesselToRemove.id];
-            }
-            catch (Exception)
-            {
-                // ignored
-            }
         }

         #endregion


IfNotNull extension method that returns result of passed in Func or default value.

--- Clifton.Core/Clifton.Core.ExtensionMethods/ExtensionMethods.cs
+++ Clifton.Core/Clifton.Core.ExtensionMethods/ExtensionMethods.cs
@@ -134,8 +134,23 @@
 			if (ret) { action(obj); }

 			return ret;
-		}
-
+		}
+
+		/// <summary>
+		/// If not null, return the evaluation of the function, otherwise return the default value.
+		/// </summary>
+		public static R IfNotNull<T, R>(this T obj, R defaultValue, Func<T, R> func)
+		{
+			R ret = defaultValue;
+
+			if (obj != null)
+			{
+				ret = func(obj);
+			}
+
+			return ret;
+		}
+
 		/// <summary>
 		/// If the boolean is true, performs the specified action.
 		/// </summary>


Add net46 to the build.cake

Add net46 to the build.cake

Updated build.cake to build for .net framework 4.6

--- build.cake
+++ build.cake
@@ -4,6 +4,7 @@
 var frameworks = new Dictionary<String, String>
 {
     { "netstandard2.0", "netstandard2.0" },
+    { "net46", "net46" },
 };

 #load tools/anglesharp.cake


Enable local builds that create release packages

--- build.cake
+++ build.cake
@@ -1,23 +1,26 @@
 #tool "nuget:?package=xunit.runner.console"
 #tool "nuget:?package=ReportUnit"
+
+///////////////////////////////////////////////////////////////////////////////
+// BUILD ENVIRONMENT
+///////////////////////////////////////////////////////////////////////////////
+var local = BuildSystem.IsLocalBuild;
+var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor;
+var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;
+
 ///////////////////////////////////////////////////////////////////////////////
 // ARGUMENTS
 ///////////////////////////////////////////////////////////////////////////////
-
 var target = Argument<string>("target", "Default");
 var configuration = Argument<string>("configuration", "Release");
 var buildNumber = Argument<int>("buildnumber", 0);
+var preRelease = Argument<bool>("preRelease", local);

 ///////////////////////////////////////////////////////////////////////////////
 // PREPARATION
 ///////////////////////////////////////////////////////////////////////////////

 var projectName = "Hyperspec";
-
-// Get whether or not this is a local build.
-var local = BuildSystem.IsLocalBuild;
-var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor;
-var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;

 // Parse release notes.
 var releaseNotes = ParseReleaseNotes("./ReleaseNotes.md");
@@ -178,7 +181,7 @@
   .Does(() =>
 {
   var nugetVersion = semanticVersion;
-  if (local) {
+  if (preRelease) {
     nugetVersion = string.Format("{0}-build{1:0000}", nugetVersion, buildNumber);
   }
   var nuspecFiles = GetFiles(sourceDirectory.Path + "/**/*.nuspec");


(GH-3748) Update GitVersion.Too to 5.8.1 * fixes #3748

--- build.cake
+++ build.cake
@@ -3,7 +3,7 @@
 #addin "nuget:https://api.nuget.org/v3/index.json?package=Cake.Gitter&version=1.0.1"

 // Install .NET Core Global tools.
-#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=5.7.0"
+#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=5.8.1"
 #tool "dotnet:https://api.nuget.org/v3/index.json?package=SignClient&version=1.3.155"
 #tool "dotnet:https://api.nuget.org/v3/index.json?package=GitReleaseManager.Tool&version=0.12.1"


Ensure package dir is created

Ensure package dir is created

--- build.cake
+++ build.cake
@@ -258,6 +258,7 @@
 Task("PackageSource")
   .Does(() =>
 	{
+		CreateDirectory(PACKAGE_DIR);
 		RunGitCommand(string.Format("archive -o {0} HEAD", SRC_PACKAGE));
 	});

@@ -294,6 +295,7 @@
   .IsDependentOn("CreateImage")
 	.Does(() =>
 	{
+		CreateDirectory(PACKAGE_DIR);
 		Zip(MakeAbsolute(Directory(IMAGE_DIR)), File(ZIP_PACKAGE));
 	});

@@ -301,6 +303,7 @@
   .IsDependentOn("CreateImage")
 	.Does(() =>
 	{
+		CreateDirectory(PACKAGE_DIR);
 		NuGetPack("nuget/nunit.nuspec", new NuGetPackSettings()
 		{
 			Version = PACKAGE_VERSION,


(build) Adding missing semi-colon

(build) Adding missing semi-colon

--- build.cake
+++ build.cake
@@ -11,7 +11,7 @@
 var isLocalBuild        = !AppVeyor.IsRunningOnAppVeyor;
 var isPullRequest       = AppVeyor.Environment.PullRequest.IsPullRequest;
 var isDevelopBranch     = AppVeyor.Environment.Repository.Branch == "develop";
-var repoTag             = AppVeyor.Environment.Repository.Tag
+var repoTag             = AppVeyor.Environment.Repository.Tag;
 var solution            = "./Source/Cake.Gitter.sln";
 var solutionPath        = "./Source/Cake.Gitter";
 var sourcePath          = "./Source";


Allow building single exercise through build script (#350)

You can do this by adding: --name=<exercise>

--- build.cake
+++ build.cake
@@ -3,6 +3,7 @@
 using System.Threading.Tasks;

 var target = Argument("target", "Default");
+var exercise = Argument<string>("exercise", null);

 var sourceDir = "./exercises";
 var buildDir  = "./build";
@@ -14,13 +15,13 @@
 Task("Clean")
     .Does(() => {
 		CleanDirectory(buildDir);
-    });
+    });

 // Copy everything to build so we make no changes in the actual files.
 Task("CopyExercises")
     .IsDependentOn("Clean")
     .Does(() => {
-        CopyDirectory(sourceDir, buildDir);
+        CopyDirectory($"{sourceDir}/{exercise}", $"{buildDir}/{exercise}");
     });

 Task("EnableAllTests")
@@ -53,11 +54,11 @@
 Task("ReplaceStubWithExample")
     .IsDependentOn("TestRefactoringProjects")
     .Does(() => {
-        var solution = ParseSolution(solutionPath);
+        var projects = GetFiles(buildDir + "/*/*.fsproj");

-        foreach (var project in solution.Projects) {
-            var projectDir = project.Path.GetDirectory();
-            var projectName = project.Path.GetFilenameWithoutExtension();
+        foreach (var project in projects) {
+            var projectDir = project.GetDirectory();
+            var projectName = project.GetFilenameWithoutExtension();
             var stub = projectDir.GetFilePath(projectName).AppendExtension("fs");
             var example = projectDir.GetFilePath("Example.fs");

@@ -81,8 +82,8 @@
 Task("TestUsingExampleImplementation")
     .IsDependentOn("AddPackagesUsedInExampleImplementations")
     .Does(() => {
-        var solution = ParseSolution(solutionPath);
-        Parallel.ForEach(solution.Projects, parallelOptions, (project) => DotNetCoreTest(project.Path.FullPath));
+        var projects = GetFiles(buildDir + "/*/*.fsproj");
+        Parallel.ForEach(projects, parallelOptions, (project) => DotNetCoreTest(project.FullPath));
     });

 Task("Default")


:green_heart: Update Sonar organization

:green_heart: Update Sonar organization

--- build.cake
+++ build.cake
@@ -240,9 +240,9 @@
     var sonarToken = EnvironmentVariable("SONAR_TOKEN");
     var sonarSettings = new SonarBeginSettings {
         Url = "https://sonarqube.com",
-        Key = "yarhl",
+        Key = "SceneGate_Yarhl",
         Login = sonarToken,
-        Organization = "pleonex-github",
+        Organization = "scenegate",
         Verbose = true,
      };


remove obsolete Get-DNV task

remove obsolete Get-DNV task

--- build.cake
+++ build.cake
@@ -35,7 +35,6 @@
 {
     NuGetRestore(solutionFile);
 });
-

 Task("Build")
@@ -87,19 +86,6 @@
     var testAssemblies = GetFiles(".\\test\\AmbientContext.Tests\\bin\\" + configuration + "\\net451\\*\\AmbientContext.Tests.dll");
     Console.WriteLine(testAssemblies.Count());
     XUnit2(testAssemblies);
-});
-
-
-Task("Get-DNV")
-    .ContinueOnError()
-    .Does(() =>
-{
-    if (!FileExists("./tools/dnv.exe")) {
-        if (FileExists("./tools/updeps.exe"))
-            DeleteFile("./tools/updeps.exe");
-        DownloadFile("https://github.com/PhilipDaniels/dotnetversioning/raw/master/dnv.zip", "./tools/dnv.zip");
-        Unzip("./tools/dnv.zip", "./tools");
-    }
 });


Fully specify NuGet source.

Fully specify NuGet source.

--- build.cake
+++ build.cake
@@ -1,10 +1,10 @@
-#addin "nuget:?package=Cake.Git&version=0.10.0"
-#addin "nuget:?package=Octokit&version=0.23.0"
-#tool "nuget:?package=coveralls.io&version=1.3.4"
-#tool "nuget:?package=gitlink&version=2.3.0"
-#tool "nuget:?package=NUnit.ConsoleRunner&version=3.5.0"
-#tool "nuget:?package=OpenCover&version=4.6.519"
-#tool "nuget:?package=ReportGenerator&version=2.5.0"
+#addin "nuget:https://www.nuget.org/api/v2/?package=Cake.Git&version=0.10.0"
+#addin "nuget:https://www.nuget.org/api/v2/?package=Octokit&version=0.23.0"
+#tool "nuget:https://www.nuget.org/api/v2/?package=coveralls.io&version=1.3.4"
+#tool "nuget:https://www.nuget.org/api/v2/?package=gitlink&version=2.3.0"
+#tool "nuget:https://www.nuget.org/api/v2/?package=NUnit.ConsoleRunner&version=3.5.0"
+#tool "nuget:https://www.nuget.org/api/v2/?package=OpenCover&version=4.6.519"
+#tool "nuget:https://www.nuget.org/api/v2/?package=ReportGenerator&version=2.5.0"

 using LibGit2Sharp;


No need to automatically set that the build script is running on TeamCity

--- build.cake
+++ build.cake
@@ -3,10 +3,6 @@
 #tool "nuget:?package=ReportGenerator"

 var target = Argument("target", "Default");
-
-if (TeamCity.IsRunningOnTeamCity) {
-    target = "teamcity";
-}

 var configuration = Argument("configuration", "Debug");


(build) Updated path in DotNetCoreRestore

--- build.cake
+++ build.cake
@@ -36,7 +36,7 @@
   .IsDependentOn("Clean")
   .Does(() =>
   {
-    DotNetCoreRestore("./", new DotNetCoreRestoreSettings
+    DotNetCoreRestore("./Localization.AspNetCore.TagHelpers.sln", new DotNetCoreRestoreSettings
     {
       Verbose = false,
       ArgumentCustomization = parameters.GetMsBuildArgs(Context)


more build fixes

more build fixes

--- build.cake
+++ build.cake
@@ -21,7 +21,7 @@
         var ouputDirectory = "./bin/Release";

         Information("Building Core.PCL...");
-        BuildProject("./Core/Core.csproj", ouputDirectory, buildType, configuration, "v4.5");
+        BuildProject("./Core/Core.csproj", ouputDirectory, buildType, configuration, "v4.0");

         Information("Building Core.Net40...");
         BuildProject("./Core40/Core40.csproj", ouputDirectory, buildType, configuration, "v4.0");
@@ -85,8 +85,8 @@
     });

 Task("Default")
-    //.IsDependentOn("OutputArguments")
-	//.IsDependentOn("Core")
+    .IsDependentOn("OutputArguments")
+	.IsDependentOn("Core")
     .IsDependentOn("WPF")
     .IsDependentOn("UWP")
     .IsDependentOn("WinForms");


Fix line endings

Fix line endings


Adjusted the highlight preview background color

--- CodeHub/Controls/Hilite_meHighlightStylePreviewControl.xaml.cs
+++ CodeHub/Controls/Hilite_meHighlightStylePreviewControl.xaml.cs
@@ -59,6 +59,9 @@
             // Update the preview
             if (@this.ReadLocalValue(HighlightStyleProperty) != DependencyProperty.UnsetValue)
             {
+                bool light = LightStyles.Contains(@this.HighlightStyle);
+                @this.FadeCanvas.Background = new SolidColorBrush(light ? Colors.White : Colors.Black);
+                @this.WebControl.DefaultBackgroundColor = light ? Colors.White : Colors.Black;
                 String preview = await @this.LoadHTMLPreviewAsync();
                 @this.WebControl.NavigateToString(preview);
             }


add logging to test clean up and correct file search

--- build.cake
+++ build.cake
@@ -27,8 +27,13 @@
         }

         //Clean test output
-        var directoryToScanForTestResults = "./**/*.prx";
+        var directoryToScanForTestResults = "./**/TestResults/*.trx";
+
         var testResultFiles = GetFiles(directoryToScanForTestResults);
+        foreach(var file in testResultFiles)
+        {
+            Information("Deleting test result" + file.ToString());
+        }
         DeleteFiles(testResultFiles);

     });


Fixing build

Fixing build

--- build.cake
+++ build.cake
@@ -119,7 +119,7 @@
             .WithProperty("AssemblyVersion", gitVersion.AssemblySemVer)
             .WithProperty("FileVersion", gitVersion.MajorMinorPatch)
             .WithProperty("InformationalVersion", gitVersion.InformationalVersion)
-            .WithProperty("ContinuousIntegrationBuild", local == false)
+            .WithProperty("ContinuousIntegrationBuild", local == false ? "true" : "false")
             );
 });


Test the full framework using NUnit console

--- build.cake
+++ build.cake
@@ -1,6 +1,7 @@
 //////////////////////////////////////////////////////////////////////
 // ARGUMENTS
 //////////////////////////////////////////////////////////////////////
+#tool nuget:?package=NUnit.ConsoleRunner&version=3.5.0

 var target = Argument("target", "Default");
 var configuration = Argument("configuration", "Debug");
@@ -279,7 +280,7 @@
     {
         var runtime = "net-4.5";
         var dir = BIN_DIR + runtime + "/";
-        RunTest(dir + NUNITLITE_RUNNER, dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
+        RunNUnitTests(dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
         RunTest(dir + EXECUTABLE_NUNITLITE_TESTS, dir, runtime, ref ErrorDetail);
     });

@@ -291,7 +292,7 @@
     {
         var runtime = "net-4.0";
         var dir = BIN_DIR + runtime + "/";
-        RunTest(dir + NUNITLITE_RUNNER, dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
+        RunNUnitTests(dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
         RunTest(dir + EXECUTABLE_NUNITLITE_TESTS, dir, runtime, ref ErrorDetail);
     });

@@ -303,7 +304,7 @@
     {
         var runtime = "net-3.5";
         var dir = BIN_DIR + runtime + "/";
-        RunTest(dir + NUNITLITE_RUNNER, dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
+        RunNUnitTests(dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
         RunTest(dir + EXECUTABLE_NUNITLITE_TESTS, dir, runtime, ref ErrorDetail);
     });

@@ -315,7 +316,7 @@
     {
         var runtime = "net-2.0";
         var dir = BIN_DIR + runtime + "/";
-        RunTest(dir + NUNITLITE_RUNNER, dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
+        RunNUnitTests(dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
         RunTest(dir + EXECUTABLE_NUNITLITE_TESTS, dir, runtime, ref ErrorDetail);
     });

@@ -552,6 +553,19 @@
 // HELPER METHODS - TEST
 //////////////////////////////////////////////////////////////////////

+void RunNUnitTests(DirectoryPath workingDir, string testAssembly, string framework, ref List<string> errorDetail)
+{
+    try
+    {
+        var path = workingDir.CombineWithFilePath(new FilePath(testAssembly));
+        NUnit3(path.ToString());
+    }
+    catch(CakeException ce)
+    {
+        errorDetail.Add(string.Format("{0}: {1}", framework, ce.Message));
+    }
+}
+
 void RunTest(FilePath exePath, DirectoryPath workingDir, string framework, ref List<string> errorDetail)
 {
     RunTest(exePath, workingDir, null, framework, ref errorDetail);


sonarbuild v1

sonarbuild v1

--- build.cake
+++ build.cake
@@ -1,5 +1,7 @@
 #tool "nuget:?package=vswhere"
 #tool "nuget:?package=GitVersion.CommandLine"
+#tool nuget:?package=MSBuild.SonarQube.Runner.Tool
+#addin nuget:?package=Cake.Sonar

 var target = Argument("target", "Default");
 var nugetPackagesDir = Directory("./artifacts");
@@ -11,6 +13,22 @@
 {
     NuGetRestore(solution);
 });
+
+Task("SonarBegin")
+  .Does(() => {
+     SonarBegin(new SonarBeginSettings{
+        Url = "https://sonarqube.com",
+        Login = "halkar@github",
+        Verbose = true
+     });
+  });
+
+Task("SonarEnd")
+  .Does(() => {
+     SonarEnd(new SonarEndSettings{
+        Login = "halkar@github"
+     });
+  });

 Task("Build")
 	.IsDependentOn("Update-Version")
@@ -31,7 +49,9 @@
     OutputDirectory = nugetPackagesDir
 };
 Task("Pack-NugetPackages")
+    .IsDependentOn("SonarBegin")
 	.IsDependentOn("Build")
+    .IsDependentOn("SonarEnd")
 	.Does (() =>
 {
     CreateDirectory(nugetPackagesDir);


added further comments

added further comments

--- Frontend/GaMR/Assets/Scripts/Menu/MainMenuActions.cs
+++ Frontend/GaMR/Assets/Scripts/Menu/MainMenuActions.cs
@@ -4,6 +4,9 @@
 using UnityEngine;
 using UnityEngine.SceneManagement;

+/// <summary>
+/// collects all actions which can be performed by tapping on the main menu items
+/// </summary>
 public class MainMenuActions : MonoBehaviour
 {

@@ -14,6 +17,10 @@
     Menu menu;
     static GameObject carouselInstance;

+
+    /// <summary>
+    /// fetches all necessary components for the main menu actions
+    /// </summary>
     public void Start()
     {
         restManager = ComponentGetter.GetComponentOnGameobject<RestManager>("RestManager");
@@ -25,12 +32,20 @@
         }
     }

+    /// <summary>
+    /// Displays a keyboard in order to enter the ip address
+    /// </summary>
     public void EnterIPAddress()
     {
-        Keyboard.Display(LocalizationManager.Instance.ResolveString("Enter the IP-Address"), SetIPAddress, false);
+        Keyboard.Display(LocalizationManager.Instance.ResolveString("Enter the IP-Address"), InformationManager.Instance.ipAddressBackend, SetIPAddress, false);
         gameObject.SetActive(false);
     }

+    /// <summary>
+    /// Sets the ip address which was entered before
+    /// called by the keyboard which was created in EnterIPAddress
+    /// </summary>
+    /// <param name="address">The address which has been typed by the user (null if cancelled)</param>
     public void SetIPAddress(string address)
     {
         gameObject.SetActive(true);
@@ -43,12 +58,19 @@
         }
     }

+    /// <summary>
+    /// Test if the server is responding by requesting the model overview
+    /// </summary>
     private void TestAddress()
     {
         WaitCursor.Show();
         restManager.GET(InformationManager.Instance.BackendAddress + "/resources/model/overview", RestResult);
     }

+    /// <summary>
+    /// Processes the result of the TestAddress web request
+    /// </summary>
+    /// <param name="result">The result of the request</param>
     private void RestResult(string result)
     {
         WaitCursor.Hide();
@@ -64,12 +86,20 @@
         }
     }

+    /// <summary>
+    /// Displays a keyboard so that the user can enter the port
+    /// </summary>
     public void EnterPort()
     {
         Keyboard.Display(LocalizationManager.Instance.ResolveString("Enter the port"), SetIPPort, false);
         gameObject.SetActive(false);
     }

+    /// <summary>
+    /// Sets the port which has been entered by the user
+    /// Called by the keyboard which has been created in EnterPort
+    /// </summary>
+    /// <param name="port">The user input (null if canceled)</param>
     public void SetIPPort(string port)
     {
         gameObject.SetActive(true);
@@ -91,12 +121,20 @@
         }
     }

+    /// <summary>
+    /// Triggers a web request to get the model overview and later display it in a carousel menu
+    /// </summary>
     public void ShowCarouselMenu()
     {
         WaitCursor.Show();
         restManager.GET(InformationManager.Instance.BackendAddress + "/resources/model/overview", AvailableModelsLoaded);
     }

+    /// <summary>
+    /// Displays a carousel menu and populates it with the available 3D models
+    /// called when the web request finished in ShowCarouselMenu
+    /// </summary>
+    /// <param name="res">The result of the web request</param>
     private void AvailableModelsLoaded(string res)
     {
         WaitCursor.Hide();
@@ -143,6 +181,11 @@
         Destroy(gameObject);
     }

+    /// <summary>
+    /// Loads the selected 3D model and closes the carousel menu
+    /// Called if an item on the carousel menu is tapped
+    /// </summary>
+    /// <param name="name">The name of the menu item</param>
     public void OnCarouselItemClicked(string name)
     {
         modelLoadManager.Load(name);
@@ -150,22 +193,35 @@
         carouselInstance = null;
     }

+    /// <summary>
+    /// Sets the language to german
+    /// </summary>
     public void SetLangaugeGerman()
     {
         SetLanguage(Language.GERMAN);
     }

+    /// <summary>
+    /// Sets the language to english
+    /// </summary>
     public void SetLanguageEnglish()
     {
         SetLanguage(Language.ENGLISH);
     }

+    /// <summary>
+    /// Sets the language to the specified value
+    /// </summary>
+    /// <param name="language">The new language</param>
     private void SetLanguage(Language language)
     {
         InformationManager.Instance.Language = language;
         menu.UpdateTexts();
     }

+    /// <summary>
+    /// Loads the login scene and closes the current scene
+    /// </summary>
     public void LogOut()
     {
         SceneManager.LoadScene("Login", LoadSceneMode.Single);


print isrelease branch.

print isrelease branch.

--- build.cake
+++ build.cake
@@ -50,6 +50,7 @@
     Information("IsPullRequest: " + parameters.IsPullRequest);
     Information("IsMainRepo: " + parameters.IsMainRepo);
     Information("IsMasterBranch: " + parameters.IsMasterBranch);
+    Information("IsReleaseBranch: " + parameters.IsReleaseBranch);
     Information("IsTagged: " + parameters.IsTagged);
     Information("IsReleasable: " + parameters.IsReleasable);
     Information("IsMyGetRelease: " + parameters.IsMyGetRelease);


chore: Upgrade cake

chore: Upgrade cake

--- build.cake
+++ build.cake
@@ -185,7 +185,7 @@
             new NuSpecContent { Source = "net5.0/Zeiss.PiWeb.Api.Rest.Dtos.xml", Target = "lib/net5.0" },
         },
         Dependencies             = new [] {
-            new NuSpecDependency { Id = "Newtonsoft.Json", Version = "12.0.3" },
+            new NuSpecDependency { Id = "Newtonsoft.Json", Version = "13.0.1" },
             new NuSpecDependency { Id = "JetBrains.Annotations", Version = "2020.3.0" },
             new NuSpecDependency { Id = "Zeiss.PiWeb.Api.Definitions", Version = nugetVersion }
         },
@@ -234,7 +234,7 @@
         },
         Dependencies             = new [] {
             new NuSpecDependency { Id = "CacheCow.Client", Version = "2.8.3" },
-            new NuSpecDependency { Id = "Newtonsoft.Json", Version = "12.0.3" },
+            new NuSpecDependency { Id = "Newtonsoft.Json", Version = "13.0.1" },
             new NuSpecDependency { Id = "Newtonsoft.Json.Bson", Version = "1.0.2" },
             new NuSpecDependency { Id = "IdentityModel", Version = "5.1.0" },
             new NuSpecDependency { Id = "Microsoft.IdentityModel.Logging", Version = "6.11.1" },


Don't restore .NET Standard if not on Windows

--- build.cake
+++ build.cake
@@ -136,8 +136,11 @@
         Information("Restoring NuGet packages");
 		DotNetCoreRestore(SOLUTION_FILE);

-        Information("Restoring .NET Core packages");
-        DotNetCoreRestore(DOTNETCORE_SOLUTION_FILE);
+        if(IsRunningOnWindows())
+        {
+            Information("Restoring .NET Core packages");
+            DotNetCoreRestore(DOTNETCORE_SOLUTION_FILE);
+        }
 	});

 //////////////////////////////////////////////////////////////////////


Standardize pre-release suffixes

Standardize pre-release suffixes

--- build.cake
+++ build.cake
@@ -60,12 +60,31 @@
         }
         else
         {
-            var buildNumber = AppVeyor.Environment.Build.Number;
-            packageVersion = version + "-CI-" + buildNumber + dbgSuffix;
-            if (AppVeyor.Environment.PullRequest.IsPullRequest)
-            packageVersion += "-PR-" + AppVeyor.Environment.PullRequest.Number;
+            var buildNumber = AppVeyor.Environment.Build.Number.ToString("00000");
+            var branch = AppVeyor.Environment.Repository.Branch;
+            var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;
+
+            if (branch == "master" && !isPullRequest)
+            {
+                packageVersion = version + "-dev-" + buildNumber + dbgSuffix;
+            }
             else
-            packageVersion += "-" + AppVeyor.Environment.Repository.Branch;
+            {
+                var suffix = "-ci" + buildNumber + dbgSuffix;
+
+                if (isPullRequest)
+                suffix += "-pr-" + AppVeyor.Environment.PullRequest.Number;
+                else if (branch.StartsWith("release"))
+                    suffix += "-pre-" + buildNumber;
+                else
+                    suffix += "-" + branch;
+
+                // Nuget limits "special version part" to 20 chars. Add one for the hyphen.
+                if (suffix.Length > 21)
+                    suffix = suffix.Substring(0, 21);
+
+                packageVersion = version + suffix;
+            }
         }

         AppVeyor.UpdateBuildVersion(packageVersion);


fixed

fixed

--- build.cake
+++ build.cake
@@ -35,7 +35,7 @@

 var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor;
 var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;
-var isRepository = StringComparer.OrdinalIgnoreCase.Equals("ghuntkey/akavachesandpit", AppVeyor.Environment.Repository.Name);
+var isRepository = StringComparer.OrdinalIgnoreCase.Equals("ghuntley/akavachesandpit", AppVeyor.Environment.Repository.Name);

 var isReleaseBranch = StringComparer.OrdinalIgnoreCase.Equals("release", AppVeyor.Environment.Repository.Branch);
 var isMasterBranch = StringComparer.OrdinalIgnoreCase.Equals("master", AppVeyor.Environment.Repository.Branch);


changed sql plugin

changed sql plugin

--- build.cake
+++ build.cake
@@ -1,4 +1,4 @@
-#addin "Cake.SqlTools"
+#addin "Cake.SqlServer"

 //////////////////////////////////////////////////////////////////////
 // ARGUMENTS
@@ -98,16 +98,10 @@
     var createdb = @"USE master
     CREATE DATABASE NStore";

-    var settings =  new SqlQuerySettings()
-    {
-        Provider = "MsSql",
-        ConnectionString = msSqlServerConnectionString
-    };
-
     Information("Connected to sql server instance " + msSqlServerConnectionString);

-    ExecuteSqlQuery(dropdb, settings);
-    ExecuteSqlQuery(createdb, settings);
+    ExecuteSqlCommand(msSqlServerConnectionString, dropdb);
+    ExecuteSqlCommand(msSqlServerConnectionString, createdb);

     var env = new Dictionary<string, string>{
         { "NSTORE_MSSQL", msSqlDatabaseConnectionString},
@@ -115,7 +109,7 @@

     RunTest("NStore.Persistence.MsSql.Tests",env);

-    ExecuteSqlQuery(dropdb, settings);
+    ExecuteSqlCommand(msSqlServerConnectionString, dropdb);
 });

 Task("TestSqlite")


Add test coverage for drag-away

Add test coverage for drag-away

--- osu.Framework.Tests/Visual/UserInterface/TestScenePopoverContainer.cs
+++ osu.Framework.Tests/Visual/UserInterface/TestScenePopoverContainer.cs
@@ -103,6 +103,39 @@
         }

         [Test]
+        public void TestDragAwayDoesntHide()
+        {
+            createContent(button => new BasicPopover
+            {
+                Child = new SpriteText
+                {
+                    Text = $"{button.Anchor} popover"
+                }
+            });
+
+            AddStep("click button", () =>
+            {
+                InputManager.MoveMouseTo(this.ChildrenOfType<DrawableWithPopover>().First());
+                InputManager.Click(MouseButton.Left);
+            });
+
+            AddAssert("popover created", () => this.ChildrenOfType<Popover>().Any());
+
+            AddStep("mousedown popover", () =>
+            {
+                InputManager.MoveMouseTo(this.ChildrenOfType<Popover>().Single().Body);
+                InputManager.PressButton(MouseButton.Left);
+            });
+            AddAssert("popover still visible", () => this.ChildrenOfType<Popover>().Single().State.Value == Visibility.Visible);
+
+            AddStep("move away", () => InputManager.MoveMouseTo(this.ChildrenOfType<DrawableWithPopover>().Last()));
+
+            AddStep("release button", () => InputManager.ReleaseButton(MouseButton.Left));
+
+            AddAssert("popover remains", () => this.ChildrenOfType<Popover>().Any());
+        }
+
+        [Test]
         public void TestInteractiveContent() => createContent(button =>
         {
             TextBox textBox;


Bug fix - UpdateUnifiedGroup method - invalid response header issue, toggle group visibility bug

--- Core/OfficeDevPnP.Core/Framework/Graph/UnifiedGroupsUtility.cs
+++ Core/OfficeDevPnP.Core/Framework/Graph/UnifiedGroupsUtility.cs
@@ -389,7 +389,7 @@
             var fullListOfOwners = await graphClient.Groups[targetGroup.Id].Owners.Request().Select("userPrincipalName, Id").GetAsync();
             var pageExists = true;

-            while(pageExists)
+            while (pageExists)
             {
                 foreach (var owner in fullListOfOwners)
                 {
@@ -444,7 +444,7 @@
         public static bool UpdateUnifiedGroup(string groupId,
             string accessToken, int retryCount = 10, int delay = 500,
             string displayName = null, string description = null, string[] owners = null, string[] members = null,
-            Stream groupLogo = null, bool isPrivate = false)
+            Stream groupLogo = null, bool? isPrivate = null)
         {
             bool result;
             try
@@ -458,6 +458,12 @@
                         .Request()
                         .GetAsync();

+                    // Workaround for the PATCH request, needed after update to Graph Library
+                    var clonedGroup = new Group
+                    {
+                        Id = groupToUpdate.Id
+                    };
+
                     #region Logic to update the group DisplayName and Description

                     var updateGroup = false;
@@ -466,22 +472,22 @@
                     // Check if we have to update the DisplayName
                     if (!String.IsNullOrEmpty(displayName) && groupToUpdate.DisplayName != displayName)
                     {
-                        groupToUpdate.DisplayName = displayName;
+                        clonedGroup.DisplayName = displayName;
                         updateGroup = true;
                     }

                     // Check if we have to update the Description
                     if (!String.IsNullOrEmpty(description) && groupToUpdate.Description != description)
                     {
-                        groupToUpdate.Description = description;
+                        clonedGroup.Description = description;
                         updateGroup = true;
                     }

                     // Check if visibility has changed for the Group
                     bool existingIsPrivate = groupToUpdate.Visibility == "Private";
-                    if (existingIsPrivate != isPrivate)
-                    {
-                        groupToUpdate.Visibility = isPrivate == true ? "Private" : "Public";
+                    if (isPrivate.HasValue && existingIsPrivate != isPrivate)
+                    {
+                        clonedGroup.Visibility = isPrivate == true ? "Private" : "Public";
                         updateGroup = true;
                     }

@@ -506,7 +512,7 @@
                     {
                         var updatedGroup = await graphClient.Groups[groupId]
                             .Request()
-                            .UpdateAsync(groupToUpdate);
+                            .UpdateAsync(clonedGroup);

                         groupUpdated = true;
                     }
@@ -720,6 +726,7 @@
         /// <param name="includeSite">Defines whether to return details about the Modern SharePoint Site backing the group. Default is true.</param>
         /// <param name="retryCount">Number of times to retry the request in case of throttling</param>
         /// <param name="delay">Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry</param>
+        /// <param name="includeClassification">Defines whether or not to return details about the Modern Site classification value.</param>
         /// <returns>An IList of SiteEntity objects</returns>
         public static List<UnifiedGroupEntity> ListUnifiedGroups(string accessToken,
             String displayName = null, string mailNickname = null,
@@ -850,7 +857,7 @@
                     {
                         unifiedGroupGraphUsers = new List<User>();

-                        GenerateGraphUserCollection(groupUsers.CurrentPage,unifiedGroupGraphUsers);
+                        GenerateGraphUserCollection(groupUsers.CurrentPage, unifiedGroupGraphUsers);
                     }

                     // Retrieve users when the results are paged.
@@ -1014,8 +1021,8 @@
             {
                 classification = e.Error.Message;
             }
-
+
             return classification;
         }
     }
-}
+}


Init grain reminder in case the grain deactivated

--- Orleans.Sagas/SagaGrain.cs
+++ Orleans.Sagas/SagaGrain.cs
@@ -65,7 +65,7 @@
         public async Task Execute(IEnumerable<ActivityDefinition> activities, ISagaPropertyBag sagaProperties, IErrorTranslator exceptionTranslator)
         {
             _errorTranslator = exceptionTranslator ?? new DefaultErrorTranslator();
-
+
             if (State.Status == SagaStatus.NotStarted)
             {
                 State.Activities = activities.ToList();
@@ -107,6 +107,8 @@

         public async Task ReceiveReminder(string reminderName, TickStatus status)
         {
+            await TryToInitGrainReminderAsync();
+
             await ResumeAsync();
         }

@@ -137,9 +139,11 @@

         private async Task UnRegisterReminderAsync()
         {
+            await TryToInitGrainReminderAsync();
+
             if (grainReminder == null)
             {
-                return;
+                return;
             }

             try
@@ -344,5 +348,15 @@
                 logger.LogError(ex, "Failed to tranlsate exception.");
             }
         }
+
+        private async Task TryToInitGrainReminderAsync()
+        {
+            if (grainReminder != null)
+            {
+                return;
+            }
+
+            grainReminder = await GetReminder(ReminderName);
+        }
     }
 }


keyword "unsafe" will now be ignored

keyword "unsafe" will now be ignored

--- Compiler/skc5/Compiler/CsToJs/AstNodeConverter.cs
+++ Compiler/skc5/Compiler/CsToJs/AstNodeConverter.cs
@@ -710,14 +710,14 @@
             return new JsVariableDeclarator { Name = node.Name, Initializer = VisitExpression(node.Initializer) };
         }

+        public JsNode VisitUncheckedStatement(UncheckedStatement node)
+        {
+            return Visit(node.Body);
+        }
+
         #endregion

         #region NotImplemented
-
-        public JsNode VisitUncheckedStatement(UncheckedStatement node)
-        {
-            throw new NotImplementedException();
-        }

         public JsNode VisitUnsafeStatement(UnsafeStatement node)
         {


fixed MemberRef treated as a field. fixed #6

--- Confuser.Renamer/Analyzers/LdtokenEnumAnalyzer.cs
+++ Confuser.Renamer/Analyzers/LdtokenEnumAnalyzer.cs
@@ -26,7 +26,13 @@
                 var instr = method.Body.Instructions[i];
                 if (instr.OpCode.Code == Code.Ldtoken)
                 {
-                    if (instr.Operand is IField)
+                    if (instr.Operand is MemberRef)
+                    {
+                        var member = ((MemberRef)instr.Operand).ResolveThrow();
+                        if (context.Modules.Contains((ModuleDefMD)member.Module))
+                            service.SetCanRename(member, false);
+                    }
+                    else if (instr.Operand is IField)
                     {
                         FieldDef field = ((IField)instr.Operand).ResolveThrow();
                         if (context.Modules.Contains((ModuleDefMD)field.Module))


more fixing

more fixing

--- Gibe.Navigation.Umbraco/UmbracoNavigationProvider.cs
+++ Gibe.Navigation.Umbraco/UmbracoNavigationProvider.cs
@@ -21,21 +21,22 @@
         public UmbracoNavigationProvider(
             IModelConverter modelConverter, IUmbracoNodeService umbracoNodeService,
             IUmbracoWrapper umbracoWrapper, INodeTypeFactory nodeTypeFactory,
-            int priority)
+            int priority)
+            : this(modelConverter, umbracoNodeService, umbracoWrapper,
+                  nodeTypeFactory, priority, typeof(SettingsNodeType))
+        {
+        }
+
+        public UmbracoNavigationProvider(
+            IModelConverter modelConverter, IUmbracoNodeService umbracoNodeService,
+            IUmbracoWrapper umbracoWrapper, INodeTypeFactory nodeTypeFactory,
+            int priority, Type rootNodeType)
         {
             _modelConverter = modelConverter;
             _umbracoNodeService = umbracoNodeService;
             _umbracoWrapper = umbracoWrapper;
             _nodeTypeFactory = nodeTypeFactory;
             Priority = priority;
-        }
-
-        public UmbracoNavigationProvider(
-            IModelConverter modelConverter, IUmbracoNodeService umbracoNodeService,
-            IUmbracoWrapper umbracoWrapper, INodeTypeFactory nodeTypeFactory,
-            int priority, Type rootNodeType)
-            : this(modelConverter, umbracoNodeService, umbracoWrapper, nodeTypeFactory, priority)
-        {
             _rootNodeType = rootNodeType;
         }


Fix lights being occluded while in inventory (#5972)

--- Content.Shared/Inventory/InventorySystem.Slots.cs
+++ Content.Shared/Inventory/InventorySystem.Slots.cs
@@ -26,6 +26,7 @@
         if (!containerComp.TryGetContainer(slotDefinition.Name, out var container))
         {
             containerSlot = containerComp.MakeContainer<ContainerSlot>(slotDefinition.Name);
+            containerSlot.OccludesLight = false;
             return true;
         }


Prep for September 2017 release

Prep for September 2017 release

--- Core/OfficeDevPnP.Core/Properties/AssemblyInfo.cs
+++ Core/OfficeDevPnP.Core/Properties/AssemblyInfo.cs
@@ -43,7 +43,7 @@
 // Minor version = Sequence...version 0 was with January release...so 1=Feb 2=Mar, 3=Apr, 4=May, 5=Jun, 6=Aug, 7=Sept,...11=Jan 2017...15=May 2017
 // Third part = version indenpendant showing the release month in YYMM
 // Fourth part = 0 normally or a sequence number when we do an emergency release
-[assembly: AssemblyVersion("2.17.1708.0")]
-[assembly: AssemblyFileVersion("2.17.1708.0")]
+[assembly: AssemblyVersion("2.18.1709.0")]
+[assembly: AssemblyFileVersion("2.18.1709.0")]

 [assembly: InternalsVisibleTo("OfficeDevPnP.Core.Tests")]


(InventoryManager) Shift insertion of downloadrequest into the status collection, to prevent a possible race condition.

git-svn-id: baf6e02d125cf6f9bfcfe153b2eb83d6e1f5ace6@834 52acb1d6-8a22-11de-b505-999d5b087335

--- libsecondlife-cs/InventorySystem/InventoryManager.cs
+++ libsecondlife-cs/InventorySystem/InventoryManager.cs
@@ -594,12 +594,13 @@
         /// <param name="dr"></param>
         internal void RequestFolder(DownloadRequest_Folder dr)
         {
+
+            FolderDownloadStatus[dr.FolderID] = dr;
+
             Packet packet = InvPacketHelper.FetchInventoryDescendents(
                             dr.FolderID
                             , dr.FetchFolders
                             , dr.FetchItems);
-
-            FolderDownloadStatus[dr.FolderID] = dr;

             slClient.Network.SendPacket(packet);
         }


Code cleanup

Code cleanup

--- HiPMobile/HiPMobile.Droid/Activities/MainActivity.cs
+++ HiPMobile/HiPMobile.Droid/Activities/MainActivity.cs
@@ -18,7 +18,6 @@
 using System.Linq;
 using Android;
 using Android.App;
-using Android.Content;
 using Android.Content.PM;
 using Android.OS;
 using Android.Support.Design.Widget;
@@ -34,27 +33,28 @@
 using HockeyApp;
 using ActionBarDrawerToggle = Android.Support.V7.App.ActionBarDrawerToggle;

-namespace de.upb.hip.mobile.droid.Activities {
-    [Activity (Theme = "@style/AppTheme",
+namespace de.upb.hip.mobile.droid.Activities
+{
+    [Activity(Theme = "@style/AppTheme",
         Label = "HiPMobile.Droid", MainLauncher = false, Icon = "@drawable/icon")]
-    public class MainActivity : AppCompatActivity {
-
+    public class MainActivity : AppCompatActivity
+    {
         private DrawerLayout drawerLayout;
         private ExhibitSet exhibitSet;
         private GeoLocation geoLocation;

-        protected override void OnCreate (Bundle savedInstanceState)
-        {
-            base.OnCreate (savedInstanceState);
+        protected override void OnCreate(Bundle savedInstanceState)
+        {
+            base.OnCreate(savedInstanceState);

             // Set our view from the "main" layout resource
-            SetContentView (Resource.Layout.Main);
+            SetContentView(Resource.Layout.Main);

             // Check if we have the necessary permissions and request them if we don't
             // Note that the app will still fail on first launch and needs to be restarted
-            SetUpPermissions ();
+            SetUpPermissions();

             geoLocation = new GeoLocation
             {
@@ -62,14 +62,14 @@
                 Longitude = 8.74021
             };

-            exhibitSet = ExhibitManager.GetExhibitSets ().First ();
+            exhibitSet = ExhibitManager.GetExhibitSets().First();

             //Permissions
-            SetUpPermissions ();
+            SetUpPermissions();

             // Navigation Drawer
-            SetUpNavigationDrawer ();
+            SetUpNavigationDrawer();

             if (savedInstanceState == null)
             {
@@ -80,62 +80,67 @@
                     GeoLocation = geoLocation
                 };

-                if (FindViewById (Resource.Id.main_fragment_container) != null)
+                if (FindViewById(Resource.Id.main_fragment_container) != null)
                 {
-                    var transaction = FragmentManager.BeginTransaction ();
-                    transaction.Replace (Resource.Id.main_fragment_container, fragment);
-                    transaction.Commit ();
+                    var transaction = FragmentManager.BeginTransaction();
+                    transaction.Replace(Resource.Id.main_fragment_container, fragment);
+                    transaction.Commit();
                 }
             }

             // hockeyapp code
-            CheckForUpdates ();
-        }
-
-
-        private void SetUpNavigationDrawer ()
-        {
-            drawerLayout = FindViewById<DrawerLayout> (Resource.Id.mainActivityDrawerLayout);
+            CheckForUpdates();
+        }
+
+
+        private void SetUpNavigationDrawer()
+        {
+            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.mainActivityDrawerLayout);

             // Init toolbar
-            var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
-            SetSupportActionBar (toolbar);
+            var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
+            SetSupportActionBar(toolbar);
             SupportActionBar.Title = "History in Paderborn";

             // Attach item selected handler to navigation view
-            var navigationView = FindViewById<NavigationView> (Resource.Id.nav_view);
+            var navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
             navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;

             // Create ActionBarDrawerToggle button and add it to the toolbar
-            var drawerToggle = new ActionBarDrawerToggle (this, drawerLayout, toolbar, Resource.String.drawer_open, Resource.String.drawer_close);
-            drawerLayout.SetDrawerListener (drawerToggle);
-            drawerToggle.SyncState ();
-        }
-
-        private void SetUpPermissions ()
+            var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.drawer_open,
+                Resource.String.drawer_close);
+            drawerLayout.SetDrawerListener(drawerToggle);
+            drawerToggle.SyncState();
+        }
+
+        private void SetUpPermissions()
         {
             // Check if we have the necessary permissions and request them if we don't
             // Note that the app will still fail on first launch and needs to be restarted
-            if (ContextCompat.CheckSelfPermission (this,
-                                                   Manifest.Permission.AccessFineLocation)
-                != Permission.Granted || ContextCompat.CheckSelfPermission (this,
-                                                                            Manifest.Permission.ReadExternalStorage)
-                != Permission.Granted || ContextCompat.CheckSelfPermission (this,
-                                                                            Manifest.Permission.WriteExternalStorage)
+            if (ContextCompat.CheckSelfPermission(this,
+                Manifest.Permission.AccessFineLocation)
+                != Permission.Granted || ContextCompat.CheckSelfPermission(this,
+                    Manifest.Permission.ReadExternalStorage)
+                != Permission.Granted || ContextCompat.CheckSelfPermission(this,
+                    Manifest.Permission.WriteExternalStorage)
                 != Permission.Granted)
             {
-                ActivityCompat.RequestPermissions (this,
-                                                   new[]
-                                                   {Manifest.Permission.AccessFineLocation, Manifest.Permission.ReadExternalStorage, Manifest.Permission.WriteExternalStorage},
-                                                   0);
+                ActivityCompat.RequestPermissions(this,
+                    new[]
+                    {
+                        Manifest.Permission.AccessFineLocation, Manifest.Permission.ReadExternalStorage,
+                        Manifest.Permission.WriteExternalStorage
+                    },
+                    0);
             }
         }

         //handles the action when touching the menuitems in navigationview
-        private void NavigationView_NavigationItemSelected (object sender, NavigationView.NavigationItemSelectedEventArgs e)
+        private void NavigationView_NavigationItemSelected(object sender,
+            NavigationView.NavigationItemSelectedEventArgs e)
         {
             switch (e.MenuItem.ItemId)
             {
@@ -144,52 +149,49 @@
                     break;
                 case Resource.Id.nav_route:
                     // React on 'Messages' selection
-                    Intent intent= new Intent(this, typeof(RouteDetailsActivity));
-                    intent.PutExtra(RouteDetailsActivity.KEY_ROUTE_ID, RouteManager.GetRoutes().First().Id);
-                    ActivityCompat.StartActivity(this, intent, null);
                     break;
                 case Resource.Id.nav_licenses:
-                    StartActivity (typeof (LicensingActivity));
+                    StartActivity(typeof(LicensingActivity));
                     break;
             }

             // Close drawer
-            drawerLayout.CloseDrawers ();
-        }
-
-        protected override void OnDestroy ()
-        {
-            base.OnDestroy ();
-
-            // hockeyapp code
-            UnregisterManagers ();
-        }
-
-        protected override void OnResume ()
-        {
-            base.OnResume ();
-
-            // hockeyapp code
-            CheckForCrashes ();
-        }
-
-        protected override void OnPause ()
-        {
-            base.OnPause ();
-
-            // hockeyapp code
-            UnregisterManagers ();
-        }
-
-        public override void OnBackPressed ()
-        {
-            if (drawerLayout.IsDrawerOpen (GravityCompat.Start))
-            {
-                drawerLayout.CloseDrawer (GravityCompat.Start);
+            drawerLayout.CloseDrawers();
+        }
+
+        protected override void OnDestroy()
+        {
+            base.OnDestroy();
+
+            // hockeyapp code
+            UnregisterManagers();
+        }
+
+        protected override void OnResume()
+        {
+            base.OnResume();
+
+            // hockeyapp code
+            CheckForCrashes();
+        }
+
+        protected override void OnPause()
+        {
+            base.OnPause();
+
+            // hockeyapp code
+            UnregisterManagers();
+        }
+
+        public override void OnBackPressed()
+        {
+            if (drawerLayout.IsDrawerOpen(GravityCompat.Start))
+            {
+                drawerLayout.CloseDrawer(GravityCompat.Start);
             }
             else
             {
-                base.OnBackPressed ();
+                base.OnBackPressed();
             }
         }

@@ -198,20 +200,20 @@
         /// </summary>

         #region
-        private void CheckForCrashes ()
-        {
-            CrashManager.Register (this);
-        }
-
-        private void CheckForUpdates ()
+        private void CheckForCrashes()
+        {
+            CrashManager.Register(this);
+        }
+
+        private void CheckForUpdates()
         {
             // Remove this for store builds!
-            UpdateManager.Register (this);
-        }
-
-        private void UnregisterManagers ()
-        {
-            UpdateManager.Unregister ();
+            UpdateManager.Register(this);
+        }
+
+        private void UnregisterManagers()
+        {
+            UpdateManager.Unregister();
         }

         #endregion


Adding Expand behavior config option

Adding Expand behavior config option

--- Highway/src/Highway.Data/OData/Queries/ODataQuery.cs
+++ Highway/src/Highway.Data/OData/Queries/ODataQuery.cs
@@ -15,10 +15,41 @@
     public class ODataQuery<T> : QueryBase, IScalar<ODataResult<T>>
         where T : class
     {
-        public ODataQuery(NameValueCollection queryParameters)
+        public ODataQuery(NameValueCollection queryParameters, ExpandBehavior expandBehavior = ExpandBehavior.None)
         {
+            queryParameters = ApplyExpansionBehavior(queryParameters, expandBehavior);
             ModelFilter = new ParameterParser<T>().Parse(queryParameters);
         }
+
+        private NameValueCollection ApplyExpansionBehavior(NameValueCollection queryParameters, ExpandBehavior expandBehavior)
+        {
+            switch (expandBehavior)
+            {
+                case ExpandBehavior.OneLevel:
+                    {
+                        var values = queryParameters.GetValues("$expand");
+                        if (values != null)
+                        {
+                            queryParameters.Remove("$expand");
+                            foreach (var value in values.Where(value => !value.Contains("/")))
+                            {
+                                queryParameters.Add("$expand", value);
+                            }
+                        }
+                    }
+                    break;
+                case ExpandBehavior.None:
+                    {
+                        queryParameters.Remove("$expand");
+                        return queryParameters;
+                    }
+                default:
+                    return queryParameters;
+
+            }
+            throw new NotImplementedException();
+        }
+
         /// <summary>
         ///     This executes the expression in ContextQuery on the context that is passed in, resulting in a an <see cref="ODataResult{T}"/>
         /// </summary>
@@ -93,4 +124,23 @@

         protected readonly IModelFilter<T> ModelFilter;
     }
+
+    /// <summary>
+    /// Expand behavior modifies how the $expand keyword in OData functions
+    /// </summary>
+    public enum ExpandBehavior
+    {
+        /// <summary>
+        /// None disables the ability to expand at all ( this is the Highway.Data default )
+        /// </summary>
+        None,
+        /// <summary>
+        /// SingleLevel allows for expansion of objects directly related to the object under query
+        /// </summary>
+        OneLevel,
+        /// <summary>
+        /// All allows for any expansion ( this is the OData specification default )
+        /// </summary>
+        All
+    }
 }


string -> String

string -> String

--- Kudu.FunctionalTests/GitRepositoryManagementTests.cs
+++ Kudu.FunctionalTests/GitRepositoryManagementTests.cs
@@ -734,7 +734,7 @@
                     Assert.Equal(1, results.Count);
                     Assert.Equal(expectedStatus, results[0].Status);
                     KuduAssert.VerifyUrl(appManager.SiteUrl, expectedText);
-                    if (!string.IsNullOrEmpty(expectedLog))
+                    if (!String.IsNullOrEmpty(expectedLog))
                     {
                         KuduAssert.VerifyLogOutput(appManager, results[0].Id, expectedLog);
                     }


Bugfixes #FIX: Fixed Dictionary cloning behavior, which failed to provide cloned key-value pairs for reference types.

--- Duality/Cloning/Surrogates/DictionarySurrogate.cs
+++ Duality/Cloning/Surrogates/DictionarySurrogate.cs
@@ -27,7 +27,32 @@
 		{
 			IDictionary<T,U> dict = this.RealObject as IDictionary<T,U>;
 			targetObj.Clear();
-			foreach (var pair in dict) targetObj.Add(pair.Key, pair.Value);
+
+			// Determine unwrapping behavior to provide faster / more optimized loops.
+			bool isReferenceTypeKey = !typeof(T).IsDeepByValueType();
+			bool isReferenceTypeValue = !typeof(U).IsDeepByValueType();
+
+			// Copy all pairs. Don't check each pair, if the Type won't be unwrapped anyway.
+			if (isReferenceTypeKey && isReferenceTypeValue)
+			{
+				foreach (var pair in dict)
+					targetObj.Add(provider.RequestObjectClone(pair.Key), provider.RequestObjectClone(pair.Value));
+			}
+			else if (isReferenceTypeKey)
+			{
+				foreach (var pair in dict)
+					targetObj.Add(provider.RequestObjectClone(pair.Key), pair.Value);
+			}
+			else if (isReferenceTypeValue)
+			{
+				foreach (var pair in dict)
+					targetObj.Add(pair.Key, provider.RequestObjectClone(pair.Value));
+			}
+			else
+			{
+				foreach (var pair in dict)
+					targetObj.Add(pair.Key, pair.Value);
+			}
 		}
 	}
 }


More refactoring to reduce the number of shared variables used when calling around in the BackupHandler class

--- Duplicati/Library/Main/Operation/BackupHandler.cs
+++ Duplicati/Library/Main/Operation/BackupHandler.cs
@@ -12,7 +12,6 @@
     internal class BackupHandler : IDisposable
     {
         private readonly Options m_options;
-        private BackendManager m_backend;
         private string m_backendurl;

         private byte[] m_blockbuffer;
@@ -25,8 +24,6 @@
         private BlockVolumeWriter m_blockvolume;
         private IndexVolumeWriter m_indexvolume;
         private FilesetVolumeWriter m_filesetvolume;
-
-        private Snapshots.ISnapshotService m_snapshot;

         private readonly IMetahash EMPTY_METADATA;

@@ -267,17 +264,18 @@
                 (Library.Snapshots.ISnapshotService)new Duplicati.Library.Snapshots.NoSnapshotWindows(sources, options.RawOptions);
         }

-        private void CountFilesThread()
-        {
+        private void CountFilesThread(object state)
+        {
+            var snapshot = (Snapshots.ISnapshotService)state;
             var updater = m_result.OperationProgressUpdater;
             var count = 0L;
             var size = 0L;
             var followSymlinks = m_options.SymlinkPolicy != Duplicati.Library.Main.Options.SymlinkStrategy.Follow;

-            foreach(var path in new FilterHandler(m_snapshot, m_attributeFilter, m_sourceFilter, m_filter, m_symlinkPolicy, m_options.HardlinkPolicy, null).EnumerateFilesAndFolders())
+            foreach(var path in new FilterHandler(snapshot, m_attributeFilter, m_sourceFilter, m_filter, m_symlinkPolicy, m_options.HardlinkPolicy, null).EnumerateFilesAndFolders())
             {
                 var fa = FileAttributes.Normal;
-                try { fa = m_snapshot.GetAttributes(path); }
+                try { fa = snapshot.GetAttributes(path); }
                 catch { }

                 if (followSymlinks && ((fa & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint))
@@ -287,7 +285,7 @@

                 count++;

-                try { size += m_snapshot.GetFileSize(path); }
+                try { size += snapshot.GetFileSize(path); }
                 catch { }

                 m_result.OperationProgressUpdater.UpdatefileCount(count, size, false);
@@ -297,7 +295,7 @@

         }

-        private void UploadSyntheticFilelist()
+        private void UploadSyntheticFilelist(BackendManager backend)
         {
             var incompleteFilesets = m_database.GetIncompleteFilesets(null).OrderBy(x => x.Value).ToArray();
             if (incompleteFilesets.Length != 0)
@@ -360,7 +358,7 @@
                             using(new Logging.Timer("CommitUpdateFilelistVolume"))
                                 trn.Commit();

-                            m_backend.Put(fsw);
+                            backend.Put(fsw);
                             fsw = null;
                         }
                     }
@@ -406,13 +404,13 @@
                     else
                     {
                         m_database.UpdateRemoteVolume(w.RemoteFilename, RemoteVolumeState.Uploading, -1, null, null);
-                        m_backend.Put(w);
-                    }
-                }
-            }
-        }
-
-        private void PreBackupVerify()
+                        backend.Put(w);
+                    }
+                }
+            }
+        }
+
+        private void PreBackupVerify(BackendManager backend)
         {
             m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Backup_PreBackupVerify);
             using(new Logging.Timer("PreBackupVerify"))
@@ -420,9 +418,9 @@
                 try
                 {
                     if (m_options.NoBackendverification)
-                        FilelistProcessor.VerifyLocalList(m_backend, m_options, m_database, m_result.BackendWriter);
+                        FilelistProcessor.VerifyLocalList(backend, m_options, m_database, m_result.BackendWriter);
                     else
-                        FilelistProcessor.VerifyRemoteList(m_backend, m_options, m_database, m_result.BackendWriter);
+                        FilelistProcessor.VerifyRemoteList(backend, m_options, m_database, m_result.BackendWriter);
                 }
                 catch (Exception ex)
                 {
@@ -430,10 +428,10 @@
                     {
                         m_result.AddWarning("Backend verification failed, attempting automatic cleanup", ex);
                         m_result.RepairResults = new RepairResults(m_result);
-                        new RepairHandler(m_backend.BackendUrl, m_options, (RepairResults)m_result.RepairResults).Run();
+                        new RepairHandler(backend.BackendUrl, m_options, (RepairResults)m_result.RepairResults).Run();

                         m_result.AddMessage("Backend cleanup finished, retrying verification");
-                        FilelistProcessor.VerifyRemoteList(m_backend, m_options, m_database, m_result.BackendWriter);
+                        FilelistProcessor.VerifyRemoteList(backend, m_options, m_database, m_result.BackendWriter);
                     }
                     else
                         throw;
@@ -441,9 +439,9 @@
             }
         }

-        private void RunMainOperation()
-        {
-            var filterhandler = new FilterHandler(m_snapshot, m_attributeFilter, m_sourceFilter, m_filter, m_symlinkPolicy, m_options.HardlinkPolicy, m_result);
+        private void RunMainOperation(Snapshots.ISnapshotService snapshot, BackendManager backend)
+        {
+            var filterhandler = new FilterHandler(snapshot, m_attributeFilter, m_sourceFilter, m_filter, m_symlinkPolicy, m_options.HardlinkPolicy, m_result);

             using(new Logging.Timer("BackupMainOperation"))
             {
@@ -462,7 +460,7 @@

                         try
                         {
-                            this.HandleFilesystemEntry(p, m_snapshot.GetAttributes(p));
+                            this.HandleFilesystemEntry(snapshot, backend, p, snapshot.GetAttributes(p));
                         }
                         catch (Exception ex)
                         {
@@ -483,10 +481,10 @@
                         }

                         var fa = FileAttributes.Normal;
-                        try { fa = m_snapshot.GetAttributes(path); }
+                        try { fa = snapshot.GetAttributes(path); }
                         catch { }

-                        this.HandleFilesystemEntry(path, fa);
+                        this.HandleFilesystemEntry(snapshot, backend, path, fa);
                     }

                 }
@@ -495,7 +493,7 @@
             }
         }

-        private long FinalizeRemoteVolumes()
+        private long FinalizeRemoteVolumes(BackendManager backend)
         {
             var lastVolumeSize = -1L;
             m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Backup_Finalize);
@@ -531,7 +529,7 @@
                             m_transaction.Commit();
                         m_transaction = m_database.BeginTransaction();

-                        m_backend.Put(m_blockvolume, m_indexvolume);
+                        backend.Put(m_blockvolume, m_indexvolume);

                         using(new Logging.Timer("CommitUpdateRemoteVolume"))
                             m_transaction.Commit();
@@ -546,7 +544,7 @@
             return lastVolumeSize;
         }

-        private void UploadRealFileList()
+        private void UploadRealFileList(BackendManager backend)
         {
             var changeCount =
                 m_result.AddedFiles + m_result.ModifiedFiles + m_result.DeletedFiles +
@@ -575,7 +573,7 @@
                             m_transaction.Commit();
                         m_transaction = m_database.BeginTransaction();

-                        m_backend.Put(m_filesetvolume);
+                        backend.Put(m_filesetvolume);

                         using(new Logging.Timer("CommitUpdateRemoteVolume"))
                             m_transaction.Commit();
@@ -591,7 +589,7 @@
             }
         }

-        private void CompactIfRequired(long lastVolumeSize)
+        private void CompactIfRequired(BackendManager backend, long lastVolumeSize)
         {
             var currentIsSmall = lastVolumeSize != -1 && lastVolumeSize <= m_options.SmallFileSize;

@@ -600,7 +598,7 @@
                 m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Backup_Delete);
                 m_result.DeleteResults = new DeleteResults(m_result);
                 using(var db = new LocalDeleteDatabase(m_database))
-                    new DeleteHandler(m_backend.BackendUrl, m_options, (DeleteResults)m_result.DeleteResults).DoRun(db, ref m_transaction, true, currentIsSmall);
+                    new DeleteHandler(backend.BackendUrl, m_options, (DeleteResults)m_result.DeleteResults).DoRun(db, ref m_transaction, true, currentIsSmall);

             }
             else if (currentIsSmall && !m_options.NoAutoCompact)
@@ -608,7 +606,7 @@
                 m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Backup_Compact);
                 m_result.CompactResults = new CompactResults(m_result);
                 using(var db = new LocalDeleteDatabase(m_database))
-                    new CompactHandler(m_backend.BackendUrl, m_options, (CompactResults)m_result.CompactResults).DoCompact(db, true, ref m_transaction);
+                    new CompactHandler(backend.BackendUrl, m_options, (CompactResults)m_result.CompactResults).DoCompact(db, true, ref m_transaction);
             }
         }

@@ -676,64 +674,62 @@

                 try
                 {
-                    m_snapshot = GetSnapshot(sources, m_options, m_result);
-
-                    // Start parallel scan
-                    if (m_options.ChangedFilelist == null || m_options.ChangedFilelist.Length < 1)
-                    {
-                        parallelScanner = new System.Threading.Thread(CountFilesThread) {
-                            Name = "Read ahead file counter",
-                            IsBackground = true
-                        };
-                        parallelScanner.Start();
-                    }
-
-                    using(m_backend = new BackendManager(m_backendurl, m_options, m_result.BackendWriter, m_database))
-                    using(m_filesetvolume = new FilesetVolumeWriter(m_options, m_database.OperationTimestamp))
-                    {
-                        PreBackupVerify();
-
-                        // Verify before uploading a synthetic list
-                        m_database.VerifyConsistency(null, m_options.Blocksize, m_options.BlockhashSize);
-                        UploadSyntheticFilelist();
-
-                        m_database.BuildLookupTable(m_options);
-                        m_transaction = m_database.BeginTransaction();
-
-                        m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Backup_ProcessingFiles);
-                        var filesetvolumeid = m_database.RegisterRemoteVolume(m_filesetvolume.RemoteFilename, RemoteVolumeType.Files, RemoteVolumeState.Temporary, m_transaction);
-                        m_database.CreateFileset(filesetvolumeid, VolumeBase.ParseFilename(m_filesetvolume.RemoteFilename).Time, m_transaction);
-
-                        RunMainOperation();
-
-                        //If the scanner is still running for some reason, make sure we kill it now
-                        if (parallelScanner != null && parallelScanner.IsAlive)
-                            parallelScanner.Abort();
-
-                        // We no longer need the snapshot active
-                        try { m_snapshot.Dispose(); }
-                        finally { m_snapshot = null; }
-
-                        var lastVolumeSize = FinalizeRemoteVolumes();
+
+                    using(var backend = new BackendManager(m_backendurl, m_options, m_result.BackendWriter, m_database))
+                    using(var filesetvolume = new FilesetVolumeWriter(m_options, m_database.OperationTimestamp))
+                    {
+                        using(var snapshot = GetSnapshot(sources, m_options, m_result))
+                        {
+                            // Start parallel scan
+                            if (m_options.ChangedFilelist == null || m_options.ChangedFilelist.Length < 1)
+                            {
+                                parallelScanner = new System.Threading.Thread(CountFilesThread) {
+                                    Name = "Read ahead file counter",
+                                    IsBackground = true
+                                };
+                                parallelScanner.Start(snapshot);
+                            }
+
+                            PreBackupVerify(backend);
+
+                            // Verify before uploading a synthetic list
+                            m_database.VerifyConsistency(null, m_options.Blocksize, m_options.BlockhashSize);
+                            UploadSyntheticFilelist(backend);
+
+                            m_database.BuildLookupTable(m_options);
+                            m_transaction = m_database.BeginTransaction();
+
+                            m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Backup_ProcessingFiles);
+                            var filesetvolumeid = m_database.RegisterRemoteVolume(m_filesetvolume.RemoteFilename, RemoteVolumeType.Files, RemoteVolumeState.Temporary, m_transaction);
+                            m_database.CreateFileset(filesetvolumeid, VolumeBase.ParseFilename(m_filesetvolume.RemoteFilename).Time, m_transaction);
+
+                            RunMainOperation(snapshot, backend);
+
+                            //If the scanner is still running for some reason, make sure we kill it now
+                            if (parallelScanner != null && parallelScanner.IsAlive)
+                                parallelScanner.Abort();
+                        }
+
+                        var lastVolumeSize = FinalizeRemoteVolumes(backend);

                         using(new Logging.Timer("UpdateChangeStatistics"))
                             m_database.UpdateChangeStatistics(m_result);
                         using(new Logging.Timer("VerifyConsistency"))
                             m_database.VerifyConsistency(m_transaction, m_options.Blocksize, m_options.BlockhashSize);

-                        UploadRealFileList();
+                        UploadRealFileList(backend);

                         m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Backup_WaitForUpload);
                         using(new Logging.Timer("Async backend wait"))
-                            m_backend.WaitForComplete(m_database, m_transaction);
+                            backend.WaitForComplete(m_database, m_transaction);

                         if (m_result.TaskControlRendevouz() != TaskControlState.Stop)
-                            CompactIfRequired(lastVolumeSize);
+                            CompactIfRequired(backend, lastVolumeSize);

                         if (m_options.UploadVerificationFile)
                         {
                             m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Backup_VerificationUpload);
-                            FilelistProcessor.UploadVerificationFile(m_backend.BackendUrl, m_options, m_result.BackendWriter, m_database, m_transaction);
+                            FilelistProcessor.UploadVerificationFile(backend.BackendUrl, m_options, m_result.BackendWriter, m_database, m_transaction);
                         }

                         if (m_options.Dryrun)
@@ -777,11 +773,6 @@
                             m_result.AddWarning("Failed to terminate filecounter thread", null);
                     }

-                    if (m_snapshot != null)
-                        try { m_snapshot.Dispose(); }
-                        catch (Exception ex) { m_result.AddError(string.Format("Failed to dispose snapshot"), ex); }
-                        finally { m_snapshot = null; }
-
                     if (m_transaction != null)
                         try { m_transaction.Rollback(); }
                         catch (Exception ex) { m_result.AddError(string.Format("Rollback error: {0}", ex.Message), ex); }
@@ -789,7 +780,7 @@
             }
         }

-        private Dictionary<string, string> GenerateMetadata(string path, System.IO.FileAttributes attributes)
+        private Dictionary<string, string> GenerateMetadata(Snapshots.ISnapshotService snapshot, string path, System.IO.FileAttributes attributes)
         {
             try
             {
@@ -797,7 +788,7 @@

                 if (m_options.StoreMetadata)
                 {
-                    metadata = m_snapshot.GetMetadata(path);
+                    metadata = snapshot.GetMetadata(path);
                     if (metadata == null)
                         metadata = new Dictionary<string, string>();

@@ -808,7 +799,7 @@
                     {
                         try
                         {
-                            metadata["CoreLastWritetime"] = m_snapshot.GetLastWriteTimeUtc(path).Ticks.ToString();
+                            metadata["CoreLastWritetime"] = snapshot.GetLastWriteTimeUtc(path).Ticks.ToString();
                         }
                         catch (Exception ex)
                         {
@@ -820,7 +811,7 @@
                     {
                         try
                         {
-                            metadata["CoreCreatetime"] = m_snapshot.GetCreationTimeUtc(path).Ticks.ToString();
+                            metadata["CoreCreatetime"] = snapshot.GetCreationTimeUtc(path).Ticks.ToString();
                         }
                         catch (Exception ex)
                         {
@@ -842,11 +833,11 @@
             }
         }

-        private bool HandleFilesystemEntry(string path, System.IO.FileAttributes attributes)
+        private bool HandleFilesystemEntry(Snapshots.ISnapshotService snapshot, BackendManager backend, string path, System.IO.FileAttributes attributes)
         {
             // If we lost the connection, there is no point in keeping on processing
-            if (m_backend.HasDied)
-                throw m_backend.LastException;
+            if (backend.HasDied)
+                throw backend.LastException;

             try
             {
@@ -855,13 +846,13 @@
                 if (m_backendLogFlushTimer < DateTime.Now)
                 {
                     m_backendLogFlushTimer = DateTime.Now.Add(FLUSH_TIMESPAN);
-                    m_backend.FlushDbMessages(m_database, null);
+                    backend.FlushDbMessages(m_database, null);
                 }

                 DateTime lastwrite = new DateTime(0, DateTimeKind.Utc);
                 try
                 {
-                    lastwrite = m_snapshot.GetLastWriteTimeUtc(path);
+                    lastwrite = snapshot.GetLastWriteTimeUtc(path);
                 }
                 catch (Exception ex)
                 {
@@ -878,13 +869,13 @@

                     if (m_options.SymlinkPolicy == Options.SymlinkStrategy.Store)
                     {
-                        Dictionary<string, string> metadata = GenerateMetadata(path, attributes);
+                        Dictionary<string, string> metadata = GenerateMetadata(snapshot, path, attributes);

                         if (!metadata.ContainsKey("CoreSymlinkTarget"))
-                            metadata["CoreSymlinkTarget"] = m_snapshot.GetSymlinkTarget(path);
+                            metadata["CoreSymlinkTarget"] = snapshot.GetSymlinkTarget(path);

                         var metahash = Utility.WrapMetadata(metadata, m_options);
-                        AddSymlinkToOutput(path, DateTime.UtcNow, metahash);
+                        AddSymlinkToOutput(backend, path, DateTime.UtcNow, metahash);

                         m_result.AddVerboseMessage("Stored symlink {0}", path);
                         //Do not recurse symlinks
@@ -898,7 +889,7 @@

                     if (m_options.StoreMetadata)
                     {
-                        metahash = Utility.WrapMetadata(GenerateMetadata(path, attributes), m_options);
+                        metahash = Utility.WrapMetadata(GenerateMetadata(snapshot, path, attributes), m_options);
                     }
                     else
                     {
@@ -906,7 +897,7 @@
                     }

                     m_result.AddVerboseMessage("Adding directory {0}", path);
-                    AddFolderToOutput(path, lastwrite, metahash);
+                    AddFolderToOutput(backend, path, lastwrite, metahash);
                     return true;
                 }

@@ -922,10 +913,10 @@
                 var oldId = m_database.GetFileEntry(path, out oldModified, out lastFileSize, out oldMetahash, out oldMetasize);

                 long filestatsize = -1;
-                try { filestatsize = m_snapshot.GetFileSize(path); }
+                try { filestatsize = snapshot.GetFileSize(path); }
                 catch { }

-                IMetahash metahashandsize = m_options.StoreMetadata ? Utility.WrapMetadata(GenerateMetadata(path, attributes), m_options) : EMPTY_METADATA;
+                IMetahash metahashandsize = m_options.StoreMetadata ? Utility.WrapMetadata(GenerateMetadata(snapshot, path, attributes), m_options) : EMPTY_METADATA;

                 var timestampChanged = lastwrite != oldModified || lastwrite.Ticks == 0 || oldModified.Ticks == 0;
                 var filesizeChanged = filestatsize < 0 || lastFileSize < 0 || filestatsize != lastFileSize;
@@ -946,7 +937,7 @@
                     using (var blocklisthashes = new Library.Utility.FileBackedStringList())
                     using (var hashcollector = new Library.Utility.FileBackedStringList())
                     {
-                        using (var fs = new Blockprocessor(m_snapshot.OpenRead(path), m_blockbuffer))
+                        using (var fs = new Blockprocessor(snapshot.OpenRead(path), m_blockbuffer))
                         {
                             try { m_result.OperationProgressUpdater.StartFile(path, fs.Length); }
                             catch (Exception ex) { m_result.AddWarning(string.Format("Failed to read file length for file {0}", path), ex); }
@@ -969,7 +960,7 @@
                                 {
                                     var blkey = Convert.ToBase64String(m_blockhasher.ComputeHash(m_blocklistbuffer, 0, blocklistoffset));
                                     blocklisthashes.Add(blkey);
-                                    AddBlockToOutput(blkey, m_blocklistbuffer, 0, blocklistoffset, CompressionHint.Noncompressible, true);
+                                    AddBlockToOutput(backend, blkey, m_blocklistbuffer, 0, blocklistoffset, CompressionHint.Noncompressible, true);
                                     blocklistoffset = 0;
                                 }

@@ -977,7 +968,7 @@
                                 blocklistoffset += blockkey.Length;

                                 var key = Convert.ToBase64String(blockkey);
-                                AddBlockToOutput(key, m_blockbuffer, offset, size, hint, false);
+                                AddBlockToOutput(backend, key, m_blockbuffer, offset, size, hint, false);
                                 hashcollector.Add(key);
                                 filesize += size;

@@ -1001,7 +992,7 @@
                             {
                                 var blkeyfinal = Convert.ToBase64String(m_blockhasher.ComputeHash(m_blocklistbuffer, 0, blocklistoffset));
                                 blocklisthashes.Add(blkeyfinal);
-                                AddBlockToOutput(blkeyfinal, m_blocklistbuffer, 0, blocklistoffset, CompressionHint.Noncompressible, true);
+                                AddBlockToOutput(backend, blkeyfinal, m_blocklistbuffer, 0, blocklistoffset, CompressionHint.Noncompressible, true);
                             }
                         }

@@ -1032,13 +1023,13 @@
 					            	m_result.AddDryrunMessage(string.Format("Would add changed file {0}, size {1}", path, Library.Utility.Utility.FormatSizeString(filesize)));
                             }

-                            AddFileToOutput(path, filesize, lastwrite, metahashandsize, hashcollector, filekey, blocklisthashes);
+                            AddFileToOutput(backend, path, filesize, lastwrite, metahashandsize, hashcollector, filekey, blocklisthashes);
                             changed = true;
                         }
                         else if (metadatachanged)
                         {
                             m_result.AddVerboseMessage("File has only metadata changes {0}", path);
-                            AddFileToOutput(path, filesize, lastwrite, metahashandsize, hashcollector, filekey, blocklisthashes);
+                            AddFileToOutput(backend, path, filesize, lastwrite, metahashandsize, hashcollector, filekey, blocklisthashes);
                             changed = true;
                         }
                         else
@@ -1052,7 +1043,7 @@
                 }
                 else
                 {
-                    if (m_options.SkipFilesLargerThan == long.MaxValue || m_options.SkipFilesLargerThan == 0 || m_snapshot.GetFileSize(path) < m_options.SkipFilesLargerThan)
+                    if (m_options.SkipFilesLargerThan == long.MaxValue || m_options.SkipFilesLargerThan == 0 || snapshot.GetFileSize(path) < m_options.SkipFilesLargerThan)
                         m_result.AddVerboseMessage("Skipped checking file, because timestamp was not updated {0}", path);
                     else
                         m_result.AddVerboseMessage("Skipped checking file, because the size exceeds limit {0}", path);
@@ -1083,7 +1074,7 @@
         /// <param name="offset">The offset into the data</param>
         /// <param name="hint">Hint for compression module</param>
         /// <param name="isBlocklistData">Indicates if the block is list data</param>
-        private bool AddBlockToOutput(string key, byte[] data, int offset, int len, CompressionHint hint, bool isBlocklistData)
+        private bool AddBlockToOutput(BackendManager backend, string key, byte[] data, int offset, int len, CompressionHint hint, bool isBlocklistData)
         {
             if (m_database.AddBlock(key, len, m_blockvolume.VolumeID, m_transaction))
             {
@@ -1137,14 +1128,14 @@
                         m_blockvolume.Close();
 	            		UpdateIndexVolume();

-	                	m_backend.FlushDbMessages(m_database, m_transaction);
+	                	backend.FlushDbMessages(m_database, m_transaction);
         				m_backendLogFlushTimer = DateTime.Now.Add(FLUSH_TIMESPAN);

                         using(new Logging.Timer("CommitAddBlockToOutputFlush"))
                             m_transaction.Commit();
                         m_transaction = m_database.BeginTransaction();

-                        m_backend.Put(m_blockvolume, m_indexvolume);
+                        backend.Put(m_blockvolume, m_indexvolume);
                         m_blockvolume = null;
                         m_indexvolume = null;

@@ -1176,7 +1167,7 @@
         /// <param name="size">The size of the file</param>
         /// <param name="fragmentoffset">The offset into a fragment block where the last few bytes are stored</param>
         /// <param name="metadata">A lookup table with various metadata values describing the file</param>
-        private bool AddFolderToOutput(string filename, DateTime lastModified, IMetahash meta)
+        private bool AddFolderToOutput(BackendManager backend, string filename, DateTime lastModified, IMetahash meta)
         {
             long metadataid;
             bool r = false;
@@ -1184,7 +1175,7 @@
             if (meta.Size > m_blocksize)
                 throw new InvalidDataException(string.Format("Too large metadata, cannot handle more than {0} bytes", m_blocksize));

-            r |= AddBlockToOutput(meta.Hash, meta.Blob, 0, (int)meta.Size, CompressionHint.Default, false);
+            r |= AddBlockToOutput(backend, meta.Hash, meta.Blob, 0, (int)meta.Size, CompressionHint.Default, false);
             r |= m_database.AddMetadataset(meta.Hash, meta.Size, out metadataid, m_transaction);

             m_database.AddDirectoryEntry(filename, metadataid, lastModified, m_transaction);
@@ -1200,7 +1191,7 @@
         /// <param name="size">The size of the file</param>
         /// <param name="fragmentoffset">The offset into a fragment block where the last few bytes are stored</param>
         /// <param name="metadata">A lookup table with various metadata values describing the file</param>
-        private bool AddSymlinkToOutput(string filename, DateTime lastModified, IMetahash meta)
+        private bool AddSymlinkToOutput(BackendManager backend, string filename, DateTime lastModified, IMetahash meta)
         {
             long metadataid;
             bool r = false;
@@ -1208,7 +1199,7 @@
             if (meta.Size > m_blocksize)
                 throw new InvalidDataException(string.Format("Too large metadata, cannot handle more than {0} bytes", m_blocksize));

-            r |= AddBlockToOutput(meta.Hash, meta.Blob, 0, (int)meta.Size, CompressionHint.Default, false);
+            r |= AddBlockToOutput(backend, meta.Hash, meta.Blob, 0, (int)meta.Size, CompressionHint.Default, false);
             r |= m_database.AddMetadataset(meta.Hash, meta.Size, out metadataid, m_transaction);

             m_database.AddSymlinkEntry(filename, metadataid, lastModified, m_transaction);
@@ -1224,7 +1215,7 @@
         /// <param name="size">The size of the file</param>
         /// <param name="fragmentoffset">The offset into a fragment block where the last few bytes are stored</param>
         /// <param name="metadata">A lookup table with various metadata values describing the file</param>
-        private void AddFileToOutput(string filename, long size, DateTime lastmodified, IMetahash metadata, IEnumerable<string> hashlist, string filehash, IEnumerable<string> blocklisthashes)
+        private void AddFileToOutput(BackendManager backend, string filename, long size, DateTime lastmodified, IMetahash metadata, IEnumerable<string> hashlist, string filehash, IEnumerable<string> blocklisthashes)
         {
             long metadataid;
             long blocksetid;
@@ -1232,7 +1223,7 @@
             if (metadata.Size > m_blocksize)
                 throw new InvalidDataException(string.Format("Too large metadata, cannot handle more than {0} bytes", m_blocksize));

-            AddBlockToOutput(metadata.Hash, metadata.Blob, 0, (int)metadata.Size, CompressionHint.Default, false);
+            AddBlockToOutput(backend, metadata.Hash, metadata.Blob, 0, (int)metadata.Size, CompressionHint.Default, false);
             m_database.AddMetadataset(metadata.Hash, metadata.Size, out metadataid, m_transaction);

             m_database.AddBlockset(filehash, size, m_blocksize, hashlist, blocklisthashes, out blocksetid, m_transaction);