Support for ignore attribute

Support for ignore attribute

--- AxoCover/Models/TestAssemblyScanner.cs
+++ AxoCover/Models/TestAssemblyScanner.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Reflection;
@@ -14,11 +15,11 @@
       try
       {
         var assembly = Assembly.LoadFrom(assemblyPath);
-        var testClasses = FilterByAttribute(assembly.ExportedTypes, "TestClassAttribute");
+        var testClasses = FilterByAttribute(assembly.ExportedTypes, nameof(TestClassAttribute), nameof(IgnoreAttribute));

         foreach (var testClass in testClasses)
         {
-          var testMethods = FilterByAttribute(testClass.GetMethods(), "TestMethodAttribute");
+          var testMethods = FilterByAttribute(testClass.GetMethods(), nameof(TestMethodAttribute), nameof(IgnoreAttribute));
           var testClassName = testClass.FullName;

           foreach (var testMethod in testMethods)
@@ -36,12 +37,14 @@
       return testItems.ToArray();
     }

-    private static IEnumerable<T> FilterByAttribute<T>(IEnumerable<T> members, string attributeName)
+    private static IEnumerable<T> FilterByAttribute<T>(IEnumerable<T> members, string includedAttributeName, string excludedAttributeName)
       where T : MemberInfo
     {
       foreach (var member in members)
       {
-        if (member.GetCustomAttributesData().Any(p => p.AttributeType.Name == attributeName))
+        var attributes = member.GetCustomAttributesData();
+        if (attributes.Any(p => p.AttributeType.Name == includedAttributeName) &&
+          !attributes.Any(p => p.AttributeType.Name == excludedAttributeName))
         {
           yield return member;
         }


#18723: Fixing Get() when a specific version is requested

Work Item: 18723

--HG--
branch : 1.x

--- src/Orchard/ContentManagement/DefaultContentManager.cs
+++ src/Orchard/ContentManagement/DefaultContentManager.cs
@@ -160,7 +160,16 @@
                         contentItemVersionCriteria.SetMaxResults(1);
                     });

-                versionRecord = contentItemVersionRecords.FirstOrDefault();
+
+                if (options.VersionNumber != 0) {
+                    versionRecord = contentItemVersionRecords.FirstOrDefault(
+                        x => x.Number == options.VersionNumber) ??
+                           _contentItemVersionRepository.Get(
+                               x => x.ContentItemRecord == contentItem.Record && x.Number == options.VersionNumber);
+                }
+                else {
+                    versionRecord = contentItemVersionRecords.FirstOrDefault();
+                }
             }

             // no record means content item is not in db


fix ypub/zpub parsing for all alts

fix ypub/zpub parsing for all alts

@gruve-p reported that ypub import was not working and then found this. no ypub/zpub import for any alts worked before lol

--- BTCPayServer/DerivationSchemeParser.cs
+++ BTCPayServer/DerivationSchemeParser.cs
@@ -17,8 +17,6 @@
         public Network Network => BtcPayNetwork.NBitcoinNetwork;

         public Script HintScriptPubKey { get; set; }
-
-        Dictionary<uint, string[]> ElectrumMapping = new Dictionary<uint, string[]>();

         public DerivationSchemeParser(BTCPayNetwork expectedNetwork)
         {
@@ -42,7 +40,7 @@
             var standardPrefix = Utils.ToBytes(0x0488b21eU, false);
             for (int ii = 0; ii < 4; ii++)
                 data[ii] = standardPrefix[ii];
-            var extPubKey = new BitcoinExtPubKey(Network.GetBase58CheckEncoder().EncodeData(data), Network.Main).ToNetwork(Network);
+            var extPubKey = new BitcoinExtPubKey(Network.GetBase58CheckEncoder().EncodeData(data), Network.NetworkSet.Mainnet).ToNetwork(Network);
             if (!BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type))
             {
                 throw new FormatException();
@@ -119,7 +117,7 @@
                     var standardPrefix = Utils.ToBytes(0x0488b21eU, false);
                     for (int ii = 0; ii < 4; ii++)
                         data[ii] = standardPrefix[ii];
-                    var derivationScheme = new BitcoinExtPubKey(Network.GetBase58CheckEncoder().EncodeData(data), Network.Main).ToNetwork(Network).ToString();
+                    var derivationScheme = new BitcoinExtPubKey(Network.GetBase58CheckEncoder().EncodeData(data), Network.NetworkSet.Mainnet).ToNetwork(Network).ToString();

                     if (BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type))
                     {


I broke the build! (#2496)

I broke the build! (#2496)

--- src/Stratis.SmartContracts.Tools.Sct/ValidatorService.cs
+++ src/Stratis.SmartContracts.Tools.Sct/ValidatorService.cs
@@ -139,6 +139,11 @@
             throw new NotImplementedException();
         }

+        public void Clear(string key)
+        {
+            throw new NotImplementedException();
+        }
+
         public byte[] GetBytes(string key)
         {
             return new byte[] { };


CountBy fixed.

CountBy fixed.

--- BTDB/ODBLayer/RelationDBManipulator.cs
+++ BTDB/ODBLayer/RelationDBManipulator.cs
@@ -442,13 +442,15 @@
         public long CountWithProposition(KeyProposition startKeyProposition, int prefixLen, in ReadOnlySpan<byte> startKeyBytes,
             KeyProposition endKeyProposition, in ReadOnlySpan<byte> endKeyBytes)
         {
+            if (!_kvtr.FindFirstKey(startKeyBytes.Slice(0, prefixLen)))
+                return 0;
+
+            var prefixIndex = _kvtr.GetKeyIndex();
+
             var realEndKeyBytes = endKeyBytes;
             if (endKeyProposition == KeyProposition.Included)
                 realEndKeyBytes =
                     RelationAdvancedEnumerator<T>.FindLastKeyWithPrefix(endKeyBytes, _kvtr);
-
-            _kvtr.FindFirstKey(startKeyBytes.Slice(0, prefixLen));
-            var prefixIndex = _kvtr.GetKeyIndex();

             long startIndex;
             long endIndex;


Use Allow-List; Regex for Slug Generation (#84)

Use allowList to replace invalid characters with empty strings when generating a slug from a given title.
Create allowList using regular expressions.
To do: implement a timeout to prevent against an infinite loop, made vulnerable by usage of regex.

--- BlogTemplate/Services/SlugGenerator.cs
+++ BlogTemplate/Services/SlugGenerator.cs
@@ -3,6 +3,7 @@
 using System.IO;
 using System.Linq;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using BlogTemplate._1.Models;

@@ -20,12 +21,9 @@
         public string CreateSlug(string title)
         {
             string tempTitle = title;
-            char[] invalidChars = Path.GetInvalidFileNameChars();
-            foreach (char c in invalidChars)
-            {
-                tempTitle = tempTitle.Replace(c.ToString(), "");
-            }
-            string slug = tempTitle.Replace(" ", "-");
+            tempTitle = tempTitle.Replace(" ", "-");
+            Regex allowList = new Regex("([^A-Za-z0-9-])");
+            string slug = allowList.Replace(tempTitle, "");
             return slug;
         }
     }


add cascadeoption for delete application api

--- src/Plivo/Resource/Application/ApplicationInterface.cs
+++ src/Plivo/Resource/Application/ApplicationInterface.cs
@@ -216,11 +216,18 @@
         /// </summary>
         /// <returns>The delete.</returns>
         /// <param name="appId">App identifier.</param>
-        public DeleteResponse<Application> Delete(string appId)
-        {
-			return ExecuteWithExceptionUnwrap(() =>
-			{
-				return Task.Run(async () => await DeleteResource<DeleteResponse<Application>>(appId).ConfigureAwait(false)).Result;
+        /// <param name="cascade">Cascade.</param>
+        public DeleteResponse<Application> Delete(string appId, bool? cascade = null)
+        {
+            var data = new Dictionary<string, object> {};
+            if (cascade != null)
+            {
+                data = CreateData(new List<string> {}, new {cascade});
+            }
+
+			return ExecuteWithExceptionUnwrap(() =>
+			{
+				return Task.Run(async () => await DeleteResource<DeleteResponse<Application>>(appId, data).ConfigureAwait(false)).Result;
 			});
 		}
         /// <summary>
@@ -228,9 +235,15 @@
         /// </summary>
         /// <returns>The delete.</returns>
         /// <param name="appId">App identifier.</param>
-        public async Task<DeleteResponse<Application>> DeleteAsync(string appId)
-        {
-            return await DeleteResource<DeleteResponse<Application>>(appId);
+        /// <param name="cascade">Cascade.</param>
+        public async Task<DeleteResponse<Application>> DeleteAsync(string appId, bool? cascade = null)
+        {
+            var data = new Dictionary<string, object> { };
+            if (cascade != null)
+            {
+                data = CreateData(new List<string> { }, new { cascade });
+            }
+            return await DeleteResource<DeleteResponse<Application>>(appId, data);
         }
         #endregion


添加权限提供器接口方法

添加权限提供器接口方法

--- src/Wodsoft.ComBoost.Security/IAuthenticationProvider.cs
+++ src/Wodsoft.ComBoost.Security/IAuthenticationProvider.cs
@@ -1,11 +1,14 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Security.Principal;
 using System.Threading.Tasks;
+using Wodsoft.ComBoost.Security;

 namespace Wodsoft.ComBoost
 {
     public interface IAuthenticationProvider
     {
+        IAuthentication GetAuthentication();
     }
 }


clear collections

clear collections

--- CLSim/Football/UAFA/ChampionsLeague.cs
+++ CLSim/Football/UAFA/ChampionsLeague.cs
@@ -51,6 +51,13 @@
             IsRoundOf16Simulatable = false;
             Season = season;

+            AllTeamsRaw = new ObservableCollection<FootballTeam>();
+            Coefficients = new Dictionary<FootballTeam, Coefficient>();
+            Groups = new ObservableCollection<FootballLeague>();
+            RoundOf16 = new ObservableCollection<DoubleMatch>();
+            QuarterFinals = new ObservableCollection<DoubleMatch>();
+            SemiFinals = new ObservableCollection<DoubleMatch>();
+
             SimpleLog.Info($"Initialized UAFA CL Season {Season}");
         }

@@ -203,7 +210,7 @@
             SimpleLog.Info("Read CL team input.");

             var strTeams = list.Split(new[] {Environment.NewLine, "\n", "\r"}, StringSplitOptions.RemoveEmptyEntries);
-            AllTeamsRaw = new ObservableCollection<FootballTeam>();
+            AllTeamsRaw.Clear();
             foreach(var team in strTeams)
             {
                 try
@@ -264,7 +271,7 @@
         {
             SimpleLog.Info($"Calculate UAFA Coefficient for CL season {Season}.");

-            Coefficients = new Dictionary<FootballTeam, Coefficient>(AllTeamsRaw.Count);
+            Coefficients.Clear();

             // Qualification

@@ -337,12 +344,12 @@
             {
                 var ordered = AllTeamsRaw.OrderBy(x => Globals.Random.Next()).ToArray();

-                Groups = new ObservableCollection<FootballLeague>();
+                Groups.Clear();
                 char groupId = 'A';
                 for(int i = 0; i < ordered.Length; i += 5)
                 {
-                    Groups.Add(new FootballLeague(groupId.ToString(), ordered[i], ordered[i + 1],
-                        ordered[i + 2], ordered[i + 3], ordered[i + 4]));
+                    Groups.Add(new FootballLeague(groupId.ToString(), FootballLeague.EMatchMode.UafaCl, ordered[i],
+                        ordered[i + 1], ordered[i + 2], ordered[i + 3], ordered[i + 4]));
                     groupId = (char) (groupId + 1);
                 }

@@ -465,7 +472,7 @@
                 firsts = firsts.OrderBy(x => Globals.Random.Next()).ToArray();
                 secs = secs.OrderBy(x => Globals.Random.Next()).ToArray();

-                RoundOf16 = new ObservableCollection<DoubleMatch>();
+                RoundOf16.Clear();
                 for(int i = 0; i < firsts.Length; i++)
                     RoundOf16.Add(new DoubleMatch(secs[i], firsts[i]));

@@ -568,7 +575,7 @@
             var teams = RoundOf16.Select(m => m.Winner).ToArray();
             teams = teams.OrderBy(t => Globals.Random.Next()).ToArray();

-            QuarterFinals = new ObservableCollection<DoubleMatch>();
+            QuarterFinals.Clear();
             for(int i = 0; i < teams.Length; i += 2)
                 QuarterFinals.Add(new DoubleMatch(teams[i], teams[i + 1]));
         }
@@ -583,8 +590,8 @@
             var teams = QuarterFinals.Select(m => m.Winner).ToArray();
             teams = teams.OrderBy(t => Globals.Random.Next()).ToArray();

-            SemiFinals = new ObservableCollection<DoubleMatch>();
-            for(int i = 0; i < teams.Length; i += 2)
+            SemiFinals.Clear();
+            for (int i = 0; i < teams.Length; i += 2)
                 SemiFinals.Add(new DoubleMatch(teams[i], teams[i + 1]));
         }


HowTransformFeedbackWorks

HowTransformFeedbackWorks

--- CSharpGL4/HowTransformFeedbackWorks.cs
+++ CSharpGL4/HowTransformFeedbackWorks.cs
@@ -42,15 +42,12 @@
             shader.Initialize();

             // Create program and specify transform feedback variables
-            uint program = ShaderProgram.glCreateProgram();
+            var program = new ShaderProgram();
+            var feedbackVaryings = new string[] { "outValue" };
+            TransformFeedbackObject.glTransformFeedbackVaryings(program.ProgramId, 1, feedbackVaryings, GL.GL_INTERLEAVED_ATTRIBS);
+            program.Initialize(shader);

-            var feedbackVaryings = new string[] { "outValue" };
-            TransformFeedbackObject.glTransformFeedbackVaryings(program, 1, feedbackVaryings, GL.GL_INTERLEAVED_ATTRIBS);
-
-            ShaderProgram.glAttachShader(program, shader.ShaderId);
-
-            ShaderProgram.glLinkProgram(program);
-            ShaderProgram.glUseProgram(program);
+            program.Bind();

             var vao = new uint[1];
             VertexArrayObject.glGenVertexArrays(1, vao);
@@ -68,7 +65,7 @@
                 pinned.Free();
             }

-            uint inputAttrib = (uint)ShaderProgram.glGetAttribLocation(program, "inValue");
+            uint inputAttrib = (uint)ShaderProgram.glGetAttribLocation(program.ProgramId, "inValue");
             VertexBuffer.glEnableVertexAttribArray(inputAttrib);
             VertexBuffer.glVertexAttribPointer(inputAttrib, 1, GL.GL_FLOAT, false, 0, IntPtr.Zero);


- Fix issues from code inspections

- Fix issues from code inspections

--- CSharpStorage.UnitTests/Class_names.cs
+++ CSharpStorage.UnitTests/Class_names.cs
@@ -28,7 +28,7 @@
             {
                 public string Value3 { get; set; }

-                public void SomeMethod()
+                public new void SomeMethod()
                 {
                     var val = new { x = "40", y = 50, z = 60L };
                     Console.WriteLine(val.x);


Change the SinkRef documentation temporarily until we can fix serialization (#4431)

--- src/core/Akka.Docs.Tests/Streams/StreamRefsDocTests.cs
+++ src/core/Akka.Docs.Tests/Streams/StreamRefsDocTests.cs
@@ -101,7 +101,7 @@
                     StreamRefs.SinkRef<string>()
                         .To(sink)
                         .Run(Context.System.Materializer())
-                        .PipeTo(Sender, success: sinkRef => new MeasurementsSinkReady(prepare.Id, sinkRef));
+                        .PipeTo(Sender, success: sinkRef => sinkRef);
                 });
             }

@@ -135,12 +135,12 @@
             #region sink-ref-materialization
             var receiver = Sys.ActorOf(Props.Create<DataReceiver>(), "receiver");

-            var ready = await receiver.Ask<MeasurementsSinkReady>(new PrepareUpload("id"), timeout: TimeSpan.FromSeconds(30));
+            var ready = await receiver.Ask<ISinkRef<string>>(new PrepareUpload("id"), timeout: TimeSpan.FromSeconds(30));

             // stream local metrics to Sink's origin:
             Source.From(Enumerable.Range(1, 100))
                 .Select(i => i.ToString())
-                .RunWith(ready.SinkRef.Sink, Materializer);
+                .RunWith(ready.Sink, Materializer);
             #endregion
         }
     }


Added support for not showing the default action name in the docs

--- src/SDammann.WebApi.Versioning/VersionedApiExplorer.cs
+++ src/SDammann.WebApi.Versioning/VersionedApiExplorer.cs
@@ -264,7 +264,7 @@
             }

             expandedRouteTemplate = route.RouteTemplate.Replace("/{id}", string.Empty)
-                .Replace("{action}", actionDescriptor.ActionName)
+                .Replace("/{action}", actionDescriptor.ActionName.Equals(route.Defaults["action"]) ? "" : string.Format("/{0}", actionDescriptor.ActionName))
                 .Replace("{version}", actionDescriptor.ControllerDescriptor.Version())
                 .Replace("{controller}", actionDescriptor.ControllerDescriptor.ControllerName)
                 + paramString.ToString();


Ugly fix to prevent voxelization of edges that are contained within one voxel,

--- TessellationAndVoxelizationGeometryLibrary/Voxelization/VoxelizedSolidfromTessellatedSolid.cs
+++ TessellationAndVoxelizationGeometryLibrary/Voxelization/VoxelizedSolidfromTessellatedSolid.cs
@@ -709,29 +709,37 @@
             int sweepDim, int uDim, int vDim, Edge edge, PolygonalFace face, double[] nextEndPoint,
             Vertex startVertex)
         {
+            //Check if this edge is contained within one voxel. Last() will use level1 in the current setup
+            bool voxelizeEdge = edge.To.Voxels.Last() != edge.From.Voxels.Last();
             double u, v;
             var reachedOtherVertex = findWhereLineCrossesPlane(startPoint, endPoint, sweepDim,
                 sweepValue, out u, out v);

-            makeVoxelsAlongLineInPlane(startPoint[uDim], startPoint[vDim], u, v,
-                sweepValue, uDim, vDim, sweepDim, face.Normal[vDim] >= 0, edge);
-            makeVoxelsAlongLineInPlane(startPoint[vDim], startPoint[uDim], v, u,
-                sweepValue, vDim, uDim, sweepDim, face.Normal[uDim] >= 0, edge);
-
-            if (reachedOtherVertex)
-            {
-                startPoint = (double[])endPoint.Clone();
-                endPoint = nextEndPoint;
-                edge = face.OtherEdge(startVertex);
-
-
-                findWhereLineCrossesPlane(startPoint, endPoint, sweepDim,
-                    sweepValue, out u, out v);
-
+            if (voxelizeEdge)
+            {
                 makeVoxelsAlongLineInPlane(startPoint[uDim], startPoint[vDim], u, v,
                     sweepValue, uDim, vDim, sweepDim, face.Normal[vDim] >= 0, edge);
                 makeVoxelsAlongLineInPlane(startPoint[vDim], startPoint[uDim], v, u,
                     sweepValue, vDim, uDim, sweepDim, face.Normal[uDim] >= 0, edge);
+            }
+
+            if (reachedOtherVertex)
+            {
+                startPoint = (double[])endPoint.Clone();
+                endPoint = nextEndPoint;
+                edge = face.OtherEdge(startVertex);
+
+
+                findWhereLineCrossesPlane(startPoint, endPoint, sweepDim,
+                    sweepValue, out u, out v);
+
+                if (voxelizeEdge)
+                {
+                    makeVoxelsAlongLineInPlane(startPoint[uDim], startPoint[vDim], u, v,
+                        sweepValue, uDim, vDim, sweepDim, face.Normal[vDim] >= 0, edge);
+                    makeVoxelsAlongLineInPlane(startPoint[vDim], startPoint[uDim], v, u,
+                        sweepValue, vDim, uDim, sweepDim, face.Normal[uDim] >= 0, edge);
+                }
             }
             startPoint[uDim] = u;
             startPoint[vDim] = v;


Updated to v0.1.1

Updated to v0.1.1

--- AngleSharp.Scripting.JavaScript/Properties/AssemblyInfo.cs
+++ AngleSharp.Scripting.JavaScript/Properties/AssemblyInfo.cs
@@ -11,5 +11,5 @@
 [assembly: AssemblyCulture("")]
 [assembly: ComVisible(false)]
 [assembly: Guid("be485498-5294-46d0-b1ba-54f095eba40d")]
-[assembly: AssemblyVersion("0.1.0.*")]
-[assembly: AssemblyFileVersion("0.1.0")]
+[assembly: AssemblyVersion("0.1.1.*")]
+[assembly: AssemblyFileVersion("0.1.1")]


Updated AnchorAttachmentInfo property naming.

--- Assets/HoloToolkit/Utilities/Scripts/WorldAnchorManager.cs
+++ Assets/HoloToolkit/Utilities/Scripts/WorldAnchorManager.cs
@@ -27,7 +27,7 @@
         /// </summary>
         protected struct AnchorAttachmentInfo
         {
-            public GameObject GameObjectToAnchor { get; set; }
+            public GameObject AnchoredGameObject { get; set; }
             public string AnchorName { get; set; }
             public AnchorOperation Operation { get; set; }
         }
@@ -285,7 +285,7 @@
         protected void DoAnchorOperation(AnchorAttachmentInfo anchorAttachmentInfo)
         {
             string anchorId = anchorAttachmentInfo.AnchorName;
-            GameObject anchoredGameObject = anchorAttachmentInfo.GameObjectToAnchor;
+            GameObject anchoredGameObject = anchorAttachmentInfo.AnchoredGameObject;

             switch (anchorAttachmentInfo.Operation)
             {


One more empty return

One more empty return

--- Assets/MixedRealityToolkit.Tests/PlayModeTests/TestHand.cs
+++ Assets/MixedRealityToolkit.Tests/PlayModeTests/TestHand.cs
@@ -109,7 +109,6 @@
         /// </summary>
         /// <param name="newRotation">New rotation of hand</param>
         /// <param name="numSteps">Number of frames to rotate over.</param>
-        /// <returns></returns>
         public IEnumerator SetRotation(Quaternion newRotation, int numSteps = 30)
         {
             Quaternion oldRotation = rotation;


Fixes build error when a scene with MRTK instance is open in editor

https://github.com/microsoft/MixedRealityToolkit-Unity/issues/5131

This code shouldn't be running during player builds - it's intended to only run during edit mode when using the unity editor. This change makes it so that during player builds (OnValidate is called during player builds probably to ensure that configurations are within their expected bounds), this isn't going to be invoked.

This does come down as a side effect of us using OnValidate (used to validate configs) for a purpose that it might not have originally been intended for (i.e. doing actual configuration work).

Also, updates the RegisterInstance function to find the first valid instance (during builds, objects will be destroyed without getting unregistered)

--- Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs
+++ Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs
@@ -732,9 +732,26 @@
             }

             if (activeInstance == null)
-            {   // If we don't have an active instance
-                // Choose the first instance in our list
-                activeInstance = setAsActiveInstance ? toolkitInstance : toolkitInstances[0];
+            {
+                // If we don't have an active instance, either set this instance
+                // to be the active instance if requested, or get the first valid remaining instance
+                // in the list.
+                if (setAsActiveInstance)
+                {
+                    activeInstance = toolkitInstance;
+                }
+                else
+                {
+                    for (int i = 0; i < toolkitInstances.Count; i++)
+                    {
+                        if (toolkitInstances[i] != null)
+                        {
+                            activeInstance = toolkitInstances[i];
+                            break;
+                        }
+                    }
+                }
+
                 activeInstance.InitializeInstance();
             }
         }
@@ -1567,8 +1584,12 @@
         /// </summary>
         private void OnValidate()
         {
-            if (EditorApplication.isPlayingOrWillChangePlaymode)
-            {   // This check is only necessary in edit mode
+            // This check is only necessary in edit mode. This can also get called during player builds as well,
+            // and shouldn't be run during that time.
+            if (EditorApplication.isPlayingOrWillChangePlaymode ||
+                EditorApplication.isCompiling ||
+                BuildPipeline.isBuildingPlayer)
+            {
                 return;
             }


Add external fingerprint matching

Add external fingerprint matching

--- Aurio/Aurio/Matching/HaitsmaKalker2002/FingerprintStore.cs
+++ Aurio/Aurio/Matching/HaitsmaKalker2002/FingerprintStore.cs
@@ -205,5 +205,68 @@
         public TimeSpan SubFingerprintIndexToTimeSpan(int index) {
             return new TimeSpan((long)Math.Round(index * profile.HashTimeScale * TimeUtil.SECS_TO_TICKS));
         }
+
+        public List<Match> FindMatchesFromExternalSubFingerprints(AudioTrack audioTrack, List<SubFingerprintHash> hashes) {
+            if (hashes.Count < this.fingerprintSize) {
+                throw new ArgumentException(String.Format(
+                    "Hash list is too short, cannot build fingerprints (given {0}, required at least {1})",
+                    hashes.Count, this.fingerprintSize));
+            }
+
+            var matches = new List<Match>();
+            var externalAudioTrackDummy = new AudioTrack(new NullStream(new AudioProperties(1, 1, 16, AudioFormat.IEEE), 0), "external");
+
+            for (int i = 0; i < hashes.Count; i++) {
+                try {
+                    List<SubFingerprintLookupEntry> collisions = this.collisionMap.GetValues(hashes[i]);
+
+                    foreach (var collision in collisions) {
+                        // We build fingerprints by starting with the current hash and adding the required number
+                        // of following hashes
+                        int externalFingerprintBeginIndex = i;
+                        int externalFingerprintEndIndex = externalFingerprintBeginIndex + this.fingerprintSize;
+
+                        // When we arrive at the right edge of the hash list, we need to shift the fingerprint
+                        // to the left to stay within the hash list
+                        // TODO detect and skip duplicate fingerprint comparisons
+                        if (externalFingerprintEndIndex > hashes.Count - 1) {
+                            int overflow = externalFingerprintEndIndex - (hashes.Count - 1);
+                            externalFingerprintBeginIndex -= overflow;
+                            externalFingerprintEndIndex -= overflow;
+                        }
+
+                        // TODO This check is just for development and should be removed once this code is stable
+                        if (externalFingerprintEndIndex - externalFingerprintBeginIndex != this.fingerprintSize) {
+                            throw new Exception("invalid fingerprint size");
+                        }
+
+                        Fingerprint externalFingerprint = new Fingerprint(hashes, externalFingerprintBeginIndex, externalFingerprintEndIndex);
+                        // TODO sync with external fingerprint, they cannot match at the right border as they use
+                        // the same overflow avoidance technique, but independently
+                        Fingerprint internalFingerprint = GetFingerprint(collision);
+
+                        float bitErrorRate = Fingerprint.CalculateBER(externalFingerprint, internalFingerprint);
+
+                        if (bitErrorRate < threshold) {
+                            matches.Add(new Match {
+                                Similarity = 1 - bitErrorRate,
+                                Track1 = collision.AudioTrack,
+                                Track1Time = SubFingerprintIndexToTimeSpan(collision.Index),
+                                Track2 = audioTrack,
+                                Track2Time = SubFingerprintIndexToTimeSpan(externalFingerprintBeginIndex),
+                                Source = matchSourceName,
+                            });
+                        }
+                    }
+
+                }
+                catch {
+                    // Skip non-colliding hashes
+                    // TODO avoid try/catch because that takes a lot of time
+                }
+            }
+
+            return matches;
+        }
     }
 }


Also save transition entry

Also save transition entry

--- Battery-Commander.Web/Controllers/EvaluationsController.cs
+++ Battery-Commander.Web/Controllers/EvaluationsController.cs
@@ -89,6 +89,12 @@

             evaluation.Transition(trigger);

+            evaluation.Events.Add(new Evaluation.Event
+            {
+                Author = User.Identity.Name,
+                Message = trigger.DisplayName()
+            });
+
             await db.SaveChangesAsync();

             return RedirectToAction(nameof(Details), new { id });


No changes. The defense went well.

No changes. The defense went well.

--- BlogProject/BlogProject/Views/Article/CreateComment.cshtml
+++ BlogProject/BlogProject/Views/Article/CreateComment.cshtml
@@ -2,6 +2,7 @@
 @{
     ViewBag.Title = "Add Comment";
 }
+@{ Model.ArticleId = ViewBag.ArticleId}

Create Comment


Update

Update

--- CSharp-Programs/PowerOnLoggerManagmentTool/LoginAccount.cs
+++ CSharp-Programs/PowerOnLoggerManagmentTool/LoginAccount.cs
@@ -65,7 +65,7 @@
             }
             set
             {
-                passwordHint = cryptoEngine.EncryptString(passwordHint, "");
+                passwordHint = cryptoEngine.EncryptString(value, "");
             }
         }


test(PedidoTest.cs): adicionar cenários de teste para a urgência de pedidos.

--- src/modulo-05-dotnet/LojaNinja/LojaNinja.Domino.Test/PedidoTest.cs
+++ src/modulo-05-dotnet/LojaNinja/LojaNinja.Domino.Test/PedidoTest.cs
@@ -1,5 +1,6 @@
 using System;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
+using LojaNinja.Dominio;

 namespace LojaNinja.Domino.Test
 {
@@ -7,9 +8,20 @@
     public class PedidoTest
     {
         [TestMethod]
-        public void TestMethod1()
+        public void FazCadastroComUrgência()
         {
-
+            var dataPedido = DateTime.Now.AddDays(2);
+            // dataPedido;
+            var pedido = new Pedido(dataPedido, "katana", 1200, TipoPagamento.Amex, "samurai", "SL", "RS");
+            Assert.AreEqual(true, pedido.PedidoUrgente);
+        }
+        [TestMethod]
+        public void FazCadastroSemUrgência()
+        {
+            var dataPedido = DateTime.Now.AddDays(7);
+            // dataPedido;
+            var pedido = new Pedido(dataPedido, "katana", 1200, TipoPagamento.Amex, "samurai", "SL", "RS");
+            Assert.AreEqual(false, pedido.PedidoUrgente);
         }
     }
 }


Disabled the built in text entry since it does not work.

--- ClownCrew.GitBitch.Client/Commands/Git/GitCommitCommand.cs
+++ ClownCrew.GitBitch.Client/Commands/Git/GitCommitCommand.cs
@@ -51,8 +51,9 @@
                 commitMessage = "--no-edit";
             }

-            if (string.IsNullOrEmpty(commitMessage) )
-                commitMessage = "-m \"" + await _questionAgent.AskStringAsync("Enter a commit message") + "\"";
+            //TODO: Fix threading so that this part start to work.
+            //if (string.IsNullOrEmpty(commitMessage))
+            //    commitMessage = "-m \"" + await _questionAgent.AskStringAsync("Enter a commit message") + "\"";

             var retry = true;
             while (retry)


TODOs

TODOs

--- CodeConnect.Gistify.Extension/CodeAnalysis/CodeAnalyzer.cs
+++ CodeConnect.Gistify.Extension/CodeAnalysis/CodeAnalyzer.cs
@@ -14,6 +14,7 @@

         public CodeAnalyzer(int startPos, int endPos, string fileName)
         {
+            // TODO: Get either filename or document, but we need to have a document here.
             //_snippet = VSIntegration
         }

@@ -27,6 +28,7 @@
         /// <returns>Strign representation of the gist</returns>
         public string GenerateGist(SyntaxTree snippet)
         {
+            // TODO: Use Document.GetSemanticModel()
             foreach (var declaration in FindDeclarations(snippet, model))
             {
                 // TODO: Create syntax


*Sigh* I had this edited locally but didn't check it in. Turns out it is my fault.

--- Chuck/Chuck/Windows/MainWindow.xaml.cs
+++ Chuck/Chuck/Windows/MainWindow.xaml.cs
@@ -138,13 +138,17 @@
                 }

                 gh.Pull(credentials);
-                GitHelper.StageAll(gh);
-                gh.Commit();
-                var result = gh.Push(credentials);
-
-                if(result != string.Empty)
-                {
-                    MessageBox.Show(result);
+                if (gh.Status().Count != 0)
+                {
+                    GitHelper.StageAll(gh);
+                    if (gh.Status().Any(t => t.Value != FileStatus.Staged))
+                        gh.Commit();
+                    var result = gh.Push(credentials);
+
+                    if (result != string.Empty)
+                    {
+                        MessageBox.Show(result);
+                    }
                 }
             }
             else


Wp8 file target were not deleting old log files, because of usage of QueryOptions class which is not available.

--- MetroLog.WP8/Wp8FileTarget.cs
+++ MetroLog.WP8/Wp8FileTarget.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Text.RegularExpressions;
@@ -43,24 +43,33 @@
         sealed protected override async Task DoCleanup(Regex pattern, DateTime threshold)
         {

+            Regex zipPattern = new Regex(@"^Log(.*).zip$");
             var toDelete = new List<StorageFile>();
+
             foreach (var file in await _logFolder.GetFilesAsync())
             {
                 if (pattern.Match(file.Name).Success && file.DateCreated <= threshold)
                     toDelete.Add(file);
+
+                if (zipPattern.Match(file.Name).Success)
+                    toDelete.Add(file);
             }

-            var qo = new QueryOptions(CommonFileQuery.DefaultQuery, new[] { ".zip" })
+            // QueryOptions class is not available in Windows Phone 8
+
+            /*
+            var qo = new queryoptions(commonfilequery.defaultquery, new[] { ".zip" })
             {
-                FolderDepth = FolderDepth.Shallow,
-                UserSearchFilter = "System.FileName:~<\"Log -\""
+                folderdepth = folderdepth.shallow,
+                usersearchfilter = "system.filename:~<\"log -\""
             };

-            var query = ApplicationData.Current.TemporaryFolder.CreateFileQueryWithOptions(qo);
+            var query = applicationdata.current.temporaryfolder.createfilequerywithoptions(qo);

-            var oldLogs = await query.GetFilesAsync();
-            toDelete.AddRange(oldLogs);
+            var oldlogs = await query.getfilesasync();
+            todelete.addrange(oldlogs);
+            */

             // walk...
             foreach (var file in toDelete)


Add more demo code.

Add more demo code.

--- ParseServerConsole/Program.cs
+++ ParseServerConsole/Program.cs
@@ -24,7 +24,7 @@
                 Server="http://localhost:1337/parse/"
             });

-            Console.WriteLine("Generate data to save on parse-server");
+            Console.WriteLine("Generate data to save on parse-server using subclassing");

             World earth = new World
             {
@@ -58,12 +58,21 @@
                 Neighbors = neighbors
             };

-            Console.WriteLine("Save data to parse-server");
-
+            Console.WriteLine("Save subclass data to parse-server");
             Task continuationTask = hello.SaveAsync().ContinueWith((antecedent) => {
                 Console.WriteLine("Save Finished! Status:{0}", antecedent.Status.ToString());
             });
             continuationTask.Wait();
+
+            Console.WriteLine("Generate data to save on parse-server using ParseObject.Create");
+            var testObject = ParseObject.Create("World"); // Since World is subclassed use .Create()
+            testObject["name"] = "Venus";
+            testObject["message"] = "Hello from Venus!";
+            Console.WriteLine("Save object data to parse-server");
+            Task contTask = testObject.SaveAsync().ContinueWith((antecedent) => {
+                Console.WriteLine("Save TestObject Finished! Status:{0}", antecedent.Status.ToString());
+            });
+            contTask.Wait();

             Console.ReadLine();
         }


Moves the basic projectile stuff into its own abstract class.

--- ProjectHekate.Core/Bullets.cs
+++ ProjectHekate.Core/Bullets.cs
@@ -1,8 +1,10 @@
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using ProjectHekate.Core.MathExtras;

 namespace ProjectHekate.Core
 {
-    public delegate IEnumerator<WaitInFrames> BulletUpdateDelegate(Bullet bullet);
+    public delegate IEnumerator<WaitInFrames> ProjectileUpdateDelegate<in TProjectileType>(TProjectileType ap) where TProjectileType : AbstractProjectile;

     public interface IBullet
     {
@@ -25,8 +27,8 @@

         float Radius { get; }
     }
-
-    public class Bullet : IBullet
+
+    public abstract class AbstractProjectile
     {
         public float X { get; set; }
         public float Y { get; set; }
@@ -36,10 +38,25 @@
         public uint FramesAlive { get; set; }
         public float Radius { get; set; }

-        internal Bullet()
+
+        public bool IsActive { get { return SpriteIndex >= 0; } }
+
+        internal AbstractProjectile()
         {
+
             SpriteIndex = -1;
         }
+    }
+
+    public class Bullet : AbstractProjectile, IBullet
+    {
+        internal IEnumerator<WaitInFrames> Update()
+        {
+            return UpdateFunc != null ? UpdateFunc(this) : null;
+        }
+
+        virtual internal ProjectileUpdateDelegate<Bullet> UpdateFunc { get; set; }
+    }

         public bool IsActive { get { return SpriteIndex >= 0; } }


unity: fix unit test async issue

unity: fix unit test async issue

--- unity/library/UtyMap.Unity.Tests/Data/TileLoadingTests.cs
+++ unity/library/UtyMap.Unity.Tests/Data/TileLoadingTests.cs
@@ -106,7 +106,11 @@
             _mapDataStore
                 .SubscribeOn(Scheduler.CurrentThread)
                 .ObserveOn(Scheduler.CurrentThread)
-                .Subscribe(AssertData, () => manualResetEvent.Set());
+                .Subscribe(r =>
+                {
+                    AssertData(r);
+                    manualResetEvent.Set();
+                });

             _mapDataStore.OnNext(new Tile(quadKey, _stylesheet, _projection));


Updated Conveyor Service to trim impartial json objects

--- RepRancher/ConveyorService.cs
+++ RepRancher/ConveyorService.cs
@@ -226,13 +226,27 @@
             {
                 if (previousParseFailure)
                 {
-
+                    int NewStart = Bracket+1;
+                    Bracket = 0;
+                    for (int i = 0; i < JSON.Length; i++)
+                    {
+                        char C = JSON[i];
+                        if (C == '{')
+                        {
+                            Bracket++;
+                            if (Bracket == NewStart)
+                            {
+                                JSON = JSON.Substring(i);
+                                break;
+                            }
+                        }
+                    }
                 }
                 else
                 {
-
-                }
-                previousParseFailure = true;
+                    previousParseFailure = true;
+                }
+
             }
             //If execution gets this far, object is incomplete, just return JSON
             return new string[] { JSON };


Fixing the way getting the time is handled, so it is _completely_ async

--- Rhino.Licensing/SntpClient.cs
+++ Rhino.Licensing/SntpClient.cs
@@ -51,7 +51,7 @@
 		public void BeginGetDate(Action<DateTime> getTime, Action failure)
 		{
 			index += 1;
-			if (hosts.Length < index)
+			if (hosts.Length <= index)
 			{
 				failure();
 				return;
@@ -59,17 +59,8 @@
 			try
 			{
 				var host = hosts[index];
-				var hostadd = Dns.GetHostEntry(host);
-				var endPoint = new IPEndPoint(hostadd.AddressList[0], 123);
-
-				var socket = new UdpClient();
-				socket.Connect(endPoint);
-				socket.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 500);
-				socket.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 500);
-				var sntpData = new byte[SntpDataLength];
-				sntpData[0] = 0x1B; // version = 4 & mode = 3 (client)
-
-				socket.BeginSend(sntpData, sntpData.Length, EndSend, new State(socket, endPoint, getTime, failure));
+				Dns.BeginGetHostAddresses(host, EndGetHostAddress,
+                    new State(null, null, getTime, failure) );
 			}
 			catch (Exception)
 			{
@@ -78,7 +69,33 @@
 			}
 		}

-		private void EndSend(IAsyncResult ar)
+	    private void EndGetHostAddress(IAsyncResult asyncResult)
+        {
+	        var state = (State) asyncResult.AsyncState;
+	        try
+	        {
+                Thread.Sleep(1000);
+	            var addresses = Dns.EndGetHostAddresses(asyncResult);
+	            var endPoint = new IPEndPoint(addresses[0], 123);
+
+	            var socket = new UdpClient();
+	            socket.Connect(endPoint);
+	            socket.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 500);
+	            socket.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 500);
+	            var sntpData = new byte[SntpDataLength];
+	            sntpData[0] = 0x1B; // version = 4 & mode = 3 (client)
+
+                socket.BeginSend(sntpData, sntpData.Length, EndSend, new State(socket, endPoint, state.GetTime, state.Failure));
+	        }
+	        catch (Exception)
+	        {
+                // retry, recursion stops at the end of the hosts
+                BeginGetDate(state.GetTime, state.Failure);
+
+	        }
+	    }
+
+	    private void EndSend(IAsyncResult ar)
 		{
 			var state = (State) ar.AsyncState;
 			try


Add an index of open PgnForms.

Add an index of open PgnForms.

--- Sandra.UI/MdiContainerForm.cs
+++ Sandra.UI/MdiContainerForm.cs
@@ -19,6 +19,7 @@
 **********************************************************************************/
 #endregion

+using Eutherion;
 using Eutherion.UIActions;
 using Eutherion.Utils;
 using Eutherion.Win;
@@ -39,6 +40,25 @@
     /// </summary>
     public partial class MdiContainerForm : MenuCaptionBarForm, IWeakEventTarget
     {
+        /// <summary>
+        /// List of open PGN files indexed by their path. New PGN files are indexed under the empty path.
+        /// </summary>
+        private readonly Dictionary<string, List<SyntaxEditorForm<PgnSymbol, PgnErrorInfo>>> OpenPgnForms
+            = new Dictionary<string, List<SyntaxEditorForm<PgnSymbol, PgnErrorInfo>>>(StringComparer.OrdinalIgnoreCase);
+
+        private void RemovePgnForm(string key, SyntaxEditorForm<PgnSymbol, PgnErrorInfo> pgnForm)
+        {
+            // Remove from the list it's currently in, and remove the list from the index altogether once it's empty.
+            var pgnForms = OpenPgnForms[key ?? string.Empty];
+            pgnForms.Remove(pgnForm);
+            if (pgnForms.Count == 0) OpenPgnForms.Remove(key ?? string.Empty);
+        }
+
+        private void AddPgnForm(string key, SyntaxEditorForm<PgnSymbol, PgnErrorInfo> pgnForm)
+        {
+            OpenPgnForms.GetOrAdd(key ?? string.Empty, _ => new List<SyntaxEditorForm<PgnSymbol, PgnErrorInfo>>()).Add(pgnForm);
+        }
+
         public EnumIndexedArray<ColoredPiece, Image> PieceImages { get; private set; }

         // Separate action handler and root menu node for building the MainMenuStrip.


Update localization strings

Update localization strings

--- Settings/IntegratorSection.cs
+++ Settings/IntegratorSection.cs
@@ -171,7 +171,7 @@

 			m_maxbounce_lb = new Label()
 			{
-				Text = LOC.STR("Maximum bounces"),
+				Text = Localization.LocalizeString("Maximum bounces", 22),
 				VerticalAlignment = VerticalAlignment.Center,
 			};

@@ -241,7 +241,7 @@

 			m_maxtransmissionbounce_lb = new Label()
 			{
-				Text = LOC.STR("Transmission"),
+				Text = Localization.LocalizeString("Transmission", 23),
 				ToolTip = Localization.LocalizeString("Maximum Transmission Bounces", 18),
 				VerticalAlignment = VerticalAlignment.Center,
 			};
@@ -259,15 +259,15 @@

 			m_maxtranspbounce_lb = new Label()
 			{
-				Text = LOC.STR("Transparency"),
-				ToolTip = LOC.STR("Maximum Transparency Bounces"),
+				Text = Localization.LocalizeString("Transparency", 29),
+				ToolTip = Localization.LocalizeString("Maximum Transparency Bounces", 30),
 				VerticalAlignment = VerticalAlignment.Center,
 			};

 			m_maxtranspbounce = new NumericStepper()
 			{
 				Value = 0,
-				ToolTip = LOC.STR("Maximum Transparency Bounces"),
+				ToolTip = Localization.LocalizeString("Maximum Transparency Bounces", 37),
 				MinValue = 0,
 				MaximumDecimalPlaces = 0,
 				Width = 75,


Add WhenJust method

Add WhenJust method

--- Sharper.C.Maybe/Data/Maybe.cs
+++ Sharper.C.Maybe/Data/Maybe.cs
@@ -77,6 +77,12 @@

         public A ValueOr(A a)
         =>  IsJust ? value : a;
+
+        public void WhenJust(Action<A> f)
+        {   if (IsJust)
+            {   f(value);
+            }
+        }

         public bool Equals(Maybe<A> x)
         =>  (IsNothing && x.IsNothing)


LedenDao.GetEntityKeys weggegooid, want is normaalgezien niet meer nodig.  AttachObjectGraph heeft de verantwoordelijkheid om ervoor te zorgen dat de entity keys in orde zijn.

git-svn-id: 0ffdc289f568b1e7493e560395a00d06174c8a92@513 99b415e2-69d1-4072-8d93-0ed3a15484ab

--- Solution/Cg2.Data/LedenDao.cs
+++ Solution/Cg2.Data/LedenDao.cs
@@ -54,24 +54,6 @@
             }
         }

-        public void getEntityKeys(Lid entiteit, ChiroGroepEntities db)
-        {
-            if (entiteit.ID != 0 && entiteit.EntityKey == null)
-            {
-                entiteit.EntityKey = db.CreateEntityKey(typeof(Lid).Name, entiteit);
-            }
-
-            if (entiteit.GroepsWerkJaar.ID != 0 && entiteit.GroepsWerkJaar.EntityKey == null)
-            {
-                entiteit.GroepsWerkJaar.EntityKey = db.CreateEntityKey(typeof(GroepsWerkJaar).Name, entiteit.GroepsWerkJaar);
-            }
-
-            if (entiteit.GelieerdePersoon.ID != 0 && entiteit.GelieerdePersoon.EntityKey == null)
-            {
-                entiteit.GelieerdePersoon.EntityKey = db.CreateEntityKey(typeof(GelieerdePersoon).Name, entiteit.GelieerdePersoon);
-            }
-        }
-
         // pagineren gebeurt nu per werkjaar
         // pagina, paginaGrootte en aantalTotaal zijn niet meer nodig
         public IList<Lid> PaginaOphalen(int groepsWerkJaarID)


- VS: doc xml generator
- xml comment fix

git-tfs-id: [http://falcon:8080/tfs/Projects]$/Phalanger/Main;C2661

--- Source/ClassLibrary/Arrays.cs
+++ Source/ClassLibrary/Arrays.cs
@@ -1820,10 +1820,10 @@
 		/// comparison methods to be used. See PHP manual for more details.</param>
 		/// <returns>Whether arrays were sorted successfully.</returns>
 		/// <remarks>Reindexes integer keys in the sorted arrays and restarts their intrinsic enumerators.</remarks>
-		/// <exception cref="PhpReference"><paramref name="first"/> is a null reference (Warning).</exception>
-		/// <exception cref="PhpReference">Arrays has different lengths (Warning).</exception>
-		/// <exception cref="PhpReference">Invalid sorting flags (Warning).</exception>
-		/// <exception cref="PhpReference">Multiple sorting flags applied on single array (Warning).</exception>
+		/// <exception cref="PhpException"><paramref name="first"/> is a null reference (Warning).</exception>
+        /// <exception cref="PhpException">Arrays has different lengths (Warning).</exception>
+        /// <exception cref="PhpException">Invalid sorting flags (Warning).</exception>
+        /// <exception cref="PhpException">Multiple sorting flags applied on single array (Warning).</exception>
 		[ImplementsFunction("array_multisort")]
 		public static bool MultiSort([PhpRw] PhpArray first, params object[] args)
 		{


This is important

This is important

--- src/Skybrud.Social.Spotify/OAuth/SpotifyOAuthClient.cs
+++ src/Skybrud.Social.Spotify/OAuth/SpotifyOAuthClient.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Specialized;
+using Skybrud.Essentials.Common;
 using Skybrud.Social.Http;
 using Skybrud.Social.Spotify.Endpoints.Raw;
 using Skybrud.Social.Spotify.Responses.Authentication;


du kleiner fixxer!

du kleiner fixxer!

--- Client/ChatClient/ChatClient/Server.cs
+++ Client/ChatClient/ChatClient/Server.cs
@@ -30,6 +30,7 @@

         public void Init()
         {
+            Connection = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
             SrvInfo = new ServerInfo();
             CurrClientCommand = new ClientCommand();
             CurrServerCommand = new ServerCommand();


Added tests to verify JSON-array behavior.

--- src/Tests/MyCouch.IntegrationTests/Views/ViewsTests.cs
+++ src/Tests/MyCouch.IntegrationTests/Views/ViewsTests.cs
@@ -41,7 +41,7 @@
         }

         [Test]
-        public void When_Skipping_2_of_10_using_json_string_Then_8_rows_are_returned()
+        public void When_Skipping_2_of_10_using_json_Then_8_rows_are_returned()
         {
             var artists = Artists.Skip(2);
             var query = new ViewQuery("artists", "albums").Configure(cfg => cfg.Skip(2));
@@ -52,11 +52,22 @@
         }

         [Test]
-        public void When_Skipping_2_of_10_using_entities_Then_8_rows_are_returned()
+        public void When_Skipping_2_of_10_using_json_array_Then_8_rows_are_returned()
         {
             var artists = Artists.Skip(2);
             var query = new ViewQuery("artists", "albums").Configure(cfg => cfg.Skip(2));

+            var response = SUT.RunQuery<string[]>(query);
+
+            response.Should().BeSuccessfulGet(artists.Select(a => a.Albums.Select(i => Client.Serializer.Serialize(i)).ToArray()).ToArray());
+        }
+
+        [Test]
+        public void When_Skipping_2_of_10_using_entities_Then_8_rows_are_returned()
+        {
+            var artists = Artists.Skip(2);
+            var query = new ViewQuery("artists", "albums").Configure(cfg => cfg.Skip(2));
+
             var response = SUT.RunQuery<Album[]>(query);

             response.Should().BeSuccessfulGet(artists.Select(a => a.Albums).ToArray());
@@ -71,6 +82,17 @@
             var response = SUT.RunQuery(query);

             response.Should().BeSuccessfulGet(artists.Select(a => Client.Serializer.Serialize(a.Albums)).ToArray());
+        }
+
+        [Test]
+        public void When_Limit_to_2_using_json_array_Then_2_rows_are_returned()
+        {
+            var artists = Artists.Take(2);
+            var query = new ViewQuery("artists", "albums").Configure(cfg => cfg.Limit(2));
+
+            var response = SUT.RunQuery<string[]>(query);
+
+            response.Should().BeSuccessfulGet(artists.Select(a => a.Albums.Select(i => Client.Serializer.Serialize(i)).ToArray()).ToArray());
         }

         [Test]
@@ -96,6 +118,17 @@
         }

         [Test]
+        public void When_Key_is_specified_using_json_array_Then_matching_row_is_returned()
+        {
+            var artist = Artists[2];
+            var query = new ViewQuery("artists", "albums").Configure(cfg => cfg.Key(artist.Name));
+
+            var response = SUT.RunQuery<string[]>(query);
+
+            response.Should().BeSuccessfulGet(new[] { artist.Albums.Select(i => Client.Serializer.Serialize(i)).ToArray() });
+        }
+
+        [Test]
         public void When_Key_is_specified_using_entities_Then_matching_row_is_returned()
         {
             var artist = Artists[2];
@@ -119,12 +152,24 @@
         }

         [Test]
-        public void When_Keys_are_specified_using_entities_Then_matching_rows_are_returned()
+        public void When_Keys_are_specified_using_json_array_Then_matching_rows_are_returned()
         {
             var artists = Artists.Skip(2).Take(3).ToArray();
             var keys = artists.Select(a => a.Name).ToArray();
             var query = new ViewQuery("artists", "albums").Configure(cfg => cfg.Keys(keys));

+            var response = SUT.RunQuery<string[]>(query);
+
+            response.Should().BeSuccessfulGet(artists.Select(a => a.Albums.Select(i => Client.Serializer.Serialize(i)).ToArray()).ToArray());
+        }
+
+        [Test]
+        public void When_Keys_are_specified_using_entities_Then_matching_rows_are_returned()
+        {
+            var artists = Artists.Skip(2).Take(3).ToArray();
+            var keys = artists.Select(a => a.Name).ToArray();
+            var query = new ViewQuery("artists", "albums").Configure(cfg => cfg.Keys(keys));
+
             var response = SUT.RunQuery<Album[]>(query);

             response.Should().BeSuccessfulGet(artists.Select(a => a.Albums).ToArray());
@@ -141,6 +186,19 @@
             var response = SUT.RunQuery(query);

             response.Should().BeSuccessfulGet(artists.Select(a => Client.Serializer.Serialize(a.Albums)).ToArray());
+        }
+
+        [Test]
+        public void When_StartKey_and_EndKey_are_specified_using_json_array_Then_matching_rows_are_returned()
+        {
+            var artists = Artists.Skip(2).Take(5).ToArray();
+            var query = new ViewQuery("artists", "albums").Configure(cfg => cfg
+                .StartKey(artists.First().Name)
+                .EndKey(artists.Last().Name));
+
+            var response = SUT.RunQuery<string[]>(query);
+
+            response.Should().BeSuccessfulGet(artists.Select(a => a.Albums.Select(i => Client.Serializer.Serialize(i)).ToArray()).ToArray());
         }

         [Test]
@@ -171,7 +229,7 @@
         }

         [Test]
-        public void When_StartKey_and_EndKey_with_non_inclusive_end_are_specified_using_entities_Then_matching_rows_are_returned()
+        public void When_StartKey_and_EndKey_with_non_inclusive_end_are_specified_using_json_array_Then_matching_rows_are_returned()
         {
             var artists = Artists.Skip(2).Take(5).ToArray();
             var query = new ViewQuery("artists", "albums").Configure(cfg => cfg
@@ -179,6 +237,20 @@
                 .EndKey(artists.Last().Name)
                 .InclusiveEnd(false));

+            var response = SUT.RunQuery<string[]>(query);
+
+            response.Should().BeSuccessfulGet(artists.Take(artists.Length - 1).Select(a => a.Albums.Select(i => Client.Serializer.Serialize(i)).ToArray()).ToArray());
+        }
+
+        [Test]
+        public void When_StartKey_and_EndKey_with_non_inclusive_end_are_specified_using_entities_Then_matching_rows_are_returned()
+        {
+            var artists = Artists.Skip(2).Take(5).ToArray();
+            var query = new ViewQuery("artists", "albums").Configure(cfg => cfg
+                .StartKey(artists.First().Name)
+                .EndKey(artists.Last().Name)
+                .InclusiveEnd(false));
+
             var response = SUT.RunQuery<Album[]>(query);

             response.Should().BeSuccessfulGet(artists.Take(artists.Length - 1).Select(a => a.Albums).ToArray());


Re-enable XAML tests

Re-enable XAML tests

--- src/Windows/Host/Client/Test/XamlGraphicsDeviceTest.cs
+++ src/Windows/Host/Client/Test/XamlGraphicsDeviceTest.cs
@@ -44,7 +44,7 @@

         private double H(double percentY) => DefaultHeight * percentY;

-        [Test(Skip = "https://github.com/Microsoft/RTVS/issues/3532")]
+        [Test]
         [Category.Plots]
         public async Task Line() {
             var code = @"grid.segments(.01, .1, .99, .1)";
@@ -58,7 +58,7 @@
             CheckStrokeDashArray(shapes[0], null);
         }

-        [Test(Skip = "https://github.com/Microsoft/RTVS/issues/3532")]
+        [Test]
         [Category.Plots]
         public async Task LineCustomLineType() {
             var code = @"grid.segments(.01, .1, .99, .1, gp=gpar(lty='4812',lwd=5,col='Blue'))";
@@ -71,7 +71,7 @@
             CheckStrokeDashArray(shapes[0], "4 8 1 2");
         }

-        [Test(Skip = "https://github.com/Microsoft/RTVS/issues/3532")]
+        [Test]
         [Category.Plots]
         public async Task LineSolidLineType() {
             var code = @"grid.segments(.01, .1, .99, .1, gp=gpar(lty=1))";
@@ -84,7 +84,7 @@
             CheckStrokeDashArray(shapes[0], null);
         }

-        [Test(Skip = "https://github.com/Microsoft/RTVS/issues/3532")]
+        [Test]
         [Category.Plots]
         public async Task LineDashedLineType() {
             var code = @"grid.segments(.01, .1, .99, .1, gp=gpar(lty=2))";
@@ -97,7 +97,7 @@
             CheckStrokeDashArray(shapes[0], "4 4");
         }

-        [Test(Skip = "https://github.com/Microsoft/RTVS/issues/3532")]
+        [Test]
         [Category.Plots]
         public async Task Polygon() {
             var code = @"grid.polygon(x=c(0,0.5,1,0.5),y=c(0.5,1,0.5,0))";
@@ -110,7 +110,7 @@
             CheckStrokeDashArray(shapes[0], null);
         }

-        [Test(Skip = "https://github.com/Microsoft/RTVS/issues/3532")]
+        [Test]
         [Category.Plots]
         public async Task Circle() {
             var code = @"grid.circle(0.5, 0.5, 0.2)";
@@ -121,7 +121,7 @@
             CheckCanvasLeftTop(shapes[0], X(0.5) - H(0.2), Y(0.5) - W(0.2));
         }

-        [Test(Skip = "https://github.com/Microsoft/RTVS/issues/3532")]
+        [Test]
         [Category.Plots]
         public async Task Rectangle() {
             var code = @"grid.rect(0.5, 0.5, 0.3, 0.4)";
@@ -132,7 +132,7 @@
             CheckCanvasLeftTop(shapes[0], X(0.5) - H(0.15), Y(0.5) - W(0.2));
         }

-        [Test(Skip = "https://github.com/Microsoft/RTVS/issues/3532")]
+        [Test]
         [Category.Plots]
         public async Task Path() {
             var code = @"grid.path(c(.1, .1, .9, .9, .2, .2, .8, .8), c(.1, .9, .9, .1, .2, .8, .8, .2), id=rep(1:2,each=4), rule='winding', gp=gpar(filled.contour='grey'))";
@@ -152,7 +152,7 @@
             CheckStringAttr(shapes[0], "Data", expected);
         }

-        [Test(Skip = "https://github.com/Microsoft/RTVS/issues/3532")]
+        [Test]
         [Category.Plots]
         public async Task TextXmlEscape() {
             var code = "grid.text('hello<>&\"', 0.1, 0.3)";


chore: Update common System.Linq.Async dependency

--- tools/Google.Cloud.Tools.ReleaseManager/GenerateProjectsCommand.cs
+++ tools/Google.Cloud.Tools.ReleaseManager/GenerateProjectsCommand.cs
@@ -94,7 +94,7 @@
             { "xunit.runner.visualstudio", "2.4.3" },
             { "Xunit.SkippableFact", "1.4.13" },
             { "Moq", "4.16.1" },
-            { "System.Linq.Async", "5.1.0" },
+            { "System.Linq.Async", "6.0.1" },
         };

         // Hard-coded versions for dependencies for production packages that can be updated arbitrarily, as their assets are all private.


chore: Use the current year in OwlBot config files

Arguably it would be best to generate *new* files with the current
year, but leave existing ones as they are... but that's more work
than it's probably worth.

--- tools/Google.Cloud.Tools.ReleaseManager/GenerateProjectsCommand.cs
+++ tools/Google.Cloud.Tools.ReleaseManager/GenerateProjectsCommand.cs
@@ -499,7 +499,7 @@
             }
             string content =
 $@"
-# Copyright 2021 Google LLC
+# Copyright {DateTime.UtcNow.Year} Google LLC
 #
 # Licensed under the Apache License, Version 2.0 (the ""License"");
 # you may not use this file except in compliance with the License.


Run code clean-up.

Run code clean-up.

--- src/Zametek.Utility/Extensions/ConversionExtensions.cs
+++ src/Zametek.Utility/Extensions/ConversionExtensions.cs
@@ -1,10 +1,9 @@
 using Newtonsoft.Json;
 using System;
-using System.Diagnostics;
 using System.Linq;
+using System.Reflection;
 using System.Runtime.Serialization;
 using System.Text;
-using System.Reflection;

 namespace Zametek.Utility
 {


Refactored Converters

Refactored Converters

--- Dependencies/Serializer.Newtonsoft/NewtonsoftSerializer.cs
+++ Dependencies/Serializer.Newtonsoft/NewtonsoftSerializer.cs
@@ -42,13 +42,12 @@
                 Binder = new JsonSerializationBinder(AssemblyName, NamespacePrefix),
                 Converters =
                 {
+                    new KeyValuePairConverter(),
                     new ArgbColorJsonConverter(),
                     new FontStyleConverter(),
                     new ShapeStateConverter()
                 }
             };
-
-            Settings.Converters.Add(new KeyValuePairConverter());
         }

         /// <inheritdoc/>


Removed duplicated message.

Removed duplicated message.

--- StartUpWPF/MainWindow.xaml.cs
+++ StartUpWPF/MainWindow.xaml.cs
@@ -80,8 +80,6 @@

         public void OnGetXmlAndLoadItToDb(object sender, RoutedEventArgs e)
         {
-            Console.WriteLine(importedMessage, "Sales", "XML");
-
             var db = new TuxedoDb();
             var salesFromXml = ParseXml.Deserialize<Sale>();
             using (db)


(maint) formatting

(maint) formatting

--- src/chocolatey/infrastructure.app/nuget/NugetCommon.cs
+++ src/chocolatey/infrastructure.app/nuget/NugetCommon.cs
@@ -145,7 +145,6 @@
                     };
             }

-
             return packageManager;
         }
     }


Fixing the namespace to match the Program.cs in the same folder

--- src/dotnet/commands/dotnet-build/LocalizableStrings.cs
+++ src/dotnet/commands/dotnet-build/LocalizableStrings.cs
@@ -1,4 +1,4 @@
-namespace dotnet.commands.dotnet_build
+namespace Microsoft.DotNet.Tools.Build
 {
     internal class LocalizableStrings
     {


git-svn-id: 21cdf44b51306c1f0753fc51e774ecf5fc1851ba@728 a61f9e97-bd4c-0410-8c65-85b29eaa70ff

--- Dorian/Gorgon/Gorgon.Graphics/Enums/GorgonBufferFormats.cs
+++ Dorian/Gorgon/Gorgon.Graphics/Enums/GorgonBufferFormats.cs
@@ -438,4 +438,226 @@
 		/// </summary>
 		BC7_UIntNormal_sRGB = 99
 	}
+
+	/// <summary>
+	/// Retrieves information about the format.
+	/// </summary>
+	public static class GorgonBufferFormatInfo
+	{
+		#region Classes.
+		/// <summary>
+		/// Information about a specific GorgonBufferFormat.
+		/// </summary>
+		public class GorgonFormatData
+		{
+			#region Variables.
+			#endregion
+
+			#region Properties.
+			/// <summary>
+			/// Property to return the format.
+			/// </summary>
+			public GorgonBufferFormat Format
+			{
+				get;
+				private set;
+			}
+
+			/// <summary>
+			/// Property to return the best fit packed type.
+			/// </summary>
+			public Type PackedType
+			{
+				get;
+				private set;
+			}
+
+			/// <summary>
+			/// Property to return the types embedded within the format.
+			/// </summary>
+			public Type[] ComponentTypes
+			{
+				get;
+				private set;
+			}
+
+			/// <summary>
+			/// Property to return the packed bit depth for the format.
+			/// </summary>
+			public int PackedDepth
+			{
+				get;
+				private set;
+			}
+
+			/// <summary>
+			/// Property to return the bit depths for components within the format.
+			/// </summary>
+			public int[] ComponentDepths
+			{
+				get;
+				private set;
+			}
+
+			/// <summary>
+			/// Property to return the number of components in the format.
+			/// </summary>
+			public int ComponentCount
+			{
+				get;
+				private set;
+			}
+
+			/// <summary>
+			/// Property to return the left/right shift values for each component.
+			/// </summary>
+			public int[] Shifts
+			{
+				get;
+				private set;
+			}
+
+			/// <summary>
+			/// Property to return whether the format has a depth component.
+			/// </summary>
+			public bool HasDepth
+			{
+				get;
+				private set;
+			}
+
+			/// <summary>
+			/// Property to return whether the format has a stencil component.
+			/// </summary>
+			public bool HasStencil
+			{
+				get;
+				private set;
+			}
+
+			/// <summary>
+			/// Property to return whether the format expects normalized data.
+			/// </summary>
+			public bool[] IsNormalized
+			{
+				get;
+				private set;
+			}
+			#endregion
+
+			#region Methods.
+			#endregion
+
+			#region Constructor/Destructor.
+			/// <summary>
+			/// Initializes a new instance of the <see cref="GorgonFormatData"/> class.
+			/// </summary>
+			/// <param name="format">The format to evaluate.</param>
+			internal GorgonFormatData(GorgonBufferFormat format)
+			{
+				Format = format;
+				switch (format)
+				{
+					case GorgonBufferFormat.D16_UIntNormal:
+						ComponentCount = 1;
+						IsNormalized = new bool[] { true };
+						PackedType = typeof(uint);
+						PackedDepth = 32;
+						ComponentTypes = new Type[] { typeof(uint) };
+						ComponentDepths = new int[] { 16 };
+						HasDepth = true;
+						HasStencil = false;
+						Shifts = new int[] { 0 };
+						break;
+					case GorgonBufferFormat.D24_UIntNormal_S8_UInt:
+						ComponentCount = 2;
+						IsNormalized = new bool[] { true, false };
+						ComponentTypes = new Type[] { typeof(uint), typeof(uint) };
+						ComponentDepths = new int[] { 24, 8 };
+						PackedType = typeof(uint);
+						PackedDepth = 32;
+						HasDepth = true;
+						HasStencil = true;
+						Shifts = new int[] { 8, 0 };
+						break;
+					case GorgonBufferFormat.D32_Float:
+						ComponentCount = 1;
+						IsNormalized = new bool[] { false };
+						ComponentTypes = new Type[] { typeof(float) };
+						ComponentDepths = new int[] { 32 };
+						PackedType = typeof(float);
+						PackedDepth = 32;
+						HasDepth = true;
+						HasStencil = false;
+						Shifts = new int[] { 0 };
+						break;
+					case GorgonBufferFormat.D32_Float_S8X24_UInt:
+						ComponentCount = 3;
+						IsNormalized = new bool[] { false, false };
+						ComponentTypes = new Type[] { typeof(float), typeof(uint) };
+						ComponentDepths = new int[] { 32, 8, 24 };
+						PackedType = typeof(ulong);
+						PackedDepth = 64;
+						HasDepth = true;
+						HasStencil = true;
+						Shifts = new int[] { 32, 24, 0 };
+						break;
+					default:
+						ComponentCount = 0;
+						IsNormalized = new bool[] { };
+						PackedType = null;
+						PackedDepth = 0;
+						ComponentTypes = new Type[] { };
+						ComponentDepths = new int[] { };
+						HasDepth = false;
+						HasStencil = false;
+						Shifts = new int[] { };
+						break;
+				}
+			}
+			#endregion
+		}
+		#endregion
+
+		#region Variables.
+		private static IDictionary<GorgonBufferFormat, GorgonFormatData> _formats = null;
+		#endregion
+
+		#region Methods.
+		/// <summary>
+		/// Function to build the format information.
+		/// </summary>
+		private static void GetFormatInfo()
+		{
+			GorgonBufferFormat[] formats = (GorgonBufferFormat[])Enum.GetValues(typeof(GorgonBufferFormat));
+
+			foreach (var format in formats)
+				_formats.Add(format, new GorgonFormatData(format));
+		}
+
+		/// <summary>
+		/// Function to retrieve information about a format.
+		/// </summary>
+		/// <param name="format">Format to retrieve information about.</param>
+		/// <returns>The information for the format.  If the format is unknown, then the data for the Unknown GorgonBufferFormat will be returned.</returns>
+		public static GorgonFormatData GetInfo(GorgonBufferFormat format)
+		{
+			if (!_formats.ContainsKey(format))
+				return _formats[GorgonBufferFormat.Unknown];
+
+			return _formats[format];
+		}
+		#endregion
+
+		#region Constructor/Destructor.
+		/// <summary>
+		/// Initializes the <see cref="GorgonBufferFormatInfo"/> class.
+		/// </summary>
+		static GorgonBufferFormatInfo()
+		{
+			_formats = new Dictionary<GorgonBufferFormat, GorgonFormatData>();
+			GetFormatInfo();
+		}
+		#endregion
+	}
 }


testing a new version of a package

testing a new version of a package

--- Collections/Properties/AssemblyInfo.cs
+++ Collections/Properties/AssemblyInfo.cs
@@ -33,4 +33,4 @@
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: AssemblyInformationalVersion("1.0.0-alpha")]
+[assembly: AssemblyInformationalVersion("1.0.0-alpha1")]


Update TrilaterationControl.Designer.cs

Update TrilaterationControl.Designer.cs

Add missing event handler hook; forgot to check in.

--- EDDiscovery/Trilateration/TrilaterationControl.Designer.cs
+++ EDDiscovery/Trilateration/TrilaterationControl.Designer.cs
@@ -103,6 +103,7 @@
             this.dataGridViewDistances.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridViewDistances_CellValidating);
             this.dataGridViewDistances.CurrentCellChanged += new System.EventHandler(this.dataGridViewDistances_CurrentCellChanged);
             this.dataGridViewDistances.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.dataGridViewDistances_EditingControlShowing);
+            this.dataGridViewDistances.KeyDown += new System.KeyEventHandler(this.dataGridViewDistances_KeyDown);
             //
             // ColumnSystem
             //


Added Enumerator to Inverse extension.

Added Enumerator to Inverse extension.

--- ComponentRegistry/ComponentRegistry.cs
+++ ComponentRegistry/ComponentRegistry.cs
@@ -301,13 +301,13 @@
     /// <returns></returns>
     public static List<Component> Inverse(this List<Component> list, System.Type type)
     {
-        List<Component> fullList = GetObjectsOfType(type);
         bufferList.Clear();

         Component c1 = null;
-        for (var i = 0; i < fullList.Count; ++i)
-        {
-            c1 = fullList[i];
+        List<Component>.Enumerator fullListIter = GetObjectsOfType(type).GetEnumerator();
+        while(fullListIter.MoveNext())
+        {
+            c1 = fullListIter.Current;
             if (!list.Contains(c1))
                 bufferList.Add(c1);
         }


Fix day parse error with system theme

Fix day parse error with system theme

--- EDDiscovery/UserControls/LogsBookmarks/CaptainsLogDiary.cs
+++ EDDiscovery/UserControls/LogsBookmarks/CaptainsLogDiary.cs
@@ -183,7 +183,7 @@
         private void DayClick(object sender, EventArgs e)       // send a button click up
         {
             ExtendedControls.ExtButton b = sender as ExtendedControls.ExtButton;
-            int dayno = b.Text.InvariantParseInt(-1);
+            int dayno = b.Text.Replace("*","").InvariantParseInt(-1);
             ClickedonDate?.Invoke(new DateTime(curmonth.Year, curmonth.Month, dayno), (int)b.Tag == 0);
         }


a couple more quick tests

a couple more quick tests

--- EPS.Utility.Tests.Unit/Reflection/EventInfoComparerTest.cs
+++ EPS.Utility.Tests.Unit/Reflection/EventInfoComparerTest.cs
@@ -1,25 +1,40 @@
 using System;
 using System.Linq;
+using System.Reflection;
 using Xunit;

 namespace EPS.Reflection.Tests.Unit
 {
     public class EventInfoComparerTest
     {
-        class TypeA
+        class A
         {
             public event EventHandler Test;
+            public event EventHandler<UnhandledExceptionEventArgs> Test2;
         }

-        class TypeB
+        class B
         {
             public event EventHandler Test;
+            public event EventHandler<UnhandledExceptionEventArgs> Test2;
         }

         [Fact]
         public void Equals_True_OnTypesOfSameSignature()
         {
-            Assert.True(typeof(TypeA).GetEvents().SequenceEqual(typeof(TypeB).GetEvents(), EventInfoComparer.Default));
+            Assert.True(typeof(A).GetEvents().SequenceEqual(typeof(B).GetEvents(), EventInfoComparer.Default));
+        }
+
+        [Fact]
+        public void Equals_False_OnNullFirstParameter()
+        {
+            Assert.False(EventInfoComparer.Default.Equals(null, (EventInfo)typeof(A).GetMember("Test")[0]));
+        }
+
+        [Fact]
+        public void Equals_False_OnNullSecondParameter()
+        {
+            Assert.False(EventInfoComparer.Default.Equals((EventInfo)typeof(A).GetMember("Test")[0], null));
         }
     }
 }


Restore correct URI for not-at-nerve dev

--- CompressedImageView/MainWindow.xaml.cs
+++ CompressedImageView/MainWindow.xaml.cs
@@ -111,7 +111,7 @@
             new Thread(() =>
             {
                 // ROS stuff
-                ROS.ROS_MASTER_URI = "http://10.0.3.13:11311";
+                ROS.ROS_MASTER_URI = "http://10.0.3.5:11311";
                 ROS.Init(new string[0], "The_UI_" + System.Environment.MachineName.Replace("-", "__"));
                 nh = new NodeHandle();
                 Dispatcher.Invoke(new Action(() =>


Fixing default value and using boxes

Fixing default value and using boxes

--- Fluent.Ribbon/AttachedProperties/InputControlProperties.cs
+++ Fluent.Ribbon/AttachedProperties/InputControlProperties.cs
@@ -2,6 +2,7 @@
 namespace Fluent;

 using System.Windows;
+using Fluent.Internal.KnownBoxes;
 using JetBrains.Annotations;

 /// <summary>
@@ -11,7 +12,7 @@
 public class InputControlProperties : DependencyObject
 {
     public static readonly DependencyProperty InputWidthProperty = DependencyProperty.RegisterAttached(
-        "InputWidth", typeof(double), typeof(InputControlProperties), new PropertyMetadata(double.NaN));
+        "InputWidth", typeof(double), typeof(InputControlProperties), new PropertyMetadata(DoubleBoxes.NaN));

     public static void SetInputWidth(DependencyObject element, double value)
     {
@@ -24,7 +25,7 @@
     }

     public static readonly DependencyProperty InputMinWidthProperty = DependencyProperty.RegisterAttached(
-        "InputMinWidth", typeof(double), typeof(InputControlProperties), new PropertyMetadata(double.NaN));
+        "InputMinWidth", typeof(double), typeof(InputControlProperties), new PropertyMetadata(DoubleBoxes.Zero));

     public static void SetInputMinWidth(DependencyObject element, double value)
     {


improve some test cases with Count()

improve some test cases with Count()

--- HearthStone/HearthStone.Library.Test/CardRecordUnitTest.cs
+++ HearthStone/HearthStone.Library.Test/CardRecordUnitTest.cs
@@ -26,7 +26,8 @@
         {
             Assert.IsNotNull(CardManager.Instance);
             Assert.IsNotNull(CardManager.Instance.Cards);
-            try
+
+            if (CardManager.Instance.Cards.Count<Card>() > 0)
             {
                 int anyValidCardID = CardManager.Instance.Cards.First<Card>().CardID;

@@ -36,7 +37,7 @@
                     Assert.IsTrue(test.CardRecordID == id, "Invalid Constructor Setter for CardRecordID: " + id);
                 }
             }
-            catch (ArgumentNullException)
+            else
             {
                 Assert.Fail("Unable to run the test case, no valid card");
             }
@@ -58,17 +59,15 @@
         {
             Assert.IsNotNull(CardManager.Instance);
             Assert.IsNotNull(CardManager.Instance.Cards);
-            bool hasCards = false;
+            if (CardManager.Instance.Cards.Count() == 0)
+            {
+                Assert.Fail("Unable to run the test case, no valid card");
+            }
             int validCardRecordID = 0; // assume 0 is always valid
             foreach (Card card in CardManager.Instance.Cards)
             {
-                hasCards = true;
                 TestCardRecord test = new TestCardRecord(validCardRecordID, card.CardID);
                 Assert.IsTrue(test.CardID == card.CardID, "Invalid Constructor Setter for CardRecordID: " + card.CardID);
-            }
-            if (!hasCards)
-            {
-                Assert.Fail("Unable to run the test case, no valid card");
             }
         }

@@ -92,17 +91,15 @@
         {
             Assert.IsNotNull(CardManager.Instance);
             Assert.IsNotNull(CardManager.Instance.Cards);
-            bool hasCards = false;
+            if (CardManager.Instance.Cards.Count() == 0)
+            {
+                Assert.Fail("Unable to run the test case, no valid card");
+            }
             int validCardRecordID = 0; // assume 0 is always valid
             foreach (Card card in CardManager.Instance.Cards)
             {
-                hasCards = true;
                 TestCardRecord test = new TestCardRecord(validCardRecordID, card.CardID);
                 Assert.IsTrue(test.Card == card, "Invalid Card getter for " + card.CardID);
-            }
-            if (!hasCards)
-            {
-                Assert.Fail("Unable to run the test case, no valid card");
             }
         }


add another test case for CardRecord, split constructor and setter

--- HearthStone/HearthStone.Library.Test/CardRecordUnitTest.cs
+++ HearthStone/HearthStone.Library.Test/CardRecordUnitTest.cs
@@ -21,14 +21,35 @@
             }
         }

-
         [TestMethod]
         public void CardRecordIDTestMethod1()
         {
-            TestCardRecord test1 = new TestCardRecord();
-            foreach (int id in new int[] { 0, 1, 2, 3, 4 }){
-                test1.SetCardRecordID(id);
-                Assert.IsTrue(test1.CardRecordID == id, "Invalid Setter for CardRecordID: to set " + id);
+            Assert.IsNotNull(CardManager.Instance);
+            Assert.IsNotNull(CardManager.Instance.Cards);
+            try
+            {
+                int anyValidCardID = CardManager.Instance.Cards.First<Card>().CardID;
+
+                foreach (int id in new int[] { 0, 1, 2, 3, 4 })
+                {
+                    TestCardRecord test = new TestCardRecord(id, anyValidCardID);
+                    Assert.IsTrue(test.CardRecordID == id, "Invalid Constructor Setter for CardRecordID: " + id);
+                }
+            }
+            catch (ArgumentNullException)
+            {
+                Assert.Fail("Unable to run the test case, no valid card");
+            }
+        }
+
+        [TestMethod]
+        public void CardRecordIDTestMethod2()
+        {
+            TestCardRecord test = new TestCardRecord();
+            foreach (int id in new int[] { 0, 1, 2, 3, 4 })
+            {
+                test.SetCardRecordID(id);
+                Assert.IsTrue(test.CardRecordID == id, "Invalid Setter for CardRecordID: " + id);
             }
         }
     }


Minimize functionality in dispatcher calls (#351)

--- IoTCoreDefaultApp/IoTCoreDefaultApp/Views/MainPage.xaml.cs
+++ IoTCoreDefaultApp/IoTCoreDefaultApp/Views/MainPage.xaml.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft. All rights reserved.
+// Copyright (c) Microsoft. All rights reserved.

 using IoTCoreDefaultApp.Utils;
 using System;
@@ -50,15 +50,15 @@

             this.DataContext = LanguageManager.GetInstance();

-            this.Loaded += async (sender, e) =>
-            {
-                await MainPageDispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
+            this.Loaded += (sender, e) =>
+            {
+                UpdateBoardInfo();
+                UpdateNetworkInfo();
+                UpdateDateTime(true);
+                UpdateConnectedDevices();
+
+                MainPageDispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                 {
-                    UpdateBoardInfo();
-                    UpdateNetworkInfo();
-                    UpdateDateTime();
-                    UpdateConnectedDevices();
-
                     timer = new DispatcherTimer();
                     timer.Tick += timer_Tick;
                     timer.Interval = TimeSpan.FromSeconds(10);
@@ -84,60 +84,90 @@

         private async void NetworkInformation_NetworkStatusChanged(object sender)
         {
-            await MainPageDispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
-            {
-                UpdateNetworkInfo();
-            });
+            UpdateNetworkInfo();
         }

         private void timer_Tick(object sender, object e)
         {
-            UpdateDateTime();
+            UpdateDateTime(false);
         }

         private void UpdateBoardInfo()
         {
-            BoardName.Text = DeviceInfoPresenter.GetBoardName();
-            BoardImage.Source = new BitmapImage(DeviceInfoPresenter.GetBoardImageUri());
+            var boardName = DeviceInfoPresenter.GetBoardName();
+            var boardImage = DeviceInfoPresenter.GetBoardImageUri();
+            var osVersion = "";

             ulong version = 0;
             if (!ulong.TryParse(Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion, out version))
             {
                 var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
-                OSVersion.Text = loader.GetString("OSVersionNotAvailable");
+                osVersion = loader.GetString("OSVersionNotAvailable");
             }
             else
             {
-                OSVersion.Text = String.Format(CultureInfo.InvariantCulture,"{0}.{1}.{2}.{3}",
+                osVersion = String.Format(CultureInfo.InvariantCulture,"{0}.{1}.{2}.{3}",
                     (version & 0xFFFF000000000000) >> 48,
                     (version & 0x0000FFFF00000000) >> 32,
                     (version & 0x00000000FFFF0000) >> 16,
                     version & 0x000000000000FFFF);
             }
-        }
-
-        private void UpdateDateTime()
+
+            MainPageDispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
+            {
+                BoardName.Text = boardName;
+                BoardImage.Source = new BitmapImage(boardImage);
+                OSVersion.Text = osVersion;
+            });
+
+        }
+
+        private void UpdateDateTime(bool dispatch)
         {
             // Using DateTime.Now is simpler, but the time zone is cached. So, we use a native method insead.
             SYSTEMTIME localTime;
             NativeTimeMethods.GetLocalTime(out localTime);

             DateTime t = localTime.ToDateTime();
-            CurrentTime.Text = t.ToString("t", CultureInfo.CurrentCulture) + Environment.NewLine + t.ToString("d", CultureInfo.CurrentCulture);
+            var time = t.ToString("t", CultureInfo.CurrentCulture) + Environment.NewLine + t.ToString("d", CultureInfo.CurrentCulture);
+            if (dispatch)
+            {
+                MainPageDispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
+                {
+                    CurrentTime.Text = time;
+                });
+            }
+            else
+            {
+                CurrentTime.Text = time;
+            }
         }

         private async void UpdateNetworkInfo()
         {
-            this.DeviceName.Text = DeviceInfoPresenter.GetDeviceName();
-            this.IPAddress1.Text = NetworkPresenter.GetCurrentIpv4Address();
-            this.NetworkName1.Text = NetworkPresenter.GetCurrentNetworkName();
-            this.NetworkInfo.ItemsSource = await NetworkPresenter.GetNetworkInformation();
+            var deviceName = DeviceInfoPresenter.GetDeviceName();
+            var ipAddress1 = NetworkPresenter.GetCurrentIpv4Address();
+            var networkName = NetworkPresenter.GetCurrentNetworkName();
+            var networkInfo = await NetworkPresenter.GetNetworkInformation();
+
+            MainPageDispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
+            {
+                this.DeviceName.Text = deviceName;
+                this.IPAddress1.Text = ipAddress1;
+                this.NetworkName1.Text = networkName;
+                this.NetworkInfo.ItemsSource = networkInfo;
+            });
         }

         private void UpdateConnectedDevices()
         {
             connectedDevicePresenter = new ConnectedDevicePresenter(MainPageDispatcher);
-            this.ConnectedDevices.ItemsSource = connectedDevicePresenter.GetConnectedDevices();
+            var connectedDevices = connectedDevicePresenter.GetConnectedDevices();
+
+            MainPageDispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
+            {
+                this.ConnectedDevices.ItemsSource = connectedDevices;
+            });
         }

         private void ShutdownButton_Clicked(object sender, RoutedEventArgs e)


Use Interlocked instead of lock() in CachedWebRootFileProvider

--- src/live.asp.net/Services/CachedWebRootFileProvider.cs
+++ src/live.asp.net/Services/CachedWebRootFileProvider.cs
@@ -3,6 +3,7 @@

 using System;
 using System.IO;
+using System.Threading;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.Caching.Memory;
 using Microsoft.Extensions.FileProviders;
@@ -26,6 +27,7 @@

         public void PrimeCache()
         {
+            // TODO: Log time taken to prime the cache
             _logger.LogInformation("Priming the cache");
             PrimeCacheImpl("/");
         }
@@ -33,7 +35,11 @@
         private void PrimeCacheImpl(string currentPath)
         {
             _logger.LogTrace("Priming cache for {currentPath}", currentPath);
+
+            // TODO: Normalize the currentPath here, e.g. strip/always-add leading slashes, ensure slash consistency, etc.
             var prefix = string.Equals(currentPath, "/", StringComparison.OrdinalIgnoreCase) ? "/" : currentPath + "/";
+
+            // TODO: Parallel.ForEach?
             foreach (var fileInfo in GetDirectoryContents(currentPath))
             {
                 if (fileInfo.IsDirectory)
@@ -76,8 +82,7 @@
             private static readonly int _fileSizeLimit = 256 * 1024; // bytes
             private readonly IFileProvider _fileProvider;
             private readonly string _subpath;
-            private IFileInfo _fileInfo;
-            private byte[] _contents;
+            private CacheEntry _cacheEntry;
             private readonly ILogger _logger;

             public CachedFileInfo(ILogger logger, IFileProvider fileProvider, string subpath)
@@ -86,39 +91,40 @@
                 _fileProvider = fileProvider;
                 _subpath = subpath;

-                Refresh();
+                LoadFileInfoFromUnderlyingProvider();
             }

-            private void Refresh()
+            private void LoadFileInfoFromUnderlyingProvider()
             {
-                _logger.LogDebug("Refreshing contents for {subpath}", _subpath);
-
-                lock (this)
+                // TODO: Handle file load exceptions here
+                var existingCacheEntry = _cacheEntry;
+                var newCacheEntry = new CacheEntry(_fileProvider.GetFileInfo(_subpath), null);
+                var oldCacheEntry = Interlocked.CompareExchange(ref _cacheEntry, newCacheEntry, existingCacheEntry);
+                if (oldCacheEntry == existingCacheEntry)
                 {
-                    _contents = null;
-                    // TODO: Handle file load exceptions here
-                    _fileInfo = _fileProvider.GetFileInfo(_subpath);
-                    IDisposable callback = null;
-                    callback = _fileProvider.Watch(_subpath).RegisterChangeCallback(_ =>
-                    {
-                        _logger.LogDebug("Change detected for {subpath}", _subpath);
-                        Refresh();
-                        callback.Dispose();
-                    }, null);
+                    _logger.LogDebug("Refreshed contents for {subpath} located at {filepath}", _subpath, newCacheEntry.FileInfo.PhysicalPath);
+                    _fileProvider.Watch(_subpath).RegisterChangeCallback(OnChange, this);
                 }
             }

-            public bool Exists => _fileInfo.Exists;
+            private static void OnChange(object state)
+            {
+                var self = (CachedFileInfo)state;
+                self._logger.LogDebug("Change detected for {subpath} located at {filepath}", self._subpath, self._cacheEntry.FileInfo.PhysicalPath);
+                self.LoadFileInfoFromUnderlyingProvider();
+            }

-            public bool IsDirectory => _fileInfo.IsDirectory;
+            public bool Exists => _cacheEntry.FileInfo.Exists;

-            public DateTimeOffset LastModified => _fileInfo.LastModified;
+            public bool IsDirectory => _cacheEntry.FileInfo.IsDirectory;

-            public long Length => _fileInfo.Length;
+            public DateTimeOffset LastModified => _cacheEntry.FileInfo.LastModified;

-            public string Name => _fileInfo.Name;
+            public long Length => _cacheEntry.FileInfo.Length;

-            public string PhysicalPath => _fileInfo.PhysicalPath;
+            public string Name => _cacheEntry.FileInfo.Name;
+
+            public string PhysicalPath => _cacheEntry.FileInfo.PhysicalPath;

             public Stream CreateReadStream()
             {
@@ -126,25 +132,49 @@
                 {
                     // TODO: The length limit check should really be done in the CachedWebRootFileProvider itself
                     //       as this implementation can result in the FileInfo meta-data being cached while the stream
-                    //       (and thus the file contents) itself not being cached, so things like length won't match.s
+                    //       (and thus the file contents) itself not being cached, so things like length won't match.
                     _logger.LogTrace("Stream for {subpath} not cached as it's over the file size limit of {fileSizeLimit}", _subpath, _fileSizeLimit);
-                    return _fileInfo.CreateReadStream();
+                    return _cacheEntry.FileInfo.CreateReadStream();
                 }

-                lock (this)
+                var contents = _cacheEntry.Contents;
+                if (contents != null)
                 {
-                    if (_contents == null)
+                    return new MemoryStream(contents);
+                }
+                else
+                {
+                    _logger.LogTrace("Reading file contents for {subpath} located at {filepath}", _subpath, _cacheEntry.FileInfo.PhysicalPath);
+                    using (var fs = _cacheEntry.FileInfo.CreateReadStream())
+                    using (var ms = new MemoryStream((int)fs.Length))
                     {
-                        _logger.LogTrace("Caching file contents for {subpath}", _subpath);
-                        using (var fs = _fileInfo.CreateReadStream())
-                        using (var ms = new MemoryStream((int)fs.Length))
-                        {
-                            fs.CopyTo(ms);
-                            _contents = ms.ToArray();
-                        }
+                        fs.CopyTo(ms);
+                        contents = ms.ToArray();
                     }

-                    return new MemoryStream(_contents);
+                    _cacheEntry.TrySetContents(contents);
+
+                    return new MemoryStream(contents);
+                }
+            }
+
+            private class CacheEntry
+            {
+                private byte[] _contents;
+
+                public CacheEntry(IFileInfo fileInfo, byte[] contents)
+                {
+                    FileInfo = fileInfo;
+                    _contents = contents;
+                }
+
+                public IFileInfo FileInfo { get; }
+
+                public byte[] Contents => _contents;
+
+                public bool TrySetContents(byte[] contents)
+                {
+                    return Interlocked.CompareExchange(ref _contents, contents, null) == null;
                 }
             }
         }


PR #8552 from manson: fix profile selection for all cameras in C# tutorial 4

--- wrappers/csharp/cs-tutorial-4-software-dev/Window.xaml.cs
+++ wrappers/csharp/cs-tutorial-4-software-dev/Window.xaml.cs
@@ -33,7 +33,7 @@
             return new Action<VideoFrame>(frame =>
             {
                 var rect = new Int32Rect(0, 0, frame.Width, frame.Height);
-                wbmp.WritePixels(rect, frame.Data, frame.Stride * frame.Height, frame.Stride);
+                wbmp.WritePixels(rect, frame.Data, frame.Stride * frame.Height, frame.Stride);
             });
         }

@@ -49,9 +49,75 @@
                 pipeline = new Pipeline();
                 colorizer = new Colorizer();

+                var depthWidth = 640;
+                var depthHeight = 480;
+                var depthFrames = 30;
+                var depthFormat = Format.Z16;
+
+                var colorWidth = 640;
+                var colorHeight = 480;
+                var colorFrames = 30;
+                using (var ctx = new Context())
+                {
+                    var devices = ctx.QueryDevices();
+                    var dev = devices[0];
+
+                    Console.WriteLine("\nUsing device 0, an {0}", dev.Info[CameraInfo.Name]);
+                    Console.WriteLine("    Serial number: {0}", dev.Info[CameraInfo.SerialNumber]);
+                    Console.WriteLine("    Firmware version: {0}", dev.Info[CameraInfo.FirmwareVersion]);
+
+                    var sensors = dev.QuerySensors();
+                    var depthSensor = sensors[0];
+                    var colorSensor = sensors[1];
+
+                    var depthProfiles = depthSensor.StreamProfiles
+                                        .Where(p => p.Stream == Stream.Depth)
+                                        .OrderBy(p => p.Framerate)
+                                        .Select(p => p.As<VideoStreamProfile>());
+                    VideoStreamProfile colorProfile = null;
+
+                    // select color profile to have frameset equal or closer to depth frameset to syncer work smooth
+                    foreach (var depthProfile in depthProfiles)
+                    {
+                        depthWidth = depthProfile.Width;
+                        depthHeight = depthProfile.Height;
+                        depthFrames = depthProfile.Framerate;
+                        depthFormat = depthProfile.Format;
+                        colorProfile = colorSensor.StreamProfiles
+                                            .Where(p => p.Stream == Stream.Color)
+                                            .OrderByDescending(p => p.Framerate)
+                                            .Select(p => p.As<VideoStreamProfile>())
+                                            .FirstOrDefault(p => p.Framerate == depthFrames);
+                        if (colorProfile != null)
+                        {
+                            colorWidth = colorProfile.Width;
+                            colorHeight = colorProfile.Height;
+                            colorFrames = colorProfile.Framerate;
+                            break;
+                        }
+                    }
+                    if (colorProfile == null)
+                    {
+                        // if no profile with the same framerate found, takes the first
+                        colorProfile = colorSensor.StreamProfiles
+                                        .Where(p => p.Stream == Stream.Color)
+                                        .OrderByDescending(p => p.Framerate)
+                                        .Select(p => p.As<VideoStreamProfile>()).FirstOrDefault();
+                        if (colorProfile == null)
+                        {
+                            throw new InvalidOperationException($"Error while finding appropriate depth and color profiles");
+                        }
+                        colorWidth = colorProfile.Width;
+                        colorHeight = colorProfile.Height;
+                        colorFrames = colorProfile.Framerate;
+
+                    }
+
+                }
+
                 var cfg = new Config();
-                cfg.EnableStream(Stream.Depth, 640, 480, Format.Z16, 30);
-                cfg.EnableStream(Stream.Color, 640, 480, Format.Rgb8, 30);
+                cfg.EnableStream(Stream.Depth, depthWidth, depthHeight, depthFormat, depthFrames);
+                cfg.EnableStream(Stream.Color, colorWidth, colorHeight, Format.Rgb8, colorFrames);

                 var profile = pipeline.Start(cfg);

@@ -65,24 +131,26 @@
                     type = Stream.Depth,
                     index = 0,
                     uid = 100,
-                    width = 640,
-                    height = 480,
-                    fps = 30,
+                    width = depthWidth,
+                    height = depthHeight,
+                    fps = depthFrames,
                     bpp = 2,
-                    format = Format.Z16,
+                    format = depthFormat,
                     intrinsics = profile.GetStream(Stream.Depth).As<VideoStreamProfile>().GetIntrinsics()
-                });
+                });
+                depth_sensor.AddReadOnlyOption(Option.DepthUnits, 1.0f / 5000);
+
                 var color_sensor = software_dev.AddSensor("Color");
                 var color_profile = color_sensor.AddVideoStream(new SoftwareVideoStream
                 {
                     type = Stream.Color,
                     index = 0,
                     uid = 101,
-                    width = 640,
-                    height = 480,
-                    fps = 30,
+                    width = colorWidth,
+                    height = colorHeight,
+                    fps = colorFrames,
                     bpp = 3,
-                    format = Format.Rgb8,
+                    format = Format.Rgb8,
                     intrinsics = profile.GetStream(Stream.Color).As<VideoStreamProfile>().GetIntrinsics()
                 });

@@ -130,11 +198,10 @@
                         {
                             if (new_frames.Count == 2)
                             {
+                                var colorFrame = new_frames.ColorFrame.DisposeWith(new_frames);
                                 var depthFrame = new_frames.DepthFrame.DisposeWith(new_frames);
-                                var colorFrame = new_frames.ColorFrame.DisposeWith(new_frames);
-
-                                var colorizedDepth = colorizer.Process<VideoFrame>(depthFrame).DisposeWith(new_frames);
-
+
+                                var colorizedDepth = colorizer.Process<VideoFrame>(depthFrame).DisposeWith(new_frames);
                                 // Render the frames.
                                 Dispatcher.Invoke(DispatcherPriority.Render, updateDepth, colorizedDepth);
                                 Dispatcher.Invoke(DispatcherPriority.Render, updateColor, colorFrame);


Checking if solution is opened on tick event

--HG--
branch : issue/VSIX-16

--- Lombiq.Vsix.Orchard/Services/OrchardErrorLogFileWatcher.cs
+++ Lombiq.Vsix.Orchard/Services/OrchardErrorLogFileWatcher.cs
@@ -75,7 +75,7 @@
         private string GetLogFileName()
         {
             var logFilePath = _logWatcherSettingsAccessor.GetSettings().LogFileFolderPath;
-            var solutionPath = _dte.Solution.IsOpen ? Path.GetDirectoryName(_dte.Solution.FileName) : "";
+            var solutionPath = IsSolutionOpened() ? Path.GetDirectoryName(_dte.Solution.FileName) : "";
             var errorLogFileName = "orchard-error-" + DateTime.Today.ToString("yyyy.MM.dd") + ".log";

             return Path.Combine(solutionPath, logFilePath, errorLogFileName);
@@ -83,6 +83,8 @@

         private void LogWatcherTimerElapsedCallback(object sender, ElapsedEventArgs e)
         {
+            if (!IsSolutionOpened()) return;
+
             var logFileStatus = GetLogFileStatus();

             if (!logFileStatus.Equals(_previousLogFileStatus))
@@ -97,5 +99,8 @@
                 _previousLogFileStatus = logFileStatus;
             }
         }
+
+        private bool IsSolutionOpened() =>
+            _dte.Solution.IsOpen;
     }
 }