LIBOMV-387 Adds methods and handlers to GroupManager to support getting group notice list and retrieving the notices, Thanks to Robin Cornelius for the patch

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

--- OpenMetaverse/GroupManager.cs
+++ OpenMetaverse/GroupManager.cs
@@ -246,6 +246,26 @@
             return Utils.StringToBytes(lsd);
              */
         }
+    }
+
+    ///
+    /// Struct representing a group notice list entry
+    ///
+    public struct GroupNoticeList
+    {
+        /// Notice ID
+        public UUID NoticeID;
+        /// Creation timestamp of notice
+        public uint Timestamp;
+        /// Agent name who created notice
+        public string FromName;
+        /// Notice subject
+        public string Subject;
+        /// Is there an attachment?
+        public bool HasAttachment;
+        /// Attachment Type
+        public AssetType AssetType;
+
     }

     ///
@@ -492,6 +512,13 @@
         /// <param name="success">true of member was successfully ejected</param>
         public delegate void GroupMemberEjectedCallback(UUID groupID, bool success);

+        ///
+        /// Fired when the list of group notices is recievied
+        ///
+        /// <param name="groupID">The <see cref="UUID"/> of the group for which the notice list entry was recievied</param>
+        /// <param name="notice">The Notice list entry</param>
+        public delegate void GroupNoticesListCallback(UUID groupID, GroupNoticeList notice);
+
         #endregion Delegates

         #region Events
@@ -537,6 +564,8 @@
         /// Fired when a GroupMemberEjected packet is received,
         /// indicates a member of a group has been ejected
         public event GroupMemberEjectedCallback OnGroupMemberEjected;
+        /// Fired when the list of group notices is recievied
+        public event GroupNoticesListCallback OnGroupNoticesList;

         #endregion Events

@@ -578,6 +607,7 @@
             Client.Network.RegisterCallback(PacketType.LeaveGroupReply, new NetworkManager.PacketCallback(LeaveGroupReplyHandler));
             Client.Network.RegisterCallback(PacketType.UUIDGroupNameReply, new NetworkManager.PacketCallback(UUIDGroupNameReplyHandler));
             Client.Network.RegisterCallback(PacketType.EjectGroupMemberReply, new NetworkManager.PacketCallback(EjectGroupMemberReplyHandler));
+            Client.Network.RegisterCallback(PacketType.GroupNoticesListReply, new NetworkManager.PacketCallback(GroupNoticesListReplyHandler));
         }

         ///
@@ -1000,6 +1030,51 @@
             Client.Network.SendPacket(grc);
         }

+        /// Request the group notices list
+        /// <param name="group">Group ID to fetch notices for</param>
+        public void RequestGroupNoticeList(UUID group)
+        {
+            OpenMetaverse.Packets.GroupNoticesListRequestPacket gnl = new GroupNoticesListRequestPacket();
+            gnl.AgentData.AgentID = Client.Self.AgentID;
+            gnl.AgentData.SessionID = Client.Self.SessionID;
+            gnl.Data.GroupID = group;
+            Client.Network.SendPacket(gnl);
+        }
+
+        /// Request a group notice by key
+        /// <param name="noticeID">ID of group notice</param>
+        public void RequestGroupNotice(UUID noticeID)
+        {
+            OpenMetaverse.Packets.GroupNoticeRequestPacket gnr = new GroupNoticeRequestPacket();
+            gnr.AgentData.AgentID = Client.Self.AgentID;
+            gnr.AgentData.SessionID = Client.Self.SessionID;
+            gnr.Data.GroupNoticeID = noticeID;
+            Client.Network.SendPacket(gnr);
+        }
+
+
+        private void GroupNoticesListReplyHandler(Packet packet, Simulator simulator)
+        {
+            GroupNoticesListReplyPacket reply = (GroupNoticesListReplyPacket)packet;
+
+            foreach (GroupNoticesListReplyPacket.DataBlock entry in reply.Data)
+            {
+                GroupNoticeList notice = new GroupNoticeList();
+                notice.FromName = Utils.BytesToString(entry.FromName);
+                notice.Subject = Utils.BytesToString(entry.Subject);
+                notice.NoticeID = entry.NoticeID;
+                notice.Timestamp = entry.Timestamp;
+                notice.HasAttachment = entry.HasAttachment;
+                notice.AssetType = (AssetType)entry.AssetType;
+
+                if (OnGroupNoticesList != null)
+                {
+                    try { OnGroupNoticesList(reply.AgentData.GroupID, notice); }
+                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
+                }
+            }
+        }
+
         /// Send out a group notice
         /// <param name="group">Group ID to update</param>
         /// <param name="notice">GroupNotice structure containing notice data</param>


- Modified Expression parameter name from where to whereCondition to be more descriptive.

--- FrannHammer.Services/MetadataService.cs
+++ FrannHammer.Services/MetadataService.cs
@@ -90,10 +90,10 @@
         /// </summary>
         /// <typeparam name="TEntity"></typeparam>
         /// <typeparam name="TDto"></typeparam>
-        /// <param name="where"></param>
-        /// <param name="fields"></param>
-        /// <returns></returns>
-        dynamic Get<TEntity, TDto>(Expression<Func<TEntity, bool>> where, string fields = "")
+        /// <param name="whereCondition"></param>
+        /// <param name="fields"></param>
+        /// <returns></returns>
+        dynamic Get<TEntity, TDto>(Expression<Func<TEntity, bool>> whereCondition, string fields = "")
             where TEntity : class, IEntity
             where TDto : class;

@@ -102,10 +102,10 @@
         /// </summary>
         /// <typeparam name="TEntity"></typeparam>
         /// <typeparam name="TDto"></typeparam>
-        /// <param name="where"></param>
-        /// <param name="fields"></param>
-        /// <returns></returns>
-        IEnumerable<dynamic> GetAll<TEntity, TDto>(Expression<Func<TEntity, bool>> where, string fields = "")
+        /// <param name="whereCondition"></param>
+        /// <param name="fields"></param>
+        /// <returns></returns>
+        IEnumerable<dynamic> GetAll<TEntity, TDto>(Expression<Func<TEntity, bool>> whereCondition, string fields = "")
             where TEntity : class, IEntity
             where TDto : class;


cleaner way to get the flags set correctly

--- src/Microsoft.TemplateEngine.Core/Util/ProcessorState.cs
+++ src/Microsoft.TemplateEngine.Core/Util/ProcessorState.cs
@@ -112,12 +112,12 @@
                     }
                 }

-                foreach(string state in turnOnByDefault)
-                {
-                    config.Flags[state] = true;
-                }
-
                 byEncoding[encoding] = trie;
+            }
+
+            foreach (string state in turnOnByDefault)
+            {
+                config.Flags[state] = true;
             }

             _trie = new TrieEvaluator<OperationTerminal>(trie);


* Switched back to NullStorage until crazy DB4o error is fixed.

--- OpenSim/Region/Application/OpenSimMain.cs
+++ OpenSim/Region/Application/OpenSimMain.cs
@@ -144,7 +144,7 @@

         protected override StorageManager CreateStorageManager(RegionInfo regionInfo)
         {
-            return new StorageManager("OpenSim.DataStore.DB4o.dll", regionInfo.DataStore, regionInfo.RegionName);
+            return new StorageManager("OpenSim.DataStore.NullStorage.dll", regionInfo.DataStore, regionInfo.RegionName);
         }

         protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager)


Remove of useless database call after password change. Connected to #2ad30a27.

--- TeamBuilder/Clients/TeamBuilder.Clients.Web/Controllers/ManageController.cs
+++ TeamBuilder/Clients/TeamBuilder.Clients.Web/Controllers/ManageController.cs
@@ -188,9 +188,6 @@

             if (result.Result.Succeeded)
             {
-                var user = UserManager.FindByIdAsync(User.Identity.GetUserId());
-                user.Wait();
-
                 return new JsonResult
                 {
                     Data = new { message = "Password successfully changed." },


MeshBasicMaterial using Material class

MeshBasicMaterial using Material class

--- GHva3c/GHva3c/va3c_MeshBasicMaterial.cs
+++ GHva3c/GHva3c/va3c_MeshBasicMaterial.cs
@@ -49,7 +49,7 @@
         /// </summary>
         protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
         {
-            pManager.AddTextParameter("Mesh Material", "Mm", "Mesh Material JSON representation.  Feed this into the Scene Compiler component.", GH_ParamAccess.item);
+            pManager.AddGenericParameter("Mesh Material", "Mm", "Mesh Material.  Feed this into the va3c Mesh component.", GH_ParamAccess.item);
         }

         /// <summary>
@@ -61,6 +61,7 @@
             //local varaibles
             GH_Colour inColor = null;
             Double inOpacity = 1;
+            string outMaterial = null;

             //catch inputs and populate local variables
             if (!DA.GetData(0, ref inColor)) { return; }
@@ -72,11 +73,14 @@
                 inOpacity = 1.0;
             }

+            outMaterial = CreateMaterial(inColor, inOpacity);
+            Material material = new Material(outMaterial, mType.Mesh);
+
             //set the output - build up a basic material json string
-            DA.SetData(0, CreateMaterial(inColor, inOpacity));
+            DA.SetData(0, material);
         }

-        private object CreateMaterial(GH_Colour inColor, double inOpacity)
+        private string CreateMaterial(GH_Colour inColor, double inOpacity)
         {
             dynamic jason = new ExpandoObject();
             jason.uuid = Guid.NewGuid();


Adding device session id

Adding device session id

--- Openpay/Entities/Request/ChargeRequest.cs
+++ Openpay/Entities/Request/ChargeRequest.cs
@@ -34,5 +34,8 @@

          [JsonProperty(PropertyName = "capture")]
          public Boolean Capture { set; get; }
+
+		 [JsonProperty(PropertyName = "device_session_id")]
+		 public String DeviceSessionId { set; get; }
     }
 }


Do full sync when knownEntityRelations are not available on partial sync.

--- GenSync/Synchronization/Synchronizer.cs
+++ GenSync/Synchronization/Synchronizer.cs
@@ -139,19 +139,19 @@

       try
       {
+        var knownEntityRelations = _entityRelationDataAccess.LoadEntityRelationData();
+
+        if (knownEntityRelations == null)
+        {
+          await Synchronize();
+          return;
+        }
+
         var aEntitesToSynchronize = new HashSet<TAtypeEntityId> (aEntityIds, _atypeIdComparer);
         var bEntitesToSynchronize = new HashSet<TBtypeEntityId> (bEntityIds, _btypeIdComparer);

         using (var totalProgress = _totalProgressFactory.Create())
         {
-          var knownEntityRelations = _entityRelationDataAccess.LoadEntityRelationData();
-
-          if (knownEntityRelations == null)
-          {
-            // TODO: perform inital entity matching
-            return;
-          }
-
           var entityRelationsToUse = new List<IEntityRelationData<TAtypeEntityId, TAtypeEntityVersion, TBtypeEntityId, TBtypeEntityVersion>>();
           var entityRelationsNotToUse = new List<IEntityRelationData<TAtypeEntityId, TAtypeEntityVersion, TBtypeEntityId, TBtypeEntityVersion>>();


UUidCache no longer throws exception if input is empty

--- PART/Source/Core/Engine/Part/UuidCache.cs
+++ PART/Source/Core/Engine/Part/UuidCache.cs
@@ -115,21 +115,24 @@
         /// <param name="pnrs">Array of CPR numbers</param>
         public void FillCache(string[] pnrs)
         {
-            var result = Manager.Part.GetUuidArray(BrokerContext.Current.UserToken, BrokerContext.Current.ApplicationToken, pnrs);
-            if (StandardReturType.IsSucceeded(result.StandardRetur))
+            if (pnrs.Length > 0)
             {
+                var result = Manager.Part.GetUuidArray(BrokerContext.Current.UserToken, BrokerContext.Current.ApplicationToken, pnrs);
+                if (StandardReturType.IsSucceeded(result.StandardRetur))
+                {

-                for (int i = 0; i < pnrs.Length; i++)
-                {
-                    if (Strings.IsGuid(result.UUID[i]))
+                    for (int i = 0; i < pnrs.Length; i++)
                     {
-                        _Cache[pnrs[i]] = new Guid(result.UUID[i]);
+                        if (Strings.IsGuid(result.UUID[i]))
+                        {
+                            _Cache[pnrs[i]] = new Guid(result.UUID[i]);
+                        }
                     }
                 }
-            }
-            else
-            {
-                throw new Exception("Could not get UUID array");
+                else
+                {
+                    throw new Exception("Could not get UUID array");
+                }
             }
         }


Removed done TODO.

Removed done TODO.

--- OthelloWPF/MainWindow.xaml.cs
+++ OthelloWPF/MainWindow.xaml.cs
@@ -15,7 +15,6 @@
 {
     /// <summary>
     /// Interaction logic for MainWindow.xaml
-    /// TODO: add a window that shows the game moves by both players.
     /// </summary>
     public partial class MainWindow : Window
     {


Update AssemblyBuilderExtension.cs

Update AssemblyBuilderExtension.cs

--- src/Natasha/Api/ExtensionApi/AssemblyBuilderExtension.cs
+++ src/Natasha/Api/ExtensionApi/AssemblyBuilderExtension.cs
@@ -257,6 +257,7 @@

+
         public static AssemblyCSharpBuilder ThrowAndLogSyntaxError(this AssemblyCSharpBuilder builder)
         {
             builder.Syntax.ErrorBehavior = ExceptionBehavior.Log | ExceptionBehavior.Throw;
@@ -267,11 +268,11 @@
             builder.Syntax.ErrorBehavior = ExceptionBehavior.Throw;
             return builder;
         }
-        //public static AssemblyCSharpBuilder ForceAddSyntax(this AssemblyCSharpBuilder builder)
-        //{
-        //    builder.Syntax.ErrorBehavior = ExceptionBehavior.Ignore;
-        //    return builder;
-        //}
+        public static AssemblyCSharpBuilder ForceAddSyntax(this AssemblyCSharpBuilder builder)
+        {
+            builder.Syntax.ErrorBehavior = ExceptionBehavior.Ignore;
+            return builder;
+        }
         public static AssemblyCSharpBuilder LogSyntaxError(this AssemblyCSharpBuilder builder)
         {
             builder.Syntax.ErrorBehavior = ExceptionBehavior.Log;


Disable Broadcast button

Disable Broadcast button

--- WalletWasabi.Gui/Controls/WalletExplorer/TransactionBroadcasterViewModel.cs
+++ WalletWasabi.Gui/Controls/WalletExplorer/TransactionBroadcasterViewModel.cs
@@ -17,6 +17,7 @@
 using WalletWasabi.Gui.Helpers;
 using WalletWasabi.Gui.Models.StatusBarStatuses;
 using WalletWasabi.Gui.ViewModels;
+using WalletWasabi.Gui.ViewModels.Validation;
 using WalletWasabi.Helpers;
 using WalletWasabi.Logging;

@@ -73,7 +74,10 @@
 				TransactionString = textToPaste;
 			});

-			BroadcastTransactionCommand = ReactiveCommand.CreateFromTask(async () => await OnDoTransactionBroadcastAsync());
+			BroadcastTransactionCommand = ReactiveCommand.CreateFromTask(
+				async () => await OnDoTransactionBroadcastAsync(),
+				this.WhenAny(x => x.TransactionString, (transactionString)=>(!string.IsNullOrWhiteSpace(transactionString.Value)))
+					.ObserveOn(RxApp.MainThreadScheduler));

 			ImportTransactionCommand = ReactiveCommand.CreateFromTask(async () =>
 			{


Remove usage of TPL

Remove usage of TPL


Fixed bug where the dictionary was not being sent with the sync publish method.

--- src/ProjectExtensions.Azure.ServiceBus/AzureBusSender.cs
+++ src/ProjectExtensions.Azure.ServiceBus/AzureBusSender.cs
@@ -57,7 +57,7 @@
             SendAsync<T>(obj, null, (result) => {
                 waitObject.Set();
                 failureException = result.ThrownException;
-            });
+            }, metadata);

             // Wait until the messaging operations are completed.
             bool completed = waitObject.WaitOne(sentTimeout);


fix unit test

fix unit test

--- ParserTests/samples/IndentedWhileTests.cs
+++ ParserTests/samples/IndentedWhileTests.cs
@@ -334,7 +334,7 @@
             var error = result.Errors.First();
             Assert.Equal(ErrorType.IndentationError,error.ErrorType);
             Assert.Equal(4,error.Line);
-            Assert.Contains("indentation error", error.ErrorMessage);
+            Assert.Contains("Indentation error", error.ErrorMessage);
         }
     }
 }


#8 added support for val()

#8 added support for val()

--- src/Selenium.WebDriver.Extensions/WebDriverExtensions.cs
+++ src/Selenium.WebDriver.Extensions/WebDriverExtensions.cs
@@ -146,6 +146,20 @@
         }

         /// <summary>
+        /// Searches for DOM elements using jQuery selector and gets the current value of the first element in the set
+        /// of matched elements.
+        /// </summary>
+        /// <param name="driver">The Selenium web driver.</param>
+        /// <param name="by">The Selenium jQuery selector.</param>
+        /// <returns>The current value of the first element in the set of matched elements.</returns>
+        public static string FindValue(
+            this IWebDriver driver,
+            JQuerySelector by)
+        {
+            return driver.Find<string>(by, "return {0}.val();");
+        }
+
+        /// <summary>
         /// Performs a jQuery search on the <see cref="IWebDriver"/> using given <see cref="JQuerySelector"/> selector
         /// and script format string.
         /// </summary>


completion unit test for reduce extension method does not check type constraints (#37800)

--- src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs
+++ src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs
@@ -10253,7 +10253,6 @@
                 matchingFilters: new List<CompletionItemFilter> { CompletionItemFilter.FieldFilter });
         }

-
         [Fact, Trait(Traits.Feature, Traits.Features.TargetTypedCompletion)]
         public async Task TestTargetTypeFilter_NotOnObjectMembers()
         {
@@ -10293,5 +10292,33 @@
                 markup, "C",
                 matchingFilters: new List<CompletionItemFilter> { CompletionItemFilter.ClassFilter });
         }
-    }
-}
+
+        [Fact(Skip = "https://github.com/dotnet/roslyn/issues/37780"), Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task CompletionShouldNotProvideExtensionMethodsIfTypeConstraintDoesNotMatch()
+        {
+            var markup = @"
+public static class Ext
+{
+    public static void DoSomething<T>(this T thing, string s) where T : class, I
+    {
+    }
+}
+
+public interface I
+{
+}
+
+public class C
+{
+    public void M(string s)
+    {
+        this.$$
+    }
+}";
+
+            await VerifyItemExistsAsync(markup, "M");
+            await VerifyItemExistsAsync(markup, "Equals");
+            await VerifyItemIsAbsentAsync(markup, "DoSomething", displayTextSuffix: "<>");
+        }
+    }
+}


Improve UnixFileStream.Read/WriteAsync consistency and perf

This commit addresses two related issues.

1) When a FileStream is created on Windows with FileOptions.Asynchronous (the default in corefx), synchronous Read and Write operations are actually implemented as blocking wrappers for ReadAsync and WriteAsync.  Since in FileOptions.Asynchronous mode ReadAsync and WriteAsync can be used to issue requests that run concurrently, this also means that a call to Read/Write could safely be made on the stream while a ReadAsync/WriteAsync operation was in progress.  In contrast in the current Unix implementation, Read/Write are not implemented as wrappers for ReadAsync/WriteAsync, so although ReadAsync/WriteAsync can have operations overlapped, using Read/Write while such an operation was outstanding could result in corruption of the FileStream, and in particular of its internal buffer.  In general, such usage patterns are not encouraged, but we should aim to be consistent across platforms in how we handle them and whether corruption is possible.

2) On Windows, when in FileOptions.Asynchronous mode, ReadAsync/WriteAsync use the stream's internal buffer directly, potentially avoiding making any asynchronous calls and just returning synchronously if the request can be satisfied using the buffer.  On Unix we were never doing that.

This commit addresses these as follows:
- One extra field is added to UnixFileStream that stores additional state used when FileOptions.Asynchronous is set.  This state includes a semaphore used to synchronize operations, as well as storage for the buffer/offset/count from the currently active async call, and a cached task that can be handed back for some ReadAsync operations.
- When FileOptions.Asynchronous is not set, little changes: Read/Write/ReadAsync/WriteAsync/ReadByte/WriteByte all check _useAsyncIO, and do exactly what they do today if it's false.
- When FileOptions.Asynchronous is set, Read/Write/ReadByte/WriteByte wrap their current behavior with calls to the semaphore's Wait/Release, such that they will be appropriately serialized with other outstanding asynchronous operations happening on the stream.  This addresses issue (1).
- For (2), when FileOptions.Asynchronous is set, ReadAsync/WriteAsync check whether there is enough data/space in the internal buffer to satisfy the request synchronously, and if there is they do the buffer copy synchronously and return an already completed task.  Since it's very common to ask for the same amount of data on each call, and thus if it's satisified by the buffer get exactly the same amount of data on each call, in ReadAsync we cache a task with a Result of the last number of bytes returned, and we reuse that task the next time if it contains the appropriate count.  This same optimization is already employed in the Windows implementation. When we do need to schedule work asynchronously, we also do so explicitly using a continuation off of the semaphore's WaitAsync rather than using the base implementation.  Due to the base Stream's implementation and its need to account for legacy async models, this ends up reducing the amount of memory used to schedule the async operation by ~50%.

--- src/System.IO.FileSystem/src/System/IO/UnixFileStream.cs
+++ src/System.IO.FileSystem/src/System/IO/UnixFileStream.cs
@@ -1,13 +1,12 @@
 // Copyright (c) Microsoft. All rights reserved.
 // Licensed under the MIT license. See LICENSE file in the project root for full license information.

+using Microsoft.Win32.SafeHandles;
 using System.Diagnostics;
 using System.Diagnostics.Contracts;
 using System.Runtime.InteropServices;
 using System.Threading;
 using System.Threading.Tasks;
-
-using Microsoft.Win32.SafeHandles;

 namespace System.IO
 {
@@ -32,8 +31,31 @@
         /// If the file was opened with FileMode.Append, the length of the file when opened; otherwise, -1.
         private readonly long _appendStart = -1;

-        /// Whether asynchronous read/write/flush operations should be performed using async I/O.
+        ///
+        /// Whether asynchronous read/write/flush operations should be performed using async I/O.
+        /// On Windows FileOptions.Asynchronous controls how the file handle is configured,
+        /// and then as a result how operations are issued against that file handle.  On Unix,
+        /// there isn't any distinction around how file descriptors are created for async vs
+        /// sync, but we still differentiate how the operations are issued in order to provide
+        /// similar behavioral semantics and performance characteristics as on Windows.  On
+        /// Windows, if non-async, async read/write requests just delegate to the base stream,
+        /// and no attempt is made to synchronize between sync and async operations on the stream;
+        /// if async, then async read/write requests are implemented specially, and sync read/write
+        /// requests are coordinated with async ones by implementing the sync ones over the async
+        /// ones.  On Unix, we do something similar.  If non-async, async read/write requests just
+        /// delegate to the base stream, and no attempt is made to synchronize.  If async, we use
+        /// a semaphore to coordinate both sync and async operations.
+        ///
         private readonly bool _useAsyncIO;
+
+        ///
+        /// Extra state used by the file stream when _useAsyncIO is true.  This includes
+        /// the semaphore used to serialize all operation, the buffer/offset/count provided by the
+        /// caller for ReadAsync/WriteAsync operations, and the last successul task returned
+        /// synchronously from ReadAsync which can be reused if the count matches the next request.
+        /// Only initialized when <see cref="_useAsyncIO"/> is true.
+        ///
+        private readonly AsyncState _asyncState;

         /// The length of the _buffer.
         private readonly int _bufferLength;
@@ -81,7 +103,11 @@
             _mode = mode;
             _options = options;
             _bufferLength = bufferSize;
-            _useAsyncIO = (options & FileOptions.Asynchronous) != 0;
+            if ((options & FileOptions.Asynchronous) != 0)
+            {
+                _useAsyncIO = true;
+                _asyncState = new AsyncState();
+            }

             // Translate the arguments into arguments for an open call
             Interop.Sys.OpenFlags openFlags = PreOpenConfigurationFromOptions(mode, access, options); // FileShare currently ignored
@@ -154,7 +180,11 @@
             _access = access;
             _exposedHandle = true;
             _bufferLength = bufferSize;
-            _useAsyncIO = useAsyncIO;
+            if (useAsyncIO)
+            {
+                _useAsyncIO = true;
+                _asyncState = new AsyncState();
+            }

             if (CanSeek)
             {
@@ -162,7 +192,10 @@
             }
         }

-        /// Gets the array used for buffering reading and writing.  If the array hasn't been allocated, this will lazily allocate it.
+        ///
+        /// Gets the array used for buffering reading and writing.
+        /// If the array hasn't been allocated, this will lazily allocate it.
+        ///
         /// <returns>The buffer.</returns>
         private byte[] GetBuffer()
         {
@@ -494,7 +527,7 @@
             VerifyBufferInvariants();
             if (_writePos > 0)
             {
-                WriteCore(GetBuffer(), 0, _writePos);
+                WriteNative(GetBuffer(), 0, _writePos);
                 _writePos = 0;
             }
         }
@@ -620,6 +653,31 @@
         {
             ValidateReadWriteArgs(array, offset, count);

+            if (_useAsyncIO)
+            {
+                _asyncState.Wait();
+                try { return ReadCore(array, offset, count); }
+                finally { _asyncState.Release(); }
+            }
+            else
+            {
+                return ReadCore(array, offset, count);
+            }
+        }
+
+        /// Reads a block of bytes from the stream and writes the data in a given buffer.
+        /// <param name="array">
+        /// When this method returns, contains the specified byte array with the values between offset and
+        /// (offset + count - 1) replaced by the bytes read from the current source.
+        /// </param>
+        /// <param name="offset">The byte offset in array at which the read bytes will be placed.</param>
+        /// <param name="count">The maximum number of bytes to read. </param>
+        /// <returns>
+        /// The total number of bytes read into the buffer. This might be less than the number of bytes requested
+        /// if that number of bytes are not currently available, or zero if the end of the stream is reached.
+        /// </returns>
+        private int ReadCore(byte[] array, int offset, int count)
+        {
             PrepareForReading();

             // Are there any bytes available in the read buffer? If yes,
@@ -639,12 +697,12 @@
                 {
                     // Read directly into the user's buffer
                     _readPos = _readLength = 0;
-                    return ReadCore(array, offset, count);
+                    return ReadNative(array, offset, count);
                 }
                 else
                 {
                     // Read into our buffer.
-                    _readLength = numBytesAvailable = ReadCore(GetBuffer(), 0, _bufferLength);
+                    _readLength = numBytesAvailable = ReadNative(GetBuffer(), 0, _bufferLength);
                     _readPos = 0;
                     if (numBytesAvailable == 0)
                     {
@@ -676,7 +734,7 @@
             {
                 Debug.Assert(_readPos == _readLength, "bytesToRead should only be < count if numBytesAvailable < count");
                 _readPos = _readLength = 0; // no data left in the read buffer
-                bytesRead += ReadCore(array, offset + bytesRead, count - bytesRead);
+                bytesRead += ReadNative(array, offset + bytesRead, count - bytesRead);
             }

             return bytesRead;
@@ -693,7 +751,7 @@
         /// The total number of bytes read into the buffer. This might be less than the number of bytes requested
         /// if that number of bytes are not currently available, or zero if the end of the stream is reached.
         /// </returns>
-        private unsafe int ReadCore(byte[] array, int offset, int count)
+        private unsafe int ReadNative(byte[] array, int offset, int count)
         {
             FlushWriteBuffer(); // we're about to read; dump the write buffer

@@ -730,17 +788,77 @@
             if (_fileHandle.IsClosed)
                 throw __Error.GetFileNotOpen();

-            // No specialized handling based on _useAsyncIO. The options available on Unix
-            // for reading asynchronously from an arbitrary file handle typically amount
-            // to just using another thread to do the synchronous read, which is exactly
-            // what the base Stream implementation does.  This does mean there are subtle
-            // differences in certain FileStream behaviors between Windows and Unix when
-            // multiple asynchronous operations are issued against the stream to execute
-            // concurrently; on Unix the operations will be serialized due to the base
-            // Stream's usage of a semaphore, but the position/length information won't
-            // be updated until after the read/write has completed.
-
-            return base.ReadAsync(buffer, offset, count, cancellationToken);
+            if (_useAsyncIO)
+            {
+                if (!_parent.CanRead) // match Windows behavior; this gets thrown synchronously
+                {
+                    throw __Error.GetReadNotSupported();
+                }
+
+                // Serialize operations using the semaphore.
+                Task waitTask = _asyncState.WaitAsync();
+
+                // If we got ownership immediately, and if there's enough data in our buffer
+                // to satisfy the full request of the caller, hand back the buffered data.
+                // While it would be a legal implementation of the Read contract, we don't
+                // hand back here less than the amount requested so as to match the behavior
+                // in ReadCore that will make a native call to try to fulfill the remainder
+                // of the request.
+                if (waitTask.Status == TaskStatus.RanToCompletion)
+                {
+                    int numBytesAvailable = _readLength - _readPos;
+                    if (numBytesAvailable >= count)
+                    {
+                        try
+                        {
+                            PrepareForReading();
+
+                            Buffer.BlockCopy(GetBuffer(), _readPos, buffer, offset, count);
+                            _readPos += count;
+
+                            return _asyncState._lastSuccessfulReadTask != null && _asyncState._lastSuccessfulReadTask.Result == count ?
+                                _asyncState._lastSuccessfulReadTask :
+                                (_asyncState._lastSuccessfulReadTask = Task.FromResult(count));
+                        }
+                        catch (Exception exc)
+                        {
+                            return Task.FromException<int>(exc);
+                        }
+                        finally
+                        {
+                            _asyncState.Release();
+                        }
+                    }
+                }
+
+                // Otherwise, issue the whole request asynchronously.
+                _asyncState.Update(buffer, offset, count);
+                return waitTask.ContinueWith((t, s) =>
+                {
+                    // The options available on Unix for writing asynchronously to an arbitrary file
+                    // handle typically amount to just using another thread to do the synchronous write,
+                    // which is exactly  what this implementation does. This does mean there are subtle
+                    // differences in certain FileStream behaviors between Windows and Unix when multiple
+                    // asynchronous operations are issued against the stream to execute concurrently; on
+                    // Unix the operations will be serialized due to the usage of a semaphore, but the
+                    // position /length information won't be updated until after the write has completed,
+                    // whereas on Windows it may happen before the write has completed.
+
+                    Debug.Assert(t.Status == TaskStatus.RanToCompletion);
+                    var thisRef = (UnixFileStream)s;
+                    try
+                    {
+                        byte[] b = thisRef._asyncState._buffer;
+                        thisRef._asyncState._buffer = null; // remove reference to user's buffer
+                        return thisRef.ReadCore(b, thisRef._asyncState._offset, thisRef._asyncState._count);
+                    }
+                    finally { thisRef._asyncState.Release(); }
+                }, this, CancellationToken.None, TaskContinuationOptions.DenyChildAttach, TaskScheduler.Default);
+            }
+            else
+            {
+                return base.ReadAsync(buffer, offset, count, cancellationToken);
+            }
         }

         ///
@@ -750,12 +868,26 @@
         /// <returns>The unsigned byte cast to an Int32, or -1 if at the end of the stream.</returns>
         public override int ReadByte()
         {
+            if (_useAsyncIO)
+            {
+                _asyncState.Wait();
+                try { return ReadByteCore(); }
+                finally { _asyncState.Release(); }
+            }
+            else
+            {
+                return ReadByteCore();
+            }
+        }
+
+        private int ReadByteCore()
+        {
             PrepareForReading();

             byte[] buffer = GetBuffer();
             if (_readPos == _readLength)
             {
-                _readLength = ReadCore(buffer, 0, _bufferLength);
+                _readLength = ReadNative(buffer, 0, _bufferLength);
                 _readPos = 0;
                 if (_readLength == 0)
                 {
@@ -788,6 +920,24 @@
         {
             ValidateReadWriteArgs(array, offset, count);

+            if (_useAsyncIO)
+            {
+                _asyncState.Wait();
+                try { WriteCore(array, offset, count); }
+                finally { _asyncState.Release(); }
+            }
+            else
+            {
+                WriteCore(array, offset, count);
+            }
+        }
+
+        /// Writes a block of bytes to the file stream.
+        /// <param name="array">The buffer containing data to write to the stream.</param>
+        /// <param name="offset">The zero-based byte offset in array from which to begin copying bytes to the stream.</param>
+        /// <param name="count">The maximum number of bytes to write.</param>
+        private void WriteCore(byte[] array, int offset, int count)
+        {
             PrepareForWriting();

             // If no data is being written, nothing more to do.
@@ -830,7 +980,7 @@
             Debug.Assert(_writePos == 0);
             if (count >= _bufferLength)
             {
-                WriteCore(array, offset, count);
+                WriteNative(array, offset, count);
             }
             else
             {
@@ -843,7 +993,7 @@
         /// <param name="array">The buffer containing data to write to the stream.</param>
         /// <param name="offset">The zero-based byte offset in array from which to begin copying bytes to the stream.</param>
         /// <param name="count">The maximum number of bytes to write.</param>
-        private unsafe void WriteCore(byte[] array, int offset, int count)
+        private unsafe void WriteNative(byte[] array, int offset, int count)
         {
             VerifyOSHandlePosition();

@@ -882,17 +1032,71 @@
             if (_fileHandle.IsClosed)
                 throw __Error.GetFileNotOpen();

-            // No specialized handling based on _useAsyncIO. The options available on Unix
-            // for writing asynchronously to an arbitrary file handle typically amount
-            // to just using another thread to do the synchronous write, which is exactly
-            // what the base Stream implementation does. This does mean there are subtle
-            // differences in certain FileStream behaviors between Windows and Unix when
-            // multiple asynchronous operations are issued against the stream to execute
-            // concurrently; on Unix the operations will be serialized due to the base
-            // Stream's usage of a semaphore, but the position/length information won't
-            // be updated until after the read/write has completed.
-
-            return base.WriteAsync(buffer, offset, count, cancellationToken);
+            if (_useAsyncIO)
+            {
+                if (!_parent.CanWrite) // match Windows behavior; this gets thrown synchronously
+                {
+                    throw __Error.GetWriteNotSupported();
+                }
+
+                // Serialize operations using the semaphore.
+                Task waitTask = _asyncState.WaitAsync();
+
+                // If we got ownership immediately, and if there's enough space in our buffer
+                // to buffer the entire write request, then do so and we're done.
+                if (waitTask.Status == TaskStatus.RanToCompletion)
+                {
+                    int spaceRemaining = _bufferLength - _writePos;
+                    if (spaceRemaining >= count)
+                    {
+                        try
+                        {
+                            PrepareForWriting();
+
+                            Buffer.BlockCopy(buffer, offset, GetBuffer(), _writePos, count);
+                            _writePos += count;
+
+                            return Task.CompletedTask;
+                        }
+                        catch (Exception exc)
+                        {
+                            return Task.FromException(exc);
+                        }
+                        finally
+                        {
+                            _asyncState.Release();
+                        }
+                    }
+                }
+
+                // Otherwise, issue the whole request asynchronously.
+                _asyncState.Update(buffer, offset, count);
+                return waitTask.ContinueWith((t, s) =>
+                {
+                    // The options available on Unix for writing asynchronously to an arbitrary file
+                    // handle typically amount to just using another thread to do the synchronous write,
+                    // which is exactly  what this implementation does. This does mean there are subtle
+                    // differences in certain FileStream behaviors between Windows and Unix when multiple
+                    // asynchronous operations are issued against the stream to execute concurrently; on
+                    // Unix the operations will be serialized due to the usage of a semaphore, but the
+                    // position /length information won't be updated until after the write has completed,
+                    // whereas on Windows it may happen before the write has completed.
+
+                    Debug.Assert(t.Status == TaskStatus.RanToCompletion);
+                    var thisRef = (UnixFileStream)s;
+                    try
+                    {
+                        byte[] b = thisRef._asyncState._buffer;
+                        thisRef._asyncState._buffer = null; // remove reference to user's buffer
+                        thisRef.WriteCore(b, thisRef._asyncState._offset, thisRef._asyncState._count);
+                    }
+                    finally { thisRef._asyncState.Release(); }
+                }, this, CancellationToken.None, TaskContinuationOptions.DenyChildAttach, TaskScheduler.Default);
+            }
+            else
+            {
+                return base.WriteAsync(buffer, offset, count, cancellationToken);
+            }
         }

         ///
@@ -902,8 +1106,22 @@
         /// <param name="value">The byte to write to the stream.</param>
         public override void WriteByte(byte value) // avoids an array allocation in the base implementation
         {
+            if (_useAsyncIO)
+            {
+                _asyncState.Wait();
+                try { WriteByteCore(value); }
+                finally { _asyncState.Release(); }
+            }
+            else
+            {
+                WriteByteCore(value);
+            }
+        }
+
+        private void WriteByteCore(byte value)
+        {
             PrepareForWriting();
-
+
             // Flush the write buffer if it's full
             if (_writePos == _bufferLength)
             {
@@ -1106,5 +1324,29 @@
                 }
             }
         }
+
+        /// State used when the stream is in async mode.
+        private sealed class AsyncState : SemaphoreSlim
+        {
+            /// The caller's buffer currently being used by the active async operation.
+            internal byte[] _buffer;
+            /// The caller's offset currently being used by the active async operation.
+            internal int _offset;
+            /// The caller's count currently being used by the active async operation.
+            internal int _count;
+            /// The last task successfully, synchronously returned task from ReadAsync.
+            internal Task<int> _lastSuccessfulReadTask;
+
+            /// Initialize the AsyncState.
+            internal AsyncState() : base(initialCount: 1, maxCount: 1) { }
+
+            /// Sets the active buffer, offset, and count.
+            internal void Update(byte[] buffer, int offset, int count)
+            {
+                _buffer = buffer;
+                _offset = offset;
+                _count = count;
+            }
+        }
     }
 }


Fixed null reference on query.

Fixed null reference on query.

--- Rant/Engine/Syntax/RAQuery.cs
+++ Rant/Engine/Syntax/RAQuery.cs
@@ -22,7 +22,10 @@
 		public override IEnumerator<RantAction> Run(Sandbox sb)
 		{
 			if (sb.Engine.Dictionary == null)
+			{
 				sb.Print("[Missing Table]");
+				yield break;
+			}
 			// carrier erase query
 			if (_query.Name == null)
 			{


Fix NullReferenceException on ChatManager shutdown

--- src/Tgstation.Server.Host/Components/Chat/ChatManager.cs
+++ src/Tgstation.Server.Host/Components/Chat/ChatManager.cs
@@ -593,16 +593,20 @@
 			}

 			// map the channel if it's private and we haven't seen it
+			var providerChannelId = message.User.Channel.RealId;
 			KeyValuePair<ulong, ChannelMapping>? mappedChannel;
 			long providerId;
 			lock (providers)
 			{
+				// important, otherwise we could end up processing during shutdown
+				cancellationToken.ThrowIfCancellationRequested();
+
 				providerId = providers
 					.Where(x => x.Value == provider)
 					.Select(x => x.Key)
 					.First();
 				mappedChannel = mappedChannels
-					.Where(x => x.Value.ProviderId == providerId && x.Value.ProviderChannelId == message.User.Channel.RealId)
+					.Where(x => x.Value.ProviderId == providerId && x.Value.ProviderChannelId == providerChannelId)
 					.FirstOrDefault();
 			}

@@ -648,7 +652,8 @@
 					return;
 				}

-				var mapping = mappedChannel.Value.Value;
+				var mappingNonNullableKvp = mappedChannel.Value;
+				var mapping = mappingNonNullableKvp.Value;

 				message.User.Channel.Id = mapping.Channel.Id;
 				message.User.Channel.Tag = mapping.Channel.Tag;


Added getter for selected enum.

Added getter for selected enum.

--- ReClass.NET/UI/ProjectView.cs
+++ ReClass.NET/UI/ProjectView.cs
@@ -171,6 +171,10 @@
 			}
 		}

+		[Browsable(false)]
+		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+		public EnumDescription SelectedEnum { get; private set; }
+
 		[DefaultValue(false)]
 		public bool AutoExpandClassNodes
 		{
@@ -262,14 +266,16 @@
 				return;
 			}

-			if (!(e.Node is ClassTreeNode node))
-			{
-				return;
-			}
-
-			if (selectedClass != node.ClassNode)
-			{
-				SelectedClass = node.ClassNode;
+			if (e.Node is ClassTreeNode classTreeNode)
+			{
+				if (selectedClass != classTreeNode.ClassNode)
+				{
+					SelectedClass = classTreeNode.ClassNode;
+				}
+			}
+			else if (e.Node is EnumTreeNode enumTreeNode)
+			{
+				SelectedEnum = enumTreeNode.Enum;
 			}
 		}


Address additional suggestions.

Address additional suggestions.

--- src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
+++ src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/PreferStreamAsyncMemoryOverloads.cs
@@ -80,8 +80,8 @@

         private void AnalyzeCompilationStart(CompilationStartAnalysisContext context)
         {
-            if (context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemMemory1) == null ||
-            !context.Compilation.TryGetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemIOStream, out INamedTypeSymbol? stream))
+            if (!context.Compilation.TryGetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemMemory1, out _) ||
+                !context.Compilation.TryGetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemIOStream, out INamedTypeSymbol? streamType))
             {
                 return;
             }
@@ -105,18 +105,22 @@
                     return;
                 }

-                if (IsStreamMethod(method, stream) && HasUndesiredArguments(method))
+                if (IsDefinedBy(method, streamType) && // Verify if the current method's type is or inherits from Stream
+                HasUndesiredArguments(method))
                 {
                     context.ReportDiagnostic(invocation.CreateDiagnostic(rule));
                 }
             }, OperationKind.Invocation);
         }

+        private static bool IsDefinedBy(IMethodSymbol method, INamedTypeSymbol baseType)
+        {
+            while (method.OverriddenMethod != null)
+            {
+                method = method.OverriddenMethod;
+            }

-        private static bool IsStreamMethod(IMethodSymbol method, INamedTypeSymbol stream)
-        {
-            return method.ContainingType.Equals(stream) ||
-                (method.OverriddenMethod != null && IsStreamMethod(method.OverriddenMethod, stream));
+            return method.ContainingType.Equals(baseType);
         }

         private static bool HasUndesiredArguments(IMethodSymbol method)
@@ -128,6 +132,5 @@
                 method.Parameters[1].Type.SpecialType == SpecialType.System_Int32 &&
                 method.Parameters[2].Type.SpecialType == SpecialType.System_Int32;
         }
-
     }
 }


Move ImmutableArray.Builder.ToImmutable empty optimization downstream

--- src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.cs
+++ src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.cs
@@ -174,11 +174,6 @@
             /// <returns>An immutable array.</returns>
             public ImmutableArray<T> ToImmutable()
             {
-                if (Count == 0)
-                {
-                    return Empty;
-                }
-
                 return new ImmutableArray<T>(this.ToArray());
             }

@@ -408,6 +403,11 @@
             /// </summary>
             public T[] ToArray()
             {
+                if (this.Count == 0)
+                {
+                    return Empty.array;
+                }
+
                 T[] result = new T[this.Count];
                 Array.Copy(_elements, 0, result, 0, this.Count);
                 return result;


Fixed test timeout issue. Build server seems to be *really* thread-starved - tasks are taking a very long time to move to the running state.

--- src/Tests/Nimbus.UnitTests/TaskExtensionTests/GivenOneTaskThatSucceedsAndOneTaskThatThrows.cs
+++ src/Tests/Nimbus.UnitTests/TaskExtensionTests/GivenOneTaskThatSucceedsAndOneTaskThatThrows.cs
@@ -13,6 +13,8 @@
         [TestFixture]
         public class WhenOpportunisticallyReturningTheirResultsAsTheyComplete : SpecificationFor<Task<int>[]>
         {
+            private const int _timeoutMilliseconds = 1000;
+
             private int[] _result;
             private Stopwatch _sw;

@@ -35,7 +37,7 @@

             public override void When()
             {
-                _result = Subject.ReturnOpportunistically(TimeSpan.FromMilliseconds(100)).ToArray();
+                _result = Subject.ReturnOpportunistically(TimeSpan.FromMilliseconds(_timeoutMilliseconds)).ToArray();
                 _sw.Stop();
             }

@@ -54,7 +56,7 @@
             [Test]
             public void TheElapsedTimeShouldBeLessThanTheTimeoutBecauseBothTasksCompleteImmediately()
             {
-                _sw.ElapsedMilliseconds.ShouldBeLessThan(100);
+                _sw.ElapsedMilliseconds.ShouldBeLessThan(_timeoutMilliseconds);
             }
         }
     }


Fixes: U4-5798 The database configuration failed with the following message: The incoming request has too many parameters. The server supports a maximum of 2100 parameters.

--- src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagRelationsTable.cs
+++ src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagRelationsTable.cs
@@ -38,15 +38,20 @@
             if (Context.CurrentDatabaseProvider == DatabaseProviders.MySql)
             {
                 Delete.ForeignKey().FromTable("cmsTagRelationship").ForeignColumn("nodeId").ToTable("umbracoNode").PrimaryColumn("id");
+                //check for another strange really old one that might have existed
+                if (constraints.Any(x => x.Item1 == "cmsTagRelationship" && x.Item2 == "tagId"))
+                {
+                    Delete.ForeignKey().FromTable("cmsTagRelationship").ForeignColumn("tagId").ToTable("cmsTags").PrimaryColumn("id");
+                }
             }
             else
             {
                 //Before we try to delete this constraint, we'll see if it exists first, some older schemas never had it and some older schema's had this named
                 // differently than the default.

-                var constraint = constraints
-                    .SingleOrDefault(x => x.Item1 == "cmsTagRelationship" && x.Item2 == "nodeId" && x.Item3.InvariantStartsWith("PK_") == false);
-                if (constraint != null)
+                var constraintMatches = constraints.Where(x => x.Item1 == "cmsTagRelationship" && x.Item2 == "nodeId" && x.Item3.InvariantStartsWith("PK_") == false);
+
+                foreach (var constraint in constraintMatches)
                 {
                     Delete.ForeignKey(constraint.Item3).OnTable("cmsTagRelationship");
                 }


Additional suppression

Additional suppression

--- src/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs
+++ src/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs
@@ -68,7 +68,9 @@
                 $"Could not find code block to analyze.  Does your test code have {StartString} and {EndString} around the braces of block to analyze?");
             ISymbol symbol = syntaxNode.Parent.GetDeclaredOrReferencedSymbol(model);

+#pragma warning disable CA1508 // Avoid dead conditional code - https://github.com/dotnet/roslyn-analyzers/issues/2180
             using (var cancellationSource = new CancellationTokenSource())
+#pragma warning restore CA1508 // Avoid dead conditional code
             {
                 ImmutableDictionary<(Location Location, IMethodSymbol Method), HazardousUsageEvaluationResult> actual =
                     PropertySetAnalysis.GetOrComputeHazardousUsages(


remove

remove

--- src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/FieldSymbolReferenceFinder.cs
+++ src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/FieldSymbolReferenceFinder.cs
@@ -2,7 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.

-using System;
 using System.Collections.Immutable;
 using System.Threading;
 using System.Threading.Tasks;


Only hide tooltip on close if it's currently visible

--- renderdocui/Controls/TreeListView/TreeListView.cs
+++ renderdocui/Controls/TreeListView/TreeListView.cs
@@ -196,6 +196,7 @@
 			this.TabStop = true;

 			m_tooltip = new ToolTip();
+			m_tooltipVisible = false;
 			m_tooltip.InitialDelay = 0;
 			m_tooltip.UseAnimation = false;
 			m_tooltip.UseFading = false;
@@ -219,7 +220,8 @@
 		protected override void Dispose(bool disposing)
 		{
 			m_tooltipTimer.Stop();
-			m_tooltip.Hide(this);
+			if(m_tooltipVisible)
+				m_tooltip.Hide(this);
 			m_tooltip.Dispose();
 			base.Dispose(disposing);
 		}
@@ -231,6 +233,7 @@
 			if (m_tooltipNode == null)
 			{
 				m_tooltip.Hide(this);
+				m_tooltipVisible = false;
 				return;
 			}

@@ -241,6 +244,7 @@
 			if (!ClientRectangle.Contains(p))
 			{
 				m_tooltip.Hide(this);
+				m_tooltipVisible = false;
 				return;
 			}

@@ -293,7 +297,10 @@
 						datastring = data.ToString();

 					if(datastring.Length > 0)
+					{
 						m_tooltip.Show(datastring, this, cellRect.X, cellRect.Y);
+						m_tooltipVisible = true;
+					}
 				}
 			}
 		}
@@ -363,6 +370,7 @@
 		ToolTip     m_tooltip;
 		Node        m_tooltipNode;
 		Timer       m_tooltipTimer;
+		bool        m_tooltipVisible;
 		VScrollBar	m_vScroll;
 		HScrollBar	m_hScroll;
 		Panel		m_hScrollFiller;
@@ -826,6 +834,7 @@
             {
                 m_tooltipNode = null;
                 m_tooltip.Hide(this);
+                m_tooltipVisible = false;
                 m_tooltipTimer.Stop();
             }

@@ -860,6 +869,7 @@
 		protected override void OnMouseWheel(MouseEventArgs e)
 		{
 			m_tooltip.Hide(this);
+			m_tooltipVisible = false;
 			m_tooltipTimer.Stop();

 			int value = m_vScroll.Value - (e.Delta * SystemInformation.MouseWheelScrollLines / 120);
@@ -870,6 +880,7 @@
 		protected override void OnMouseDown(MouseEventArgs e)
 		{
 			m_tooltip.Hide(this);
+			m_tooltipVisible = false;
 			m_tooltipTimer.Stop();

 			this.Focus();
@@ -955,6 +966,7 @@
 		{
 			m_tooltipNode = null;
 			m_tooltip.Hide(this);
+			m_tooltipVisible = false;
 			m_tooltipTimer.Stop();
 			base.OnLeave(e);
 			Invalidate();
@@ -964,6 +976,7 @@
         {
             m_tooltipNode = null;
             m_tooltip.Hide(this);
+            m_tooltipVisible = false;
             m_tooltipTimer.Stop();
             base.OnLostFocus(e);
             Invalidate();


added documentation

added documentation

--- RelicModManager/MainWindow.cs
+++ RelicModManager/MainWindow.cs
@@ -448,7 +448,6 @@
                 }
             }
             return null;
-
         }

         //prompts the user to specify where the "WorldOfTanks.exe" file is
@@ -460,7 +459,7 @@
             {
                 findWotExe.InitialDirectory = Path.GetDirectoryName(tanksLocation);
             }
-            //unable to find it in the registry, so ask for it
+            //unable to find it in the registry (or user activated manually selection), so ask for it
             if (findWotExe.ShowDialog().Equals(DialogResult.Cancel))
             {
                 downloadProgress.Text = Translations.getTranslatedString("canceled");


Enhance SecurityRequirementOperationFilter

`SecurityRequirementOperationFilter` should not only respect `AuthorizeAttribute` on the method, but also on the class, so additionally read the attributes from the declaring type.

Then use the configured `AuthorizationOptions` to retrieve the actual Policy that is named in the `AuthorizeAttribute`.
Then analyze the policy and find all scope requirements to figure out the actual required scopes.

--- test/WebSites/OAuth2Integration/ResourceServer/Swagger/SecurityRequirementsOperationFilter.cs
+++ test/WebSites/OAuth2Integration/ResourceServer/Swagger/SecurityRequirementsOperationFilter.cs
@@ -1,6 +1,9 @@
 using System.Linq;
 using System.Collections.Generic;
+using System.Linq;
 using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Authorization.Infrastructure;
+using Microsoft.Extensions.Options;
 using Microsoft.OpenApi.Models;
 using Swashbuckle.AspNetCore.SwaggerGen;

@@ -8,14 +11,31 @@
 {
     public class SecurityRequirementsOperationFilter : IOperationFilter
     {
+        private readonly AuthorizationOptions _authorizationOptions;
+
+        public SecurityRequirementsOperationFilter(IOptions<AuthorizationOptions> authorizationOptions)
+        {
+            // Beware: This might only part of the truth. If someone exchanges the IAuthorizationPolicyProvider and that loads
+            // policies and requirements from another source than the configured options, we might not get all requirements
+            // from here. But then we would have to make asynchronous calls from this synchronous interface.
+            _authorizationOptions = authorizationOptions?.Value ?? throw new ArgumentNullException(nameof(authorizationOptions));
+        }
+
         public void Apply(OpenApiOperation operation, OperationFilterContext context)
         {
-            // Policy names map to scopes
-            var requiredScopes = context.MethodInfo
+            var requiredPolicies = context.MethodInfo
                 .GetCustomAttributes(true)
+                .Concat(context.MethodInfo.DeclaringType.GetCustomAttributes(true))
                 .OfType<AuthorizeAttribute>()
                 .Select(attr => attr.Policy)
                 .Distinct();
+
+            var requiredScopes = requiredPolicies.Select(p => _authorizationOptions.GetPolicy(p))
+                .SelectMany(r => r.Requirements.OfType<ClaimsAuthorizationRequirement>())
+                .Where(cr => cr.ClaimType == "scope")
+                .SelectMany(r => r.AllowedValues)
+                .Distinct()
+                .ToList();

             if (requiredScopes.Any())
             {
@@ -31,7 +51,7 @@
                 {
                     new OpenApiSecurityRequirement
                     {
-                        [ oAuthScheme ] = requiredScopes.ToList()
+                        [ oAuthScheme ] = requiredScopes
                     }
                 };
             }


Changed the file download method to something less convoluted.

--- RepRancher/ConveyorService.cs
+++ RepRancher/ConveyorService.cs
@@ -359,6 +359,7 @@
                             }
                             if (jobs.Count() == 0 && P.canPrint)
                             {
+                                /* This is likely garbage, lets just do a standard post!
                                 System.IO.FileStream writeStream = new System.IO.FileStream((ConfigurationManager.AppSettings["TemporaryFileStorage"]) + Mi.CurrentJob.ToString() + ".gcode", System.IO.FileMode.Create);
                                 System.IO.FileStream readStream = (System.IO.FileStream)MakerFarmServiceContainer.Execute<System.IO.FileStream>(TakeThis, "POST", true, new BodyOperationParameter("ClientAPIKey", ClientAPIKey), new BodyOperationParameter("MachineName", ClientAPIKey), new BodyOperationParameter("JobId", ClientAPIKey));
                                 if (readStream.Length < 4194304)
@@ -381,9 +382,9 @@
                                             fileChunk = new byte[readStream.Length - i];
                                         }
                                     }
-                                }
-
-                                /*var url = "https://reporting.datacash.com/reporting2/csvlist";
+                                }*/
+
+                                var url = ConfigurationManager.AppSettings["MakerFarmAPIUri"] + TakeThis.ToString();
                                 using (var client = new WebClient())
                                 {
                                     var values = new NameValueCollection
@@ -393,8 +394,8 @@
                                         { "JobId", Mi.CurrentJob.ToString() }
                                     };
                                     byte[] result = client.UploadValues(url, values);
-                                    File.WriteAllBytes("C:\\foo\\bar.csv", result);
-                                }*/
+                                    File.WriteAllBytes(string.Concat(ConfigurationManager.AppSettings["TemporaryFileStorage"], Mi.CurrentJob.ToString(), ".gcode"), result);
+                                }
                                 //No job is running on the Printer! Lets send one.
                                 int CommandID = int.Parse(InvokeCommand("print -input_file "));
                                 bool MethodReception = false;


refs #23 Implement tests for a method of command execution

--- Application/MatchGeneratorTest/ViewModel/MemberListItemViewModelTest.cs
+++ Application/MatchGeneratorTest/ViewModel/MemberListItemViewModelTest.cs
@@ -232,7 +232,30 @@
 		[InlineData(false)]
 		public void ExtendClickMemberTest(bool isCheckedValue)
 		{
-
+			// Arrange
+			IList<object> actualMemberExtendedClickSenderParams = new List<object>();
+			IList<MemberClickEventArgs> actualMemberExtendedClickEParams = new List<MemberClickEventArgs>();
+			Instance.MemberExtendedClick += (s, e) =>
+			{
+				actualMemberExtendedClickSenderParams.Add(s);
+				actualMemberExtendedClickEParams.Add(e);
+			};
+			Instance.SetPrivateField("IsCheckedField", isCheckedValue);
+			Instance.IsChecked = false;
+			// Expected
+			object expectedMemberExtendedClickSenderParam = Instance;
+			bool expectedMemberExtendedClickEParam = isCheckedValue;
+			bool expectedIsChecked = true;
+
+			// Act
+			Instance.InvokePrivateMethod("ExtendClickMember");
+
+			// Assert
+			Assert.Single(actualMemberExtendedClickSenderParams);
+			Assert.Single(actualMemberExtendedClickEParams);
+			Assert.Same(expectedMemberExtendedClickSenderParam, actualMemberExtendedClickSenderParams[0]);
+			Assert.Equal(expectedMemberExtendedClickEParam, actualMemberExtendedClickEParams[0].IsChecked);
+			Assert.Equal(expectedIsChecked, Instance.IsChecked);
 		}

 		[Fact(DisplayName = "ExtendClickMemberメソッド : 異常系 : イベントハンドラが設定されていないときに落ちないこと")]
@@ -240,7 +263,8 @@
 		[Trait("type", "異常系")]
 		public void ExtendClickMemberTest_NoEventHandler()
 		{
-
+			// Act
+			Instance.InvokePrivateMethod("ExtendClickMember");
 		}
 	}
 }


Fixed a cylinder cap-triangle face interior contact point projection bug.

--- BepuPhysics/CollisionDetection/CollisionTasks/TriangleCylinderTester.cs
+++ BepuPhysics/CollisionDetection/CollisionTasks/TriangleCylinderTester.cs
@@ -299,7 +299,7 @@
                     //y = sign(localNormal.Y) * b.HalfLength
                     //pointOnCylinder = (interiorOnCylinderN.X, y, interiorOnCylinderN.Y)
                     //t = dot(localTriangleCenter - pointOnCylinder, triangleNormal) / dot(triangleNormal, localNormal)
-                    var inverseDenominator = Vector<float>.One / faceNormalADotNormal;
+                    var inverseDenominator = new Vector<float>(-1f) / faceNormalADotNormal;
                     var yOffset = localTriangleCenter.Y - capCenterBY;
                     var xOffset0 = localTriangleCenter.X - interiorOnCylinder0.X;
                     var zOffset0 = localTriangleCenter.Z - interiorOnCylinder0.Y;


cleanup

cleanup

--- Core.ApplicationServices/SystemUsage/Write/ItSystemUsageWriteService.cs
+++ Core.ApplicationServices/SystemUsage/Write/ItSystemUsageWriteService.cs
@@ -330,7 +330,7 @@
             return systemUsage.SetMainContract(contractResult.Value).Match<Result<ItSystemUsage, OperationError>>(error => error, () => systemUsage);
         }

-        private Result<ItSystemUsage, OperationError> UpdateExpectedUsersInterval(ItSystemUsage systemUsage, Maybe<(int lower, int? upperBound)> newInterval)
+        private static Result<ItSystemUsage, OperationError> UpdateExpectedUsersInterval(ItSystemUsage systemUsage, Maybe<(int lower, int? upperBound)> newInterval)
         {
             if (newInterval.IsNone)
                 systemUsage.ResetUserCount();


Refaktorert testklasse

Refaktorert testklasse

--- Difi.SikkerDigitalPost.Klient.Tester/enhetstester/FysiskPostInfoTest.cs
+++ Difi.SikkerDigitalPost.Klient.Tester/enhetstester/FysiskPostInfoTest.cs
@@ -9,28 +9,30 @@
     [TestClass]
     public class FysiskPostInfoTest
     {
-        [TestMethod]
-        public void StøtteForLegacyKonstruktør()
+        [TestClass]
+        public class Kontstruktør
         {
-           var fysiskPostInfo =
-             new FysiskPostInfo(DomeneUtility.GetFysiskPostMottaker(), Posttype.A, Utskriftsfarge.Farge,
-                Posthåndtering.DirekteRetur, DomeneUtility.GetFysiskPostMottaker());
-
-            Assert.IsInstanceOfType(fysiskPostInfo.Mottaker,typeof(FysiskPostMottaker));
-            Assert.IsInstanceOfType(fysiskPostInfo.ReturMottaker, typeof(FysiskPostMottaker));
+            [TestMethod]
+            public void StøtteForLegacyKonstruktør()
+            {
+                var fysiskPostInfo =
+                    new FysiskPostInfo(DomeneUtility.GetFysiskPostMottaker(), Posttype.A, Utskriftsfarge.Farge,
+                        Posthåndtering.DirekteRetur, DomeneUtility.GetFysiskPostMottaker());
+
+                Assert.IsInstanceOfType(fysiskPostInfo.Mottaker, typeof (FysiskPostMottaker));
+                Assert.IsInstanceOfType(fysiskPostInfo.ReturMottaker, typeof (FysiskPostMottaker));
+            }
+
+            [TestMethod]
+            public void SkalFungereMedNyKonstruktør()
+            {
+                var fysiskPostInfo =
+                    new FysiskPostInfo(DomeneUtility.GetFysiskPostMottaker(), Posttype.A, Utskriftsfarge.Farge,
+                        Posthåndtering.DirekteRetur, DomeneUtility.GetFysiskPostReturMottaker());
+
+                Assert.IsInstanceOfType(fysiskPostInfo.Mottaker, typeof (FysiskPostMottaker));
+                Assert.IsInstanceOfType(fysiskPostInfo.ReturMottaker, typeof (FysiskPostReturMottaker));
+            }
         }
-
-        [TestMethod]
-        public void SkalFungereMedNyKonstruktør()
-        {
-            var fysiskPostInfo =
-              new FysiskPostInfo(DomeneUtility.GetFysiskPostMottaker(), Posttype.A, Utskriftsfarge.Farge,
-                 Posthåndtering.DirekteRetur, DomeneUtility.GetFysiskPostReturMottaker());
-
-            Assert.IsInstanceOfType(fysiskPostInfo.Mottaker, typeof(FysiskPostMottaker));
-            Assert.IsInstanceOfType(fysiskPostInfo.ReturMottaker, typeof(FysiskPostReturMottaker));
-        }
-
-
     }
-}
+}


Cleanup.

Cleanup.

--- ExRam.Gremlinq.Providers.WebSocket/GremlinQueryEnvironmentExtensions.cs
+++ ExRam.Gremlinq.Providers.WebSocket/GremlinQueryEnvironmentExtensions.cs
@@ -75,19 +75,6 @@
                     {
                         if ((_logger?.IsEnabled(_loggingOptions.LogLevel)).GetValueOrDefault() && _loggingOptions.Verbosity > QueryLoggingVerbosity.None)
                             Log(bytecode.ToGroovy());
-
-                        //bytecode = new Bytecode
-                        //{
-                        //    StepInstructions =
-                        //    {
-                        //        new Instruction("V"),
-                        //        new Instruction(
-                        //            "coalesce",
-                        //            new Bytecode {StepInstructions = {new Instruction("E")}},
-                        //            new Bytecode {StepInstructions = {new Instruction("constant", 1)}}
-                        //        )
-                        //    }
-                        //};

                         var requestMsg = RequestMessage.Build(Tokens.OpsBytecode)
                             .Processor(Tokens.ProcessorTraversal)


[Modify] Add it

[Modify] Add it

--- websocket-sharp/WebSocketFrame.cs
+++ websocket-sharp/WebSocketFrame.cs
@@ -665,6 +665,15 @@
              );
     }

+    internal static WebSocketFrame CreatePongFrame (
+      PayloadData payloadData, bool mask
+    )
+    {
+      return new WebSocketFrame (
+               Fin.Final, Opcode.Pong, payloadData, false, mask
+             );
+    }
+
     internal static WebSocketFrame ReadFrame (Stream stream, bool unmask)
     {
       var frame = readHeader (stream);


Change to dose.

Change to dose.

--- ExchangeWebServices/Source/MS-OXWSSYNC/TestSuite/S02_SyncFolderItems.cs
+++ ExchangeWebServices/Source/MS-OXWSSYNC/TestSuite/S02_SyncFolderItems.cs
@@ -1539,7 +1539,7 @@
                     ResponseCodeType.NoError,
                     responseMessage.ResponseCode,
                     37811008,
-                    @"[In Appendix C: Product Behavior] Implementation dose support the SyncScope element. (Exchange 2010 and above follow this behavior.)");
+                    @"[In Appendix C: Product Behavior] Implementation does support the SyncScope element. (Exchange 2010 and above follow this behavior.)");
             }

             // Assert the changes in response is not null
@@ -1643,7 +1643,7 @@
                     ResponseCodeType.NoError,
                     responseMessage.ResponseCode,
                     37811008,
-                    @"[In Appendix C: Product Behavior] Implementation dose support the SyncScope element. (Exchange 2010 and above follow this behavior.)");
+                    @"[In Appendix C: Product Behavior] Implementation does support the SyncScope element. (Exchange 2010 and above follow this behavior.)");
             }

             // Assert the changes in response is not null
@@ -1894,7 +1894,7 @@
                     (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item,
                     typeof(MessageType),
                     37811004,
-                    @"[In Appendix C: Product Behavior] Implementation dose return a MessageType complex type. (If a client creates an item of this type, a MessageType complex type is returned.)");
+                    @"[In Appendix C: Product Behavior] Implementation does return a MessageType complex type. (If a client creates an item of this type, a MessageType complex type is returned.)");
             }
             #endregion

@@ -1961,7 +1961,7 @@
         [TestCategory("MSOXWSSYNC"), TestMethod()]
         public void MSOXWSSYNC_S02_TC11_SyncFolderItems_AbchPersonItemType()
         {
-                Site.Assume.IsTrue(Common.IsRequirementEnabled(37811006, this.Site), "Implementation dose support the Person element.");
+            Site.Assume.IsTrue(Common.IsRequirementEnabled(37811006, this.Site), "Implementation does support the Person element.");

                 #region Step 1. Client invokes SyncFolderItems operation to get initial syncState of contacts folder.
                 DistinguishedFolderIdNameType contactFolder = DistinguishedFolderIdNameType.contacts;
@@ -2016,7 +2016,7 @@
                 Site.CaptureRequirementIfIsTrue(
                     isDistributionListCreated,
                     37811006,
-                    @"[In Appendix C: Product Behavior] Implementation dose support the Person element. (Exchange 2016 follow this behavior.)");
+                    @"[In Appendix C: Product Behavior] Implementation does support the Person element. (Exchange 2016 follow this behavior.)");
                 #endregion

                 #region Step 4. Client invokes UpdateItem operation to update the created item which created in Step 2.
@@ -2057,7 +2057,7 @@
                 Site.CaptureRequirementIfIsTrue(
                     isDistributionListUpdated,
                     37811006,
-                    @"[In Appendix C: Product Behavior] Implementation dose support the Person element. (Exchange 2016 follow this behavior.)");
+                    @"[In Appendix C: Product Behavior] Implementation does support the Person element. (Exchange 2016 follow this behavior.)");
                 #endregion

                 #region Step 6. Client invokes DeleteItem operation to delete the DistributionListType item which updated in Step 4.


Added additional null check

Added additional null check

--- CopaceticSoftware.CodeGenerator.StarterKit/Infrastructure/IO/VisualStudioOpenDocumentReader.cs
+++ CopaceticSoftware.CodeGenerator.StarterKit/Infrastructure/IO/VisualStudioOpenDocumentReader.cs
@@ -57,7 +57,7 @@

         public string GetDocumentText()
         {
-            if (null == _textDocument)
+            if (null == _textDocument || null == _textDocument.StartPoint)
                 return string.Empty;

             try


Rename field in GroovyGremlinQueryElementVisitor.

--- ExRam.Gremlinq.Core/ExecutionPipelines/GroovySerialization/GroovyGremlinQueryElementVisitor.cs
+++ ExRam.Gremlinq.Core/ExecutionPipelines/GroovySerialization/GroovyGremlinQueryElementVisitor.cs
@@ -25,7 +25,7 @@
         private readonly StringBuilder _builder = new StringBuilder();
         private readonly Stack<State> _stateQueue = new Stack<State>();
         private readonly Dictionary<object, string> _variables = new Dictionary<object, string>();
-        private readonly Dictionary<StepLabel, string> _stepLabelMappings = new Dictionary<StepLabel, string>();
+        private readonly Dictionary<StepLabel, string> _stepLabelNames = new Dictionary<StepLabel, string>();

         #region Visit
         public virtual void Visit(HasNotStep step)
@@ -844,10 +844,10 @@
         {
             if (constant is StepLabel stepLabel)
             {
-                if (!_stepLabelMappings.TryGetValue(stepLabel, out var stepLabelMapping))
+                if (!_stepLabelNames.TryGetValue(stepLabel, out var stepLabelMapping))
                 {
-                    stepLabelMapping = "l" + (_stepLabelMappings.Count + 1);
-                    _stepLabelMappings.Add(stepLabel, stepLabelMapping);
+                    stepLabelMapping = "l" + (_stepLabelNames.Count + 1);
+                    _stepLabelNames.Add(stepLabel, stepLabelMapping);
                 }

                 // ReSharper disable once TailRecursiveCall


This test no longer can work in with the new x-checks on arrays and types. So I've removed it. It is tested in other tests too, now, it turns now, just not so cleanly.

--- LINQToTTree/LINQToTTreeLib.Tests/Expressions/t_ArrayExpressionParser.cs
+++ LINQToTTree/LINQToTTreeLib.Tests/Expressions/t_ArrayExpressionParser.cs
@@ -1,6 +1,5 @@
 using System;
 using System.ComponentModel.Composition;
-using System.Linq;
 using System.Linq.Expressions;
 using LinqToTTreeInterfacesLib;
 using LINQToTTreeLib.Expressions;
@@ -9,7 +8,6 @@
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Remotion.Linq;
 using Remotion.Linq.Clauses;
-using Remotion.Linq.Clauses.Expressions;
 using Remotion.Linq.Parsing.Structure;

 namespace LINQToTTreeLib.Tests
@@ -127,21 +125,5 @@
             public int[] vals;
 #pragma warning restore 0649
         }
-
-        [TestMethod]
-        public void TestSubQueryExpression()
-        {
-            var q = new dummyntup();
-            q.vals = new int[] { 1, 2, 3, 4, 5 };
-            var model = GetModel(() => (from j in q.vals select j).Take(1));
-            var sq = new SubQueryExpression(model);
-
-            GeneratedCode gc = new GeneratedCode();
-            CodeContext cc = new CodeContext();
-
-            ArrayExpressionParser.ParseArrayExpression(null, sq, gc, cc, MEFUtilities.MEFContainer);
-
-            Assert.IsNotNull(cc.LoopVariable, "loop variable");
-        }
     }
 }


Updated urls in OpenFootballDB

Updated urls in OpenFootballDB

--- FantasySimulator/FantasySimulator.StartUp/FantasySimulator.DebugConsole/Data/OpenFootballDB.cs
+++ FantasySimulator/FantasySimulator.StartUp/FantasySimulator.DebugConsole/Data/OpenFootballDB.cs
@@ -11,7 +11,8 @@
     public class OpenFootballDB
     {
         private static readonly string BaseUrl                  = "https://raw.githubusercontent.com";
-        private static readonly string GetEnglishClubsUrl       = "/openfootball/eng-england/master/clubs.txt";
+        private static readonly string GetEnglishClubsUrl       = "/openfootball/eng-england/master/clubs/1-premierleague.txt";
+        private static readonly string GetWelshClubsUrl         = "/openfootball/eng-england/master/clubs/wales.txt";

         public async Task<IList<Team>> GetEnglishClubs()
@@ -22,7 +23,6 @@
                 // Get clubs
                 var http = new HttpClient();
                 http.BaseAddress = new Uri(BaseUrl);
-                //var uri = new Uri(http.BaseAddress, GetEnglishClubsUrl);
                 var uri = GetEnglishClubsUrl;
                 var request = new HttpRequestMessage(HttpMethod.Get, uri);
                 var response = await http.SendAsync(request);
@@ -51,7 +51,58 @@
                         }

-                        if (line.StartsWith("[") && line.EndsWith("]"))
+                        if (line.StartsWith("[") && line.Contains("]"))
+                            prevIsTeamHeader = true;
+                        else
+                            prevIsTeamHeader = false;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                throw;
+            }
+            return result;
+        }
+
+
+        public async Task<IList<Team>> GetWelshClubs()
+        {
+            var result = new List<Team>();
+            try
+            {
+                // Get clubs
+                var http = new HttpClient();
+                http.BaseAddress = new Uri(BaseUrl);
+                var uri = GetWelshClubsUrl;
+                var request = new HttpRequestMessage(HttpMethod.Get, uri);
+                var response = await http.SendAsync(request);
+                response.EnsureSuccessStatusCode();
+
+                using (var stream = await response.Content.ReadAsStreamAsync())
+                using (var streamReader = new StreamReader(stream))
+                {
+                    var prevIsTeamHeader = false;
+                    while (!streamReader.EndOfStream)
+                    {
+                        var line = await streamReader.ReadLineAsync();
+                        if (prevIsTeamHeader)
+                        {
+                            var vals = line.Trim().Split(',');
+                            var names = vals[0].Split('|').Select(x => x.Trim()).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
+                            var year = vals.Length > 1 ? vals[1].Trim() : null;
+                            var abbr = vals.Length > 2 ? vals[2].Trim() : null;
+
+                            var team = new Team();
+                            team.ID = names.First();
+                            team.Name = names.First();
+                            team.Aliases = names;
+                            team.ShortName = abbr;
+                            result.Add(team);
+                        }
+
+
+                        if (line.StartsWith("[") && line.Contains("]"))
                             prevIsTeamHeader = true;
                         else
                             prevIsTeamHeader = false;


#120 Fixed default cm size

#120 Fixed default cm size

--- xFunc/Views/PlottingGraph.xaml.cs
+++ xFunc/Views/PlottingGraph.xaml.cs
@@ -38,7 +38,7 @@
         private double centerX;
         private double centerY;
         private Point startPoint;
-        private double cm = 40;
+        private double cm = = 37.795276;

         public PlottingGraph()
         {


New update service

New update service

Github have recently updated the tags page, causing the update service to be unavailable and unable to download the latest version from the client. This fixes #137.

--- code/Update.cs
+++ code/Update.cs
@@ -117,15 +117,15 @@
 				// using tls 1.2 as security protocol to contact Github.com
 				ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

-				// gets the list of tags in the Github repository tags webpage
+				// gets the latest tag in the Github repository tags webpage
 				HttpResponseMessage response = await Http.GetAsync(Settings.Default.GITHUB_REPOSITORY + "/tags");

 				HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
 				document.LoadHtml(await response.Content.ReadAsStringAsync());

-				HtmlNodeCollection collection = document.DocumentNode.SelectNodes("//span[@class='tag-name']");
-
-				if (collection == null || collection.Count == 0) {
+				HtmlNode node = document.DocumentNode.SelectSingleNode("//a[contains(@href, 'releases/tag/v')]");
+
+				if (node == null) {

 					// indicates to the user that the update service is not reachable for the moment
 					if (verbose) {
@@ -135,8 +135,7 @@
 					return;
 				}

-				List<string> tags = collection.Select(p => p.InnerText).ToList();
-				string release = tags.First();
+				string release = node.InnerText.Trim();

 				// stores the latest update datetime control
 				Settings.Default.UpdateControl = DateTime.Now;


Write all data from dictionary to file

Write all data from dictionary to file

--- LZW/LZW.cs
+++ LZW/LZW.cs
@@ -160,8 +160,11 @@

             while(nbr > 0)
             {
+                int characterIndex = bitReader.readNBits(index);
+                var charString = symbolDecompressDictionary[characterIndex][0];
+
+

-

@@ -212,7 +215,7 @@
             foreach (KeyValuePair<int, List<String>> symbol in dictionaryFromInput)
             {
                 var element = (symbol.Key != noOfSymbols) ? symbol.Value[1] : symbol.Value[1][0].ToString();
-                valueIndex = getIndexFromDictionary(symbolDictionary, symbol.Value[1]);
+                valueIndex = getIndexFromDictionary(symbolDictionary, element);
                 bitWriter.writeNBits(valueIndex, index);
             }


Changed zombie grunting frequency

Changed zombie grunting frequency

--- Pandaros.Settlers/Pandaros.Settlers/Managers/MonsterManager.cs
+++ Pandaros.Settlers/Pandaros.Settlers/Managers/MonsterManager.cs
@@ -22,14 +22,14 @@

                 foreach (var monster in GetAllMonsters())
                 {
-                    if (m == null || Vector3.Distance(monster.Value.Position, m.Position) > 5)
+                    if (m == null || (Vector3.Distance(monster.Value.Position, m.Position) > 10 && Pipliz.Random.NextBool()))
                     {
                         m = monster.Value;
                         ServerManager.SendAudio(monster.Value.Position, GameLoader.NAMESPACE + "ZombieAudio");
                     }
                 }

-                _nextUpdateTime = Pipliz.Time.SecondsSinceStartDouble + 1;
+                _nextUpdateTime = Pipliz.Time.SecondsSinceStartDouble + 5;
             }
         }


Format file for easier readability

Format file for easier readability

--- Python/Product/Debugger/Debugger/IPythonDebugOptionsService.cs
+++ Python/Product/Debugger/Debugger/IPythonDebugOptionsService.cs
@@ -21,21 +21,25 @@
         /// Default is false.
         /// </summary>
         bool PromptBeforeRunningWithBuildError { get; }
+
         /// <summary>
         /// True to copy standard output from a Python process into the Output
         /// window. Default is true.
         /// </summary>
         bool TeeStandardOutput { get; }
+
         /// <summary>
         /// True to pause at the end of execution when an error occurs. Default.
         /// is true.
         /// </summary>
         bool WaitOnAbnormalExit { get; }
+
         /// <summary>
         /// True to pause at the end of execution when completing successfully.
         /// Default is true.
         /// </summary>
         bool WaitOnNormalExit { get; }
+
         /// <summary>
         /// True to break on a SystemExit exception even when its exit code is
         /// zero. This applies only when the debugger would normally break on
@@ -43,17 +47,20 @@
         /// </summary>
         /// <remarks>New in 1.1</remarks>
         bool BreakOnSystemExitZero { get; }
+
         /// <summary>
         /// True if the standard launcher should allow debugging of the standard
         /// library. Default is false.
         /// </summary>
         /// <remarks>New in 1.1</remarks>
         bool DebugStdLib { get; }
+
         /// <summary>
         /// Show the function return value in locals window.
         /// Default is true.
         /// </summary>
         bool ShowFunctionReturnValue { get; }
+
         /// <summary>
         /// True to use the legacy debugger. Default is false.
         /// </summary>


simplification

simplification

--- WalletWasabi.Fluent/ViewModels/Navigation/RoutableViewModel.cs
+++ WalletWasabi.Fluent/ViewModels/Navigation/RoutableViewModel.cs
@@ -104,7 +104,7 @@
 		{
 			foreach (var command in commands)
 			{
-				(command as ReactiveCommand<Unit, Unit>)?.IsExecuting
+				(command as IReactiveCommand)?.IsExecuting
 					.ObserveOn(RxApp.MainThreadScheduler)
 					.Skip(1)
 					.Subscribe(x => IsBusy = x);


Update for #15 and #14 - correct username and update "getAuthOTP" function.

--- privacyIDEAADFSProvider/OTPprovider.cs
+++ privacyIDEAADFSProvider/OTPprovider.cs
@@ -37,18 +37,20 @@
             {
                 // check if otp contains only numbers
                 // Bug #10 - beaks the OTP+PIN combination - removed
-                    //if (!IsDigitsOnly(OTPpin)) return false;
-
-                using (WebClient client = new WebClient())
-                {
-                    byte[] response =
-                    client.UploadValues(URL + "/validate/check", new NameValueCollection()
-                    {
+                //if (!IsDigitsOnly(OTPpin)) return false;
+
+                NameValueCollection request_header = new NameValueCollection(){
                         {"pass", OTPpin},
                         {"user", OTPuser},
-                        {"realm", realm},
-                        {"transaction_id", transaction_id}
-                    });
+                        {"realm", realm}
+                    };
+                // add transaction id if challenge request
+                if (!string.IsNullOrEmpty(transaction_id)) request_header.Add("transaction_id", transaction_id);
+                // send reqeust
+                using (WebClient client = new WebClient())
+                {
+                    byte[] response =
+                    client.UploadValues(URL + "/validate/check", request_header);
                     responseString = Encoding.UTF8.GetString(response);
                 }
                 return (getJsonNode(responseString, "status") == "true" && getJsonNode(responseString, "value") == "true");


Implemented basic tests for SemaphoreLight.

--- Renci.SshClient/Renci.SshNet.Tests/Classes/Common/SemaphoreLightTest.cs
+++ Renci.SshClient/Renci.SshNet.Tests/Classes/Common/SemaphoreLightTest.cs
@@ -1,57 +1,51 @@
-using Renci.SshNet.Common;
+using System.Threading;
+using Renci.SshNet.Common;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using System;
 using Renci.SshNet.Tests.Common;

 namespace Renci.SshNet.Tests.Classes.Common
 {
-    ///
-    ///This is a test class for SemaphoreLightTest and is intended
-    ///to contain all SemaphoreLightTest Unit Tests
-    ///
     [TestClass()]
     public class SemaphoreLightTest : TestBase
     {
-        ///
-        ///A test for SemaphoreLight Constructor
-        ///
         [TestMethod()]
         public void SemaphoreLightConstructorTest()
         {
-            int initialCount = 0; // TODO: Initialize to an appropriate value
-            SemaphoreLight target = new SemaphoreLight(initialCount);
-            Assert.Inconclusive("TODO: Implement code to verify target");
+            var initialCount = new Random().Next(1, 10);
+            var target = new SemaphoreLight(initialCount);
+            Assert.AreEqual(initialCount, target.CurrentCount);
+        }
+
+        [TestMethod()]
+        public void Release()
+        {
+            var initialCount = new Random().Next(1, 10);
+            var target = new SemaphoreLight(initialCount);
+
+            Assert.AreEqual(initialCount, target.Release());
+            Assert.AreEqual(initialCount + 1, target.CurrentCount);
+
+            Assert.AreEqual(initialCount + 1, target.Release());
+            Assert.AreEqual(initialCount + 2, target.CurrentCount);
         }

         ///
         ///A test for Release
         ///
         [TestMethod()]
-        public void ReleaseTest()
+        public void Release_ReleaseCount()
         {
-            int initialCount = 0; // TODO: Initialize to an appropriate value
-            SemaphoreLight target = new SemaphoreLight(initialCount); // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.Release();
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
+            var initialCount = new Random().Next(1, 10);
+            var target = new SemaphoreLight(initialCount);

-        ///
-        ///A test for Release
-        ///
-        [TestMethod()]
-        public void ReleaseTest1()
-        {
-            int initialCount = 0; // TODO: Initialize to an appropriate value
-            SemaphoreLight target = new SemaphoreLight(initialCount); // TODO: Initialize to an appropriate value
-            int releaseCount = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.Release(releaseCount);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
+            var releaseCount1 = new Random().Next(1, 10);
+            Assert.AreEqual(initialCount, target.Release(releaseCount1));
+            Assert.AreEqual(initialCount + releaseCount1, target.CurrentCount);
+
+            var releaseCount2 = new Random().Next(1, 10);
+            Assert.AreEqual(initialCount + releaseCount1, target.Release(releaseCount2));
+            Assert.AreEqual(initialCount + releaseCount1 + releaseCount2, target.CurrentCount);
         }

         ///
@@ -60,23 +54,41 @@
         [TestMethod()]
         public void WaitTest()
         {
-            int initialCount = 0; // TODO: Initialize to an appropriate value
-            SemaphoreLight target = new SemaphoreLight(initialCount); // TODO: Initialize to an appropriate value
+            const int sleepTime = 200;
+            const int initialCount = 2;
+            var target = new SemaphoreLight(initialCount);
+
+            var start = DateTime.Now;
+
             target.Wait();
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+            target.Wait();
+
+            Assert.IsTrue((DateTime.Now - start).TotalMilliseconds < 50);
+
+            var releaseThread = new Thread(
+                () =>
+                    {
+                        Thread.Sleep(sleepTime);
+                        target.Release();
+                    });
+            releaseThread.Start();
+
+            target.Wait();
+
+            var end = DateTime.Now;
+            var elapsed = end - start;
+
+            Assert.IsTrue(elapsed.TotalMilliseconds > 200);
+            Assert.IsTrue(elapsed.TotalMilliseconds < 250);
         }

-        ///
-        ///A test for CurrentCount
-        ///
         [TestMethod()]
         public void CurrentCountTest()
         {
-            int initialCount = 0; // TODO: Initialize to an appropriate value
-            SemaphoreLight target = new SemaphoreLight(initialCount); // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.CurrentCount;
-            Assert.Inconclusive("Verify the correctness of this test method.");
+            var initialCount = new Random().Next(1, 20);
+            var target = new SemaphoreLight(initialCount);
+
+            Assert.AreEqual(initialCount, target.CurrentCount);
         }
     }
 }


Guard against null values (#632)

Guard against null values (#632)

* Don't crash if a client tries to use a keyman
  keyboard that is not associated with a language

--- SIL.Windows.Forms.Keyboarding/Windows/KeymanKeyboardSwitchingAdapter.cs
+++ SIL.Windows.Forms.Keyboarding/Windows/KeymanKeyboardSwitchingAdapter.cs
@@ -12,6 +12,10 @@
 	{
 		public bool ActivateKeyboard(KeyboardDescription keyboard)
 		{
+			if (keyboard?.InputLanguage?.Culture == null)
+			{
+				return false;
+			}
 #if !MONO
 			foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages)
 			{


Fix inconsistent accessibility of static methods in XkbKeyboardAdaptor

--- SIL.WritingSystems.WindowsForms/Keyboarding/Linux/XkbKeyboardAdaptor.cs
+++ SIL.WritingSystems.WindowsForms/Keyboarding/Linux/XkbKeyboardAdaptor.cs
@@ -114,7 +114,7 @@
 				existingKeyboard.SetIsAvailable(false);
 		}

-		public static void AddKeyboardForLayout(IDictionary<string, XkbKeyboardDescription> curKeyboards, XklConfigRegistry.LayoutDescription layout,
+		internal static void AddKeyboardForLayout(IDictionary<string, XkbKeyboardDescription> curKeyboards, XklConfigRegistry.LayoutDescription layout,
 			int iGroup, IKeyboardAdaptor engine)
 		{
 			string description = GetDescription(layout);
@@ -234,7 +234,7 @@
 			return CreateKeyboardDefinition(id, this);
 		}

-		public static XkbKeyboardDescription CreateKeyboardDefinition(string id, IKeyboardAdaptor engine)
+		internal static XkbKeyboardDescription CreateKeyboardDefinition(string id, IKeyboardAdaptor engine)
 		{
 			string[] parts = id.Split('_');
 			string locale = parts[0];


Implemented Reset() method to clear the state of the cache to avoid side effects between unit tests. Fixed the failing test.

--- Anagrams/Models/DictionaryCache.cs
+++ Anagrams/Models/DictionaryCache.cs
@@ -11,7 +11,7 @@

 	public class DictionaryCache : IDictionaryCache
 	{
-		private static readonly DictionaryCache	Instance = new DictionaryCache();
+		private static DictionaryCache	Instance = new DictionaryCache();

 		DictionaryCache()
 		{
@@ -28,6 +28,7 @@

 		public static void Reset()
 		{
+			Instance = new DictionaryCache();
 		}
 	}
 }


Fixed parsing of invalid token in media list

--- AngleSharp/Parser/Css/CssParser.cs
+++ AngleSharp/Parser/Css/CssParser.cs
@@ -699,6 +699,8 @@

                 JumpToEndOfDeclaration(tokens);
             }
+            else if (list.Length == 0 && tokens.MoveNext())
+                JumpToEndOfDeclaration(tokens);

             return list;
         }


Fixed crash

Fixed crash

--- Tooll/Components/ParameterView/OperatorPresets/OperatorPresetManager.cs
+++ Tooll/Components/ParameterView/OperatorPresets/OperatorPresetManager.cs
@@ -347,6 +347,9 @@
         private void HighlightActivePreset()
         {
             var preset = TryToCreatePresetFromCurrentOperator();
+            if (preset == null)
+                return;
+
             foreach (var p in CurrentOperatorPresets)
             {
                 bool matching = true;


[VsIntegration] Fix exception reported by Chris

--- VisualStudio/XSharpAppDesigner/PropertyPages/XBuildPropertyPagePanel.cs
+++ VisualStudio/XSharpAppDesigner/PropertyPages/XBuildPropertyPagePanel.cs
@@ -233,7 +233,7 @@
             string documentationFile = "";
             if (chkXMLDocumentationFile.Checked)
             {
-                var asmName = this.ParentPropertyPage.GetProperty(XSharpProjectFileConstants.AssemblyName);
+                var asmName = this.ParentPropertyPage.GetProperty(XSharpProjectFileConstants.AssemblyName) ?? "NoName";
                 documentationFile = asmName + ".Xml";
             }
             var tag = "DocFile"; ;
@@ -264,7 +264,8 @@
             }
             else
             {
-                var warn = ParentPropertyPage.GetProperty(XSharpProjectFileConstants.TreatWarningsAsErrors).ToLower();
+                var warn = ParentPropertyPage.GetProperty(XSharpProjectFileConstants.TreatWarningsAsErrors) ?? "false";
+                warn = warn.ToLower();
                 rbWarningSpecific.Checked = false;
                 rbWarningAll.Checked = warn == "true";
                 rbWarningNone.Checked = warn != "true";


add a duck-for fun :)

add a duck-for fun :)

--- web/web/Views/HelloWorld/Index.cshtml
+++ web/web/Views/HelloWorld/Index.cshtml
@@ -3,5 +3,7 @@
     ViewBag.Title = "Index";
     Layout = "~/Views/_LayoutPage.cshtml";
 }
-
Index

+
A Duck

+
+
I caught this mandarin drake as I was sitting next to a pond at the San Diego Zoo. After setting up shots all over the zoo, I just focused and snapped the photo. It turned out to be the best photo of the day!