avoid "Unable to open file" popups caused by missing source code (#1038)

* avoid "Unable to open file" popups caused by missing source code
fixes microsoft/vscode-cpptools#811

* move check to HandleStackTraceRequest and do it in parallel with a timeout

* add client check

* Convert to Task

Co-authored-by: Andrew Wang <d5c202f86af5126494fe36cd53f58ea31bf832df@microsoft.com>

--- src/OpenDebugAD7/AD7DebugSession.cs
+++ src/OpenDebugAD7/AD7DebugSession.cs
@@ -1522,192 +1522,238 @@
             responder.SetResponse(response);
         }

-        protected override void HandleStackTraceRequestAsync(IRequestResponder<StackTraceArguments, StackTraceResponse> responder)
-        {
-            int threadReference = responder.Arguments.ThreadId;
-            int startFrame = responder.Arguments.StartFrame.GetValueOrDefault(0);
-            int levels = responder.Arguments.Levels.GetValueOrDefault(0);
-
-            StackTraceResponse response = new StackTraceResponse()
-            {
-                TotalFrames = 0
-            };
-
-            // Make sure we are stopped and receiving valid input or else return an empty stack trace
-            if (m_isStopped && startFrame >= 0 && levels >= 0)
-            {
+        protected override async void HandleStackTraceRequestAsync(IRequestResponder<StackTraceArguments, StackTraceResponse> responder)
+        {
+            try
+            {
+                int threadReference = responder.Arguments.ThreadId;
+                int startFrame = responder.Arguments.StartFrame.GetValueOrDefault(0);
+                int levels = responder.Arguments.Levels.GetValueOrDefault(0);
+
+                var response = new StackTraceResponse()
+                {
+                    TotalFrames = 0
+                };
+
+                // Make sure we are stopped and receiving valid input or else return an empty stack trace
+                if (!m_isStopped || startFrame < 0 || levels < 0)
+                {
+                    responder.SetResponse(response);
+                    return;
+                }
+
                 ThreadFrameEnumInfo frameEnumInfo = null;
                 IDebugThread2 thread;
                 lock (m_threads)
                 {
-                    if (m_threads.TryGetValue(threadReference, out thread))
-                    {
-                        enum_FRAMEINFO_FLAGS flags = enum_FRAMEINFO_FLAGS.FIF_FUNCNAME | // need a function name
-                                                        enum_FRAMEINFO_FLAGS.FIF_FRAME | // need a frame object
-                                                        enum_FRAMEINFO_FLAGS.FIF_FLAGS |
-                                                        enum_FRAMEINFO_FLAGS.FIF_DEBUG_MODULEP;
-
-                        uint radix = Constants.EvaluationRadix;
-
-                        if (responder.Arguments.Format != null)
-                        {
-                            StackFrameFormat format = responder.Arguments.Format;
-
-                            if (format.Hex == true)
-                            {
-                                radix = 16;
-                            }
-
-                            if (format.Line == true)
-                            {
-                                flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_LINES;
-                            }
-
-                            if (format.Module == true)
-                            {
-                                flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_MODULE;
-                            }
-
-                            if (format.Parameters == true)
-                            {
-                                flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS;
-                            }
-
-                            if (format.ParameterNames == true)
-                            {
-                                flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_NAMES;
-                            }
-
-                            if (format.ParameterTypes == true)
-                            {
-                                flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_TYPES;
-                            }
-
-                            if (format.ParameterValues == true)
-                            {
-                                flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_VALUES;
-                            }
-                        }
-                        else
-                        {
-                            // No formatting flags provided in the request - use the default format, which includes the module name and argument names / types
-                            flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_MODULE |
-                                        enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS |
-                                        enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_TYPES |
-                                        enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_NAMES;
-                        }
-
-                        if (m_settingsCallback != null)
-                        {
-                            // MIEngine generally gets the radix from IDebugSettingsCallback110 rather than using the radix passed
-                            m_settingsCallback.Radix = radix;
-                        }
-
-                        ErrorBuilder eb = new ErrorBuilder(() => AD7Resources.Error_Scenario_StackTrace);
-
-                        try
-                        {
-                            eb.CheckHR(thread.EnumFrameInfo(flags, radix, out IEnumDebugFrameInfo2 frameEnum));
-                            eb.CheckHR(frameEnum.GetCount(out uint totalFrames));
-
-                            frameEnumInfo = new ThreadFrameEnumInfo(frameEnum, totalFrames);
-                        }
-                        catch (AD7Exception ex)
-                        {
-                            responder.SetError(new ProtocolException(ex.Message, ex));
-                            return;
-                        }
-                    }
-                    else
+                    if (!m_threads.TryGetValue(threadReference, out thread))
                     {
                         // Invalid thread specified
                         responder.SetError(new ProtocolException(String.Format(CultureInfo.CurrentCulture, AD7Resources.Error_PropertyInvalid, StackTraceRequest.RequestType, "threadId")));
                         return;
                     }
-                }
-
-                if (startFrame < frameEnumInfo.TotalFrames)
-                {
-                    if (startFrame != frameEnumInfo.CurrentPosition)
-                    {
-                        frameEnumInfo.FrameEnum.Reset();
-                        frameEnumInfo.CurrentPosition = (uint)startFrame;
-
-                        if (startFrame > 0)
-                        {
-                            frameEnumInfo.FrameEnum.Skip((uint)startFrame);
-                        }
-                    }
-
-                    if (levels == 0)
-                    {
-                        // take the rest of the stack frames
-                        levels = (int)frameEnumInfo.TotalFrames - startFrame;
+
+                    enum_FRAMEINFO_FLAGS flags = enum_FRAMEINFO_FLAGS.FIF_FUNCNAME | // need a function name
+                                                    enum_FRAMEINFO_FLAGS.FIF_FRAME | // need a frame object
+                                                    enum_FRAMEINFO_FLAGS.FIF_FLAGS |
+                                                    enum_FRAMEINFO_FLAGS.FIF_DEBUG_MODULEP;
+
+                    uint radix = Constants.EvaluationRadix;
+
+                    if (responder.Arguments.Format != null)
+                    {
+                        StackFrameFormat format = responder.Arguments.Format;
+
+                        if (format.Hex == true)
+                        {
+                            radix = 16;
+                        }
+
+                        if (format.Line == true)
+                        {
+                            flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_LINES;
+                        }
+
+                        if (format.Module == true)
+                        {
+                            flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_MODULE;
+                        }
+
+                        if (format.Parameters == true)
+                        {
+                            flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS;
+                        }
+
+                        if (format.ParameterNames == true)
+                        {
+                            flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_NAMES;
+                        }
+
+                        if (format.ParameterTypes == true)
+                        {
+                            flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_TYPES;
+                        }
+
+                        if (format.ParameterValues == true)
+                        {
+                            flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_VALUES;
+                        }
                     }
                     else
                     {
-                        levels = Math.Min((int)frameEnumInfo.TotalFrames - startFrame, levels);
-                    }
-
-                    FRAMEINFO[] frameInfoArray = new FRAMEINFO[levels];
-                    uint framesFetched = 0;
-                    frameEnumInfo.FrameEnum.Next((uint)frameInfoArray.Length, frameInfoArray, ref framesFetched);
-                    frameEnumInfo.CurrentPosition += framesFetched;
-
-                    for (int i = 0; i < framesFetched; i++)
-                    {
-                        // TODO: annotated frames?
-                        var frameInfo = frameInfoArray[i];
-                        IDebugStackFrame2 frame = frameInfo.m_pFrame;
-
-                        int frameReference = 0;
-                        TextPositionTuple textPosition = TextPositionTuple.Nil;
-                        IDebugCodeContext2 memoryAddress = null;
-
-                        if (frame != null)
-                        {
-                            frameReference = m_frameHandles.Create(frame);
-                            textPosition = TextPositionTuple.GetTextPositionOfFrame(m_pathConverter, frame) ?? TextPositionTuple.Nil;
-                            frame.GetCodeContext(out memoryAddress);
-                        }
-
-                        int? moduleId = null;
-                        IDebugModule2 module = frameInfo.m_pModule;
-                        if (module != null)
-                        {
-                            lock (m_moduleMap)
+                        // No formatting flags provided in the request - use the default format, which includes the module name and argument names / types
+                        flags |= enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_MODULE |
+                                    enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS |
+                                    enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_TYPES |
+                                    enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_NAMES;
+                    }
+
+                    if (m_settingsCallback != null)
+                    {
+                        // MIEngine generally gets the radix from IDebugSettingsCallback110 rather than using the radix passed
+                        m_settingsCallback.Radix = radix;
+                    }
+
+                    ErrorBuilder eb = new ErrorBuilder(() => AD7Resources.Error_Scenario_StackTrace);
+
+                    try
+                    {
+                        eb.CheckHR(thread.EnumFrameInfo(flags, radix, out IEnumDebugFrameInfo2 frameEnum));
+                        eb.CheckHR(frameEnum.GetCount(out uint totalFrames));
+
+                        frameEnumInfo = new ThreadFrameEnumInfo(frameEnum, totalFrames);
+                    }
+                    catch (AD7Exception ex)
+                    {
+                        responder.SetError(new ProtocolException(ex.Message, ex));
+                        return;
+                    }
+                }
+
+                if (startFrame >= frameEnumInfo.TotalFrames)
+                {
+                    responder.SetResponse(response);
+                    return;
+                }
+
+                if (startFrame != frameEnumInfo.CurrentPosition)
+                {
+                    frameEnumInfo.FrameEnum.Reset();
+                    frameEnumInfo.CurrentPosition = (uint)startFrame;
+
+                    if (startFrame > 0)
+                    {
+                        frameEnumInfo.FrameEnum.Skip((uint)startFrame);
+                    }
+                }
+
+                if (levels == 0)
+                {
+                    // take the rest of the stack frames
+                    levels = (int)frameEnumInfo.TotalFrames - startFrame;
+                }
+                else
+                {
+                    levels = Math.Min((int)frameEnumInfo.TotalFrames - startFrame, levels);
+                }
+
+                var frameInfoArray = new FRAMEINFO[levels];
+                uint framesFetched = 0;
+                frameEnumInfo.FrameEnum.Next((uint)frameInfoArray.Length, frameInfoArray, ref framesFetched);
+                frameEnumInfo.CurrentPosition += framesFetched;
+
+                for (int i = 0; i < framesFetched; i++)
+                {
+                    // TODO: annotated frames?
+                    var frameInfo = frameInfoArray[i];
+                    IDebugStackFrame2 frame = frameInfo.m_pFrame;
+
+                    int frameReference = 0;
+                    TextPositionTuple textPosition = TextPositionTuple.Nil;
+                    IDebugCodeContext2 memoryAddress = null;
+
+                    if (frame != null)
+                    {
+                        frameReference = m_frameHandles.Create(frame);
+                        textPosition = TextPositionTuple.GetTextPositionOfFrame(m_pathConverter, frame) ?? TextPositionTuple.Nil;
+                        frame.GetCodeContext(out memoryAddress);
+                    }
+
+                    int? moduleId = null;
+                    IDebugModule2 module = frameInfo.m_pModule;
+                    if (module != null)
+                    {
+                        lock (m_moduleMap)
+                        {
+                            if (m_moduleMap.TryGetValue(module, out int mapModuleId))
                             {
-                                if (m_moduleMap.TryGetValue(module, out int mapModuleId))
-                                {
-                                    moduleId = mapModuleId;
-                                }
+                                moduleId = mapModuleId;
                             }
                         }
-
-                        string instructionPointerReference = null;
-                        var contextInfo = new CONTEXT_INFO[1];
-                        if (memoryAddress?.GetInfo(enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS, contextInfo) == HRConstants.S_OK && contextInfo[0].dwFields.HasFlag(enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS))
-                        {
-                            instructionPointerReference = contextInfo[0].bstrAddress;
-                        }
-
-                        response.StackFrames.Add(new ProtocolMessages.StackFrame()
-                        {
-                            Id = frameReference,
-                            Name = frameInfo.m_bstrFuncName,
-                            Source = textPosition.Source,
-                            Line = textPosition.Line,
-                            Column = textPosition.Column,
-                            ModuleId = moduleId,
-                            InstructionPointerReference = instructionPointerReference
-                        });
-                    }
-
-                    response.TotalFrames = (int)frameEnumInfo.TotalFrames;
-                }
-            }
-
-            responder.SetResponse(response);
+                    }
+
+                    string instructionPointerReference = null;
+                    var contextInfo = new CONTEXT_INFO[1];
+                    if (memoryAddress?.GetInfo(enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS, contextInfo) == HRConstants.S_OK && contextInfo[0].dwFields.HasFlag(enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS))
+                    {
+                        instructionPointerReference = contextInfo[0].bstrAddress;
+                    }
+
+                    response.StackFrames.Add(new ProtocolMessages.StackFrame()
+                    {
+                        Id = frameReference,
+                        Name = frameInfo.m_bstrFuncName,
+                        Source = textPosition.Source,
+                        Line = textPosition.Line,
+                        Column = textPosition.Column,
+                        ModuleId = moduleId,
+                        InstructionPointerReference = instructionPointerReference
+                    });
+                }
+
+                if (!IsClientVS)
+                {
+                    var cancellationTokenSource = new CancellationTokenSource();
+                    try
+                    {
+                        CancellationToken cancellationToken = cancellationTokenSource.Token;
+                        var frameTasks = response.StackFrames.Select(frame => Task.Run(() =>
+                        {
+                            cancellationToken.ThrowIfCancellationRequested();
+                            if (frame.Source != null && !File.Exists(frame.Source.Path))
+                            {
+                                cancellationToken.ThrowIfCancellationRequested();
+                                // mark the stack frame to be skipped by default
+                                frame.Source.PresentationHint = Source.PresentationHintValue.Deemphasize;
+                            }
+                        }));
+
+                        Task allFramesComplete = Task.WhenAll(frameTasks);
+                        Task timeoutTask = Task.Delay(1000, cancellationToken);
+                        try
+                        {
+                            await Task.WhenAny(allFramesComplete, timeoutTask);
+                        }
+                        catch (Exception e)
+                        {
+                            Debug.Fail("Ignoring exception computing frame state: " + e.ToString());
+                        }
+                    }
+                    finally
+                    {
+                        cancellationTokenSource.Cancel();
+                        cancellationTokenSource.Dispose();
+                    }
+                }
+
+                response.TotalFrames = (int)frameEnumInfo.TotalFrames;
+
+                responder.SetResponse(response);
+            }
+            catch (Exception e)
+            {
+                responder.SetError(new ProtocolException(e.Message));
+            }
         }

         protected override void HandleScopesRequestAsync(IRequestResponder<ScopesArguments, ScopesResponse> responder)


Should remove instead of set to null.

Should remove instead of set to null.

--- src/Proto.Remote/EndpointWatcher.cs
+++ src/Proto.Remote/EndpointWatcher.cs
@@ -39,7 +39,7 @@
                         pidSet.Remove(msg.Watchee);
                         if (pidSet.Count == 0)
                         {
-                            _watched[msg.Watcher.Id] = null;
+                            _watched.Remove(msg.Watcher.Id);
                         }
                     }

@@ -88,7 +88,7 @@
                         pidSet.Remove(msg.Watchee);
                         if (pidSet.Count == 0)
                         {
-                            _watched[msg.Watcher.Id] = null;
+                            _watched.Remove(msg.Watcher.Id);
                         }
                     }


select closest tab when using DocumentStyle = DockingWindow

--- WinFormsUI/Docking/DockPaneStripBase.cs
+++ WinFormsUI/Docking/DockPaneStripBase.cs
@@ -264,9 +264,22 @@
                 // Close the specified content.
                 IDockContent content = Tabs[index].Content;
                 DockPane.CloseContent(content);
+                SelectClosestPane(index);
+
                 return true;
             }
             return false;
+        }
+
+        private void SelectClosestPane(int index)
+        {
+            if (index > 0 && DockPane.DockPanel.DocumentStyle == DocumentStyle.DockingWindow)
+            {
+                index = index - 1;
+
+                if (index >= 0 || index < Tabs.Count)
+                    DockPane.ActiveContent = Tabs[index].Content;
+            }
         }

         protected override void OnMouseUp(MouseEventArgs e)


Fixed version

Fixed version

--- SqlServerValidationToolkit.Configurator/Properties/AssemblyInfo.cs
+++ SqlServerValidationToolkit.Configurator/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.0.0")]
-[assembly: AssemblyFileVersion("0.1.0.0")]
+[assembly: AssemblyVersion("0.2.0.0")]
+[assembly: AssemblyFileVersion("0.2.0.0")]


Update Customer_MenuFunctions.cs

Update Customer_MenuFunctions.cs

--- Test/AdventureWorksFunctionalModel/Sales/Customer_MenuFunctions.cs
+++ Test/AdventureWorksFunctionalModel/Sales/Customer_MenuFunctions.cs
@@ -54,12 +54,7 @@
             return (c, context.WithNew(s).WithNew(c));
         }

-        [MemberOrder("Stores",6)]
-        public static IQueryable<Store> FindStoreOnlyByName(
-            [DescribedAs("partial match")]string name, IContext context) =>
-            context.Instances<Store>().Where(s => s.Name.ToUpper().Contains(name.ToUpper()));
-
-        [MemberOrder("Stores",7)]
+        [MemberOrder("Stores",3)]
         public static Customer RandomStore(IContext context) {
             var stores = context.Instances<Customer>().Where(t => t.StoreID != null).OrderBy(t => "");
             var random = context.RandomSeed().ValueInRange(stores.Count());
@@ -70,7 +65,7 @@

         #region Individuals Menu

-        [MemberOrder(30)]
+        [MemberOrder("Individuals",1)]
         [TableView(true)] //Table view == List View
         public static IQueryable<Customer> FindIndividualCustomerByName(
             [Optionally] string firstName, string lastName, IContext context)
@@ -82,7 +77,7 @@
                    select c;
         }

-        [MemberOrder(50)]
+        [MemberOrder("Individuals",2)]
         public static (Customer, IContext) CreateNewIndividualCustomer(
             string firstName,
             string lastName,
@@ -94,7 +89,7 @@
             //return (indv, indv);  //TODO: check that this will persist the associated Person as well as Customer
         }

-        [MemberOrder(70)]
+        [MemberOrder("Individuals",3)]
         public static Customer RandomIndividual(IContext context)
         {
             var indivs = context.Instances<Customer>().Where(t => t.PersonID != null).OrderBy(t => "");


Fix indenting to be consistent, and correct the setIncludeCellComments javadoc to match the long standing default (#54871)

--- ooxml/XSSF/Extractor/XSSFExcelExtractor.cs
+++ ooxml/XSSF/Extractor/XSSFExcelExtractor.cs
@@ -132,7 +132,7 @@
             this.formulasNotResults = formulasNotResults;
         }
         /**
-         * Should cell comments be included? Default is true
+         * Should cell comments be included? Default is false
          */
         public void SetIncludeCellComments(bool includeCellComments)
         {


Fixed CSU failure messages for SQL server

--- Source/Tools/ConfigurationSetupUtility/Screens/SqlServerDatabaseSetupScreen.xaml.cs
+++ Source/Tools/ConfigurationSetupUtility/Screens/SqlServerDatabaseSetupScreen.xaml.cs
@@ -168,9 +168,11 @@
                     }
                     catch (Exception ex)
                     {
-                        string failMessage = "Database connection issue. " + ex.Message +
-                            " Check your username and password." +
-                            " Additionally, you may need to modify your connection under advanced settings.";
+                		string failMessage = "Database connection failed."
+                    		+ " Please check your username and password."
+                    		+ " Additionally, you may need to modify your connection under advanced settings."
+                    		+ Environment.NewLine + Environment.NewLine
+                    		+ "Error: " + ex.Message;

                         MessageBox.Show(failMessage);
                         m_newUserNameTextBox.Focus();
@@ -488,11 +490,13 @@

                 MessageBox.Show("Database connection succeeded.");
             }
-            catch
+            catch (Exception ex)
             {
                 string failMessage = "Database connection failed."
                     + " Please check your username and password."
-                    + " Additionally, you may need to modify your connection under advanced settings.";
+                    + " Additionally, you may need to modify your connection under advanced settings."
+                    + Environment.NewLine + Environment.NewLine
+                    + "Error: " + ex.Message;

                 MessageBox.Show(failMessage);
             }


Simplify nameof fix

Simplify nameof fix

--- StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1121UseBuiltInTypeAlias.cs
+++ StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1121UseBuiltInTypeAlias.cs
@@ -213,7 +213,7 @@
                 locationNode = identifierNameSyntax.Parent;

             // Allow nameof
-            if(IsInNameOfExpression(identifierNameSyntax, semanticModel))
+            if(IsNameInNameOfExpression(identifierNameSyntax))
             {
                 return;
             }
@@ -222,52 +222,28 @@
             context.ReportDiagnostic(Diagnostic.Create(Descriptor, locationNode.GetLocation()));
         }

-        private bool IsInNameOfExpression(IdentifierNameSyntax identifierNameSyntax, SemanticModel semanticModel)
-        {
-            // we search the syntax tree bottom up and search for a InvokationExpression which is named "nameof"
-            // because nameof(object.ToString) is valid we are only allowing MemberAccessExpressionSyntax, ArgumentSyntax and ArgumentListSyntax nodes
-            // when we search. If we find a InvokationExpressionSyntax we try to get the constant value for it. because nameof expressions
-            // are the only InvokationExpressionSyntax which can be evaluated at compile time we found a nameof(<identifierNameSyntax>) expression.
-            SyntaxNode node = identifierNameSyntax;
-            while (true)
-            {
-                node = node.Parent;
-
-                if(node == null)
-                {
-                    return false;
-                }
-                if (node is InvocationExpressionSyntax)
-                {
-                    break;
-                }
-                if(node is MemberAccessExpressionSyntax)
-                {
-                    var memberAccessExpression = node as MemberAccessExpressionSyntax;
-                    if(memberAccessExpression.Name != identifierNameSyntax)
-                    {
-                        // nameof(object.ToString) is valid
-                        return false;
-                    }
-                }
-
-                if (!(node is MemberAccessExpressionSyntax
-                    || node is ArgumentSyntax
-                    || node is ArgumentListSyntax))
-                {
-                    return false;
-                }
-            }
-
-            InvocationExpressionSyntax invokation = node as InvocationExpressionSyntax;
-
-            if(invokation == null || invokation.Expression.ToString() != "nameof")
-            {
+        private bool IsNameInNameOfExpression(IdentifierNameSyntax identifierNameSyntax)
+        {
+            // The only time a type name can appear as an argument is for the invocation expression created for the
+            // nameof keyword. This assumption is the foundation of the following simple analysis algorithm.
+
+            if (identifierNameSyntax.Parent == null)
                 return false;
-            }
-
-            var constantValue = semanticModel.GetConstantValue(invokation);
-            return constantValue.HasValue;
+
+            // This covers the case nameof(Int32)
+            if (identifierNameSyntax.Parent is ArgumentSyntax)
+                return true;
+
+            // This covers the case nameof(System.Int32)
+            if (identifierNameSyntax.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression))
+            {
+                // This final check ensures that we don't consider nameof(System.Int32.ToString) the same as
+                // nameof(System.Int32)
+                if (identifierNameSyntax.Parent.Parent is ArgumentSyntax)
+                    return true;
+            }
+
+            return false;
         }
     }
 }


Changed folding strategy behavior to use weak references for TextDocuments.

--- Utilities.Controls/Behaviors/AvalonEdit/FoldingStrategyBehavior.cs
+++ Utilities.Controls/Behaviors/AvalonEdit/FoldingStrategyBehavior.cs
@@ -40,9 +40,13 @@
 					.AllFoldings
 					.Select(f => new NewFolding(f.StartOffset, f.EndOffset) { DefaultClosed = f.IsFolded, Name = f.Title });

-				_documents.Remove(_currentDocument);
-				_documents.Add(_currentDocument, foldings.ToList());
-				WeakEventManager<TextDocument, DocumentChangeEventArgs>.RemoveHandler(_currentDocument, "Changed", document_Changed);
+				TextDocument document;
+				if (_currentDocument.TryGetTarget(out document))
+				{
+					_documents.Remove(document);
+					_documents.Add(document, foldings.ToList());
+					WeakEventManager<TextDocument, DocumentChangeEventArgs>.RemoveHandler(document, "Changed", document_Changed);
+				}
 				FoldingManager.Uninstall(_currentFoldingManager);
 			}
 		}
@@ -54,19 +58,21 @@

 		private void EditorDocumentChanged()
 		{
-			_currentDocument = _editor.Document;
-			if (_currentDocument != null)
+			_currentDocument = new WeakReference<TextDocument>(_editor.Document);
+
+			TextDocument document;
+			if (_currentDocument.TryGetTarget(out document))
 			{
 				_currentFoldingManager = FoldingManager.Install(_editor.TextArea);
-				_foldingStrategy.UpdateFoldings(_currentFoldingManager, _currentDocument);
+				_foldingStrategy.UpdateFoldings(_currentFoldingManager, document);

 				IEnumerable<NewFolding> foldings;
-				if (_documents.TryGetValue(_currentDocument, out foldings))
+				if (_documents.TryGetValue(document, out foldings))
 					_currentFoldingManager.UpdateFoldings(foldings, -1);
 				else
-					_documents.Add(_currentDocument, Enumerable.Empty<NewFolding>());
-
-				WeakEventManager<TextDocument, DocumentChangeEventArgs>.AddHandler(_editor.Document, "Changed", document_Changed);
+					_documents.Add(document, Enumerable.Empty<NewFolding>());
+
+				WeakEventManager<TextDocument, DocumentChangeEventArgs>.AddHandler(document, "Changed", document_Changed);
 			}
 		}

@@ -83,7 +89,7 @@
 		}

 		private FoldingManager _currentFoldingManager;
-		private TextDocument _currentDocument;
+		private WeakReference<TextDocument> _currentDocument;
 		private readonly TextEditor _editor;
 		private readonly AbstractFoldingStrategy _foldingStrategy;


Use defaults

Use defaults

--- WalletWasabi.Fluent/ViewModels/AddWallet/AddWalletPageViewModel.cs
+++ WalletWasabi.Fluent/ViewModels/AddWallet/AddWalletPageViewModel.cs
@@ -83,7 +83,7 @@
 								return walletGenerator.GenerateWallet(WalletName, password);
 							});

-						Navigate().To(new RecoveryWordsViewModel(km, mnemonic, walletManager), NavigationMode.Normal);
+						Navigate().To(new RecoveryWordsViewModel(km, mnemonic, walletManager));

 						IsBusy = false;
 					}


Set UserVisibleHint for new fragment to true (#411)

--- Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
+++ Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
@@ -645,7 +645,7 @@
 				Device.StartTimer(TimeSpan.FromMilliseconds(TransitionDuration), () =>
 				{
 					tcs.TrySetResult(true);
-					fragment.UserVisibleHint = !removed;
+					fragment.UserVisibleHint = true;
 					if (removed)
 					{
 						UpdateToolbar();
@@ -659,7 +659,7 @@
 				Device.StartTimer(TimeSpan.FromMilliseconds(1), () =>
 				{
 					tcs.TrySetResult(true);
-					fragment.UserVisibleHint = !removed;
+					fragment.UserVisibleHint = true;
 					UpdateToolbar();

 					return false;


Added more useful extension methods

Added more useful extension methods

--- AngleSharp/Foundation/Extensions/NodeExtensions.cs
+++ AngleSharp/Foundation/Extensions/NodeExtensions.cs
@@ -252,6 +252,11 @@
         /// <returns>The inserted node, which is node.</returns>
         public static INode PreInsert(this INode parent, INode node, INode child)
         {
+            var parentNode = parent as Node;
+
+            if (parentNode == null)
+                throw new DomException(ErrorCode.NotSupported);
+
             parent.EnsurePreInsertionValidity(node, child);
             var referenceChild = child;

@@ -259,8 +264,27 @@
                 referenceChild = node.NextSibling;

             parent.Owner.AdoptNode(node);
-            parent.InsertBefore(node, child);
+            parentNode.InsertBefore(node, child, false);
             return node;
+        }
+
+        /// <summary>
+        /// Pre-removes the given child of the parent.
+        /// </summary>
+        /// <param name="parent">The origin that will be mutated.</param>
+        /// <param name="child">The node that will be removed.</param>
+        /// <returns>The removed node, which is child.</returns>
+        public static INode PreRemove(this INode parent, INode child)
+        {
+            var parentNode = parent as Node;
+
+            if (parentNode == null)
+                throw new DomException(ErrorCode.NotSupported);
+            else if (child.Parent != parent)
+                throw new DomException(ErrorCode.NotFound);
+
+            parentNode.RemoveChild(child, false);
+            return child;
         }

         /// <summary>
@@ -270,18 +294,17 @@
         /// <param name="node">The node to change its owner.</param>
         public static void AdoptNode(this IDocument document, INode node)
         {
-            var adopted = node as Node;
-
-            if (adopted == null)
-                return;
-
-            var oldDocument = adopted.Owner;
-
-            if (node.Parent != null)
-                node.Parent.RemoveChild(node);
-
-            adopted.Owner = document as Document;
-            //Run any adopting steps defined for node in other applicable specifications and pass node and oldDocument as parameters.
+            var adoptedNode = node as Node;
+
+            if (adoptedNode == null)
+                throw new DomException(ErrorCode.NotSupported);
+
+            var oldDocument = node.Owner;
+
+            if (adoptedNode.Parent != null)
+                adoptedNode.Parent.RemoveChild(node, false);
+
+            adoptedNode.Owner = document as Document;
         }

         /// <summary>
@@ -315,6 +338,8 @@

             return css.ToCss();
         }
+
+        #region Helpers

         static Boolean IsFollowedByDoctype(this INode child)
         {
@@ -342,5 +367,7 @@

             return false;
         }
+
+        #endregion
     }
 }


use source file

use source file

--- src/SimpleAuth/Providers/DropBox.cs
+++ src/SimpleAuth/Providers/DropBox.cs
@@ -13,7 +13,7 @@
         public DropBoxAuth(string client_id, string client_secret, HttpMessageHandler handler = null)
             : base("DropBox", client_id, client_secret, handler)
         {
-			this.ScopesRequired = false;
+            this.Scopes = new[] { "???" };
             this.TokenUrl = "https://api.dropbox.com/1/oauth2/token";
         }

@@ -50,6 +50,7 @@
         {
             BaseUrl = "https://www.dropbox.com/1/oauth2/authorize";
             RedirectUrl = new Uri("http://localhost");
+            Scope = new List<string> { "???" };
         }

         ///Up to 500 bytes of arbitrary data that will be passed back to <paramref name="redirectUri"/>


Adding explicit validation test

Adding explicit validation test

--- src/UnitTests/AttributeBasedMaps.cs
+++ src/UnitTests/AttributeBasedMaps.cs
@@ -5,7 +5,7 @@
 {
     namespace AttributeBasedMaps
     {
-        public class When_specifying_map_with_attribute : AutoMapperSpecBase
+        public class When_specifying_map_with_attribute : NonValidatingSpecBase
         {
             public class Source
             {
@@ -32,6 +32,12 @@

                 dest.Value.ShouldBe(5);
             }
+
+            [Fact]
+            public void Should_validate_successfully()
+            {
+                typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid("AutoMapAttributeProfile"));
+            }
         }
     }
 }


Disabling test parallelism

Disabling test parallelism

--- src/UnitTests/AutoMapperSpecBase.cs
+++ src/UnitTests/AutoMapperSpecBase.cs
@@ -4,6 +4,8 @@
 #if !SILVERLIGHT && !NETFX_CORE
 using Rhino.Mocks;
 #endif
+
+[assembly: CollectionBehavior(DisableTestParallelization = true)]

 namespace AutoMapper.UnitTests
 {


Make QueryExtensions class internal.

Make QueryExtensions class internal.

--- src/VisualStudio/QueryExtensions.cs
+++ src/VisualStudio/QueryExtensions.cs
@@ -10,7 +10,7 @@
     ///
     /// It works around the limitation by repeatedly querying the source until the latter runs out of items.
     /// </summary>
-    public static class QueryExtensions {
+    internal static class QueryExtensions {

         public static IEnumerable<T> GetAll<T>(this IQueryable<T> source, int skip, int? first) {
             bool useFirst = first.HasValue;


Adds testing for filtering jobs by parent.

--- apis/Google.Cloud.BigQuery.V2/Google.Cloud.BigQuery.V2.IntegrationTests/JobsTest.cs
+++ apis/Google.Cloud.BigQuery.V2/Google.Cloud.BigQuery.V2.IntegrationTests/JobsTest.cs
@@ -97,6 +97,23 @@
             VerifyJobLabels(jobFound.Resource.Configuration.Labels);
         }

+        [Fact]
+        public void ListJobs_ChildJobs()
+        {
+            var client = BigQueryClient.Create(_fixture.ProjectId);
+
+            var table1 = client.GetTable(_fixture.ProjectId, _fixture.DatasetId, _fixture.HighScoreTableId);
+            var table2 = client.GetTable(_fixture.ProjectId, _fixture.DatasetId, _fixture.PeopleTableId);
+            string script = $"SELECT * FROM {table1};SELECT * FROM {table2}";
+            var parentJob = client.CreateQueryJob(script, null).PollUntilCompleted().ThrowOnAnyError();
+
+            // Find the child jobs of our job.
+            var options = new ListJobsOptions { ParentJobId = parentJob.Reference.JobId };
+            var childrenJobs = client.ListJobs(options).ToList();
+
+            Assert.Equal(2, childrenJobs.Count);
+        }
+
         /// <summary>
         /// There's an equivalent snippet for this integration test but, where the snippet
         /// tests for GetJob getting a job, this test tests for GetJob getting an


nullにならないはずなので黙らせる

nullにならないはずなので黙らせる

--- Whitebell.Library/_Suppression.cs
+++ Whitebell.Library/_Suppression.cs
@@ -10,4 +10,7 @@
 [assembly: SuppressMessage("Usage", "RCS1165:Unconstrained type parameter checked for null.", Scope = "Type", Target = "Whitebell.Library.Collections.Generic.OrderedDictionary`2")]
 [assembly: SuppressMessage("Usage", "RCS1165:Unconstrained type parameter checked for null.", Scope = "Type", Target = "Whitebell.Library.Extension.Extension")]

+[assembly: SuppressMessage("Usage", "RCS1202:Avoid NullReferenceException.", Scope = "member", Target = "~P:Whitebell.Library.Collections.Generic.OrderedDictionary`2.KeyCollection.System#Collections#ICollection#SyncRoot")]
+[assembly: SuppressMessage("Usage", "RCS1202:Avoid NullReferenceException.", Scope = "member", Target = "~P:Whitebell.Library.Collections.Generic.OrderedDictionary`2.ValueCollection.System#Collections#ICollection#SyncRoot")]
+
 #endif


CA-187132: XenCenter loses XenServer address when retrying connection

Signed-off-by: Mihaela Stoica <b5f5de664d381eb07788c1bae5e014d8b2d3aa69@citrix.com>

--- XenModel/Network/XenConnection.cs
+++ XenModel/Network/XenConnection.cs
@@ -1532,13 +1532,17 @@
                                 }
                                 MaybeStartNextSlaveTimer(reason, error);
                             }
-                            else
+                            else if (LastMasterHostname != "")
                             {
                                 log.DebugFormat("Stopping search for new master for {0}: timeout reached without success. Trying the old master one last time",
                                                 LastConnectionFullName);
                                 FindingNewMaster = false;
                                 Hostname = LastMasterHostname;
                                 ReconnectMaster();
+                            }
+                            else
+                            {
+                                OnConnectionResult(false, reason, error);
                             }
                         }
                     }


Added confirmation dialogues to EnforceEditorSettings

The existing version does not feature a prompt, and modifies the
project configuration without warning. Users with complex or unique
project setups may encounter issues.

Users will now be prompted to change their project settings when
importing the HoloToolkit, or opening a project with the toolkit
already included, to better support external VCS and project
maintainability.

--- Assets/HoloToolkit/Utilities/Scripts/Editor/EnforceEditorSettings.cs
+++ Assets/HoloToolkit/Utilities/Scripts/Editor/EnforceEditorSettings.cs
@@ -1,6 +1,5 @@
 // Copyright (c) Microsoft Corporation. All rights reserved.
 // Licensed under the MIT License. See LICENSE in the project root for license information.
-
 using UnityEditor;

 namespace HoloToolKit.Unity
@@ -11,23 +10,68 @@
     [InitializeOnLoad]
     public class EnforceEditorSettings
     {
+        private const string _assemblyReloadTimestampKey = "HoloToolkit_Editor_LastAssemblyReload";
+
         static EnforceEditorSettings()
         {
             #region Editor Settings

-            if (EditorSettings.serializationMode != SerializationMode.ForceText)
-            {
-                EditorSettings.serializationMode = SerializationMode.ForceText;
-                UnityEngine.Debug.Log("Setting Force Text Serialization");
-            }
+            if (TrueOnce()) {
+                if (EditorSettings.serializationMode != SerializationMode.ForceText)
+                {
+                    if (EditorUtility.DisplayDialog(
+                            "Force Text Asset Serialization?",
+                            "HoloToolkit is easier to maintain if the asset serialization mode for this project is set to \"Force Text\". Would you like to make this change?",
+                            "Force Text Serialization",
+                            "Later")) {
+                        EditorSettings.serializationMode = SerializationMode.ForceText;
+                        UnityEngine.Debug.Log("Setting Force Text Serialization");
+                    }
+                }

-            if (!EditorSettings.externalVersionControl.Equals("Visible Meta Files"))
-            {
-                EditorSettings.externalVersionControl = "Visible Meta Files";
-                UnityEngine.Debug.Log("Updated external version control mode: " + EditorSettings.externalVersionControl);
+                if (!EditorSettings.externalVersionControl.Equals("Visible Meta Files"))
+                {
+                    if (EditorUtility.DisplayDialog(
+                        "Make Meta Files Visible?",
+                        "HoloToolkit would like to make meta files visible so they can be more easily handled with common version control systems. Would you like to make this change?",
+                        "Enable Visible Meta Files",
+                        "Later")) {
+                        EditorSettings.externalVersionControl = "Visible Meta Files";
+                        UnityEngine.Debug.Log("Updated external version control mode: " + EditorSettings.externalVersionControl);
+                    }
+                }
             }

             #endregion
         }
+
+        /// <summary>
+        /// Returns true the first time it is called within this editor session, and
+        /// false for all subsequent calls.
+        /// </summary>
+        /// <remarks>
+        /// The Unity Editor does not provide a callback for when a project is opened.
+        /// InitializeOnLoad is triggered for all assembly reloads, including entering
+        /// and exiting PlayMode, and whenever a script is modified and recompiled.
+        ///
+        /// To ensure execution only when opening a project in a new instance of the editor,
+        /// store a timestamp in the editor key-value store whenever this function is called.
+        /// The stored timestamp is then compared with the true start time of this editor
+        /// instance.
+        /// </remarks>
+        private static bool TrueOnce ()
+        {
+            // Determine the last known launch date of the editor by loading it from the PlayerPrefs cache.
+            System.DateTime lastLaunchDate = System.DateTime.UtcNow;
+            System.DateTime.TryParse( EditorPrefs.GetString(_assemblyReloadTimestampKey), out lastLaunchDate );
+
+            // Determine the launch date for this editor session using the current time, and the time since startup.
+            System.DateTime thisLaunchDate = System.DateTime.UtcNow.AddSeconds(-EditorApplication.timeSinceStartup);
+            EditorPrefs.SetString(_assemblyReloadTimestampKey, thisLaunchDate.ToString());
+
+            // If the current session was launched later than the last known session start date, then this must be
+            // a new session, and we can display the first-time prompt.
+            return (thisLaunchDate - lastLaunchDate).Seconds > 0;
+        }
     }
 }


Update app info

Update app info

--- ZeroMunge/Forms/About.Designer.cs
+++ ZeroMunge/Forms/About.Designer.cs
@@ -101,9 +101,9 @@
 			this.label3.Location = new System.Drawing.Point(3, 38);
 			this.label3.Name = "label3";
 			this.label3.Padding = new System.Windows.Forms.Padding(0, 3, 0, 3);
-			this.label3.Size = new System.Drawing.Size(137, 19);
+			this.label3.Size = new System.Drawing.Size(187, 19);
 			this.label3.TabIndex = 2;
-			this.label3.Text = "Developed by Aaron Gilbert";
+			this.label3.Text = "Developed by Aaron Gilbert && BAD-AL";
 			//
 			// pnl_License
 			//


Fix profile header not correctly being masked

Closes #1592.

--- osu.Game/Overlays/Profile/ProfileHeader.cs
+++ osu.Game/Overlays/Profile/ProfileHeader.cs
@@ -53,6 +53,7 @@
                 {
                     RelativeSizeAxes = Axes.X,
                     Height = cover_height,
+                    Masking = true,
                     Children = new Drawable[]
                     {
                         new Box
@@ -324,8 +325,7 @@
                 FillMode = FillMode.Fill,
                 OnLoadComplete = d => d.FadeInFromZero(200),
                 Depth = float.MaxValue,
-            },
-            coverContainer.Add);
+            }, coverContainer.Add);

             if (user.IsSupporter) supporterTag.Show();

@@ -514,7 +514,7 @@
                 {
                     set
                     {
-                        if(value != null)
+                        if (value != null)
                             content.Action = () => Process.Start(value);
                     }
                 }


Change tags separators from ", " to " "

Change tags separators from ", " to " "

--- AstroPhotoGallery/AstroPhotoGallery/Controllers/PictureController.cs
+++ AstroPhotoGallery/AstroPhotoGallery/Controllers/PictureController.cs
@@ -16,7 +16,7 @@
         {
             return RedirectToAction("ListCategories", "Home");
         }
-
+
         //
         //GET: Picture/Details/id
         public ActionResult Details(int? id)
@@ -498,7 +498,7 @@
                     return RedirectToAction("ListCategories", "Home");
                 }

-                ViewBag.TagsString = string.Join(", ", picture.Tags.Select(t => t.Name));
+                ViewBag.TagsString = string.Join(" ", picture.Tags.Select(t => t.Name));

                 if (!IsUserAuthorizedToEditAndDelete(picture))
                 {
@@ -603,7 +603,7 @@
                     .OrderBy(c => c.Name)
                     .ToList();

-                model.Tags = string.Join(", ", picture.Tags.Select(t => t.Name));
+                model.Tags = string.Join(" ", picture.Tags.Select(t => t.Name));

                 return View(model);
             }
@@ -670,7 +670,7 @@
                             var first = previousCategoryPicsIdToBeChanged.Min();

                             // The last pic in the category
-                            var last = previousCategoryPicsIdToBeChanged.Max();
+                            var last = previousCategoryPicsIdToBeChanged.Max();

                             // If there is only 1 pic in the category it becomes now first and last one there
                             if (first == last)
@@ -748,7 +748,7 @@
         {
             //Split tags
             var tagsStrings = model.Tags
-                .Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
+                .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                 .Select(t => t.ToLower())
                 .Distinct();


Fix logo visualisation trying to catch up after being off-screen

--- osu.Game/Screens/Menu/LogoVisualisation.cs
+++ osu.Game/Screens/Menu/LogoVisualisation.cs
@@ -131,7 +131,8 @@
         {
             base.LoadComplete();

-            Scheduler.AddDelayed(updateAmplitudes, time_between_updates, true);
+            var delayed = Scheduler.AddDelayed(updateAmplitudes, time_between_updates, true);
+            delayed.PerformRepeatCatchUpExecutions = false;
         }

         protected override void Update()


v1.1.4.5 * Reverted to non-usable UI for main branch

--- HamstarHelpersMod.cs
+++ HamstarHelpersMod.cs
@@ -184,7 +184,7 @@

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

-		public override void ModifyInterfaceLayers( List<GameInterfaceLayer> layers ) {
+		/*public override void ModifyInterfaceLayers( List<GameInterfaceLayer> layers ) {
 			var modworld = this.GetModWorld<MyModWorld>();

 			if( modworld.Logic.IsReady() ) {
@@ -211,6 +211,6 @@
 					layers.Insert( idx, interface_layer );
 				}
 			}
-		}
+		}*/
 	}
 }


add header support for HttpHelper.

add header support for HttpHelper.

--- Helper/HttpHelper.cs
+++ Helper/HttpHelper.cs
@@ -35,7 +35,7 @@
         /// <param name="contentType"></param>
         /// <param name="timeout"></param>
         /// <returns></returns>
-        public static HttpResult HttpRequest(string url, string postData = null, CookieContainer cookies = null, string userAgent = null, string referer = null, string cookiesDomain = null, Encoding encode = null, string method = null, IWebProxy proxy = null, string encoding = null, string contentType = null, int timeout = 8000)
+        public static HttpResult HttpRequest(string url, string postData = null, CookieContainer cookies = null, string userAgent = null, string referer = null, string cookiesDomain = null, Encoding encode = null, string method = null, IWebProxy proxy = null, string encoding = null, string contentType = null, int timeout = 8000, Dictionary<string, string> headers = null)
         {
             HttpResult httpResponse = new HttpResult();

@@ -43,9 +43,9 @@
             {
                 HttpWebResponse httpWebResponse = null;
                 if (!string.IsNullOrEmpty(postData) || (!string.IsNullOrEmpty(method) && method.ToUpper() == "POST"))
-                    httpWebResponse = CreatePostHttpResponse(url, postData, timeout, userAgent, cookies, referer, proxy, contentType);
+                    httpWebResponse = CreatePostHttpResponse(url, postData, timeout, userAgent, cookies, referer, proxy, contentType, headers);
                 else
-                    httpWebResponse = CreateGetHttpResponse(url, timeout, userAgent, cookies, referer, proxy, contentType);
+                    httpWebResponse = CreateGetHttpResponse(url, timeout, userAgent, cookies, referer, proxy, contentType, headers);

                 httpResponse.Url = httpWebResponse.ResponseUri.ToString();
                 httpResponse.HttpCode = (int)httpWebResponse.StatusCode;
@@ -86,7 +86,6 @@
                         if (!cache.EndsWith("</head>", StringComparison.OrdinalIgnoreCase))
                             cache += (char)b;
                     }
-

                     string Ncharset = "";
                     string Hcharset = "";
@@ -181,9 +180,10 @@

                 httpResponse.Content = Content;
             }
-            catch
-            {
-                httpResponse.Content = string.Empty;
+            catch(Exception ex)
+            {
+                httpResponse.Content = ex.ToString();
+                httpResponse.HttpCode = DetermineResultStatus(ex);
             }
             return httpResponse;
         }
@@ -203,9 +203,9 @@
         /// <param name="encoding"></param>
         /// <param name="contentType"></param>
         /// <returns></returns>
-        public static string GetHttpContent(string url, string postData = null, CookieContainer cookies = null, string userAgent = null, string referer = null, string cookiesDomain = null, Encoding encode = null, string method = null, IWebProxy proxy = null, string encoding = null, string contentType = null, int timeout = 8000)
-        {
-            return HttpHelper.HttpRequest(url, postData, cookies, userAgent, referer, cookiesDomain, encode, method, proxy, encoding, contentType, timeout).Content;
+        public static string GetHttpContent(string url, string postData = null, CookieContainer cookies = null, string userAgent = null, string referer = null, string cookiesDomain = null, Encoding encode = null, string method = null, IWebProxy proxy = null, string encoding = null, string contentType = null, int timeout = 8000, Dictionary<string, string> headers = null)
+        {
+            return HttpHelper.HttpRequest(url, postData, cookies, userAgent, referer, cookiesDomain, encode, method, proxy, encoding, contentType, timeout, headers).Content;
         }

         /// <summary>
@@ -217,7 +217,7 @@
         /// <param name="cookies"></param>
         /// <param name="referer"></param>
         /// <returns></returns>
-        public static HttpWebResponse CreateGetHttpResponse(string url, int timeout = 8000, string userAgent = null, CookieContainer cookies = null, string referer = null, IWebProxy proxy = null, string contentType = null)
+        public static HttpWebResponse CreateGetHttpResponse(string url, int timeout = 8000, string userAgent = null, CookieContainer cookies = null, string referer = null, IWebProxy proxy = null, string contentType = null, Dictionary<string, string> headers = null)
         {
             HttpWebRequest request = null;
             if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
@@ -237,6 +237,15 @@

             request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
             request.Headers.Add(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4");
+
+            if (headers != null && headers.Count > 0)
+            {
+                foreach (var header in headers)
+                {
+                    request.Headers.Add(header.Key, header.Value);
+                }
+            }
+
             request.ContentType = string.IsNullOrEmpty(contentType) ? "application/x-www-form-urlencoded" : contentType;
             request.UserAgent = string.IsNullOrEmpty(userAgent) ? "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36" : userAgent;

@@ -263,7 +272,7 @@
         /// <param name="cookies"></param>
         /// <param name="referer"></param>
         /// <returns></returns>
-        public static HttpWebResponse CreatePostHttpResponse(string url, string postData, int timeout = 8000, string userAgent = null, CookieContainer cookies = null, string referer = null, IWebProxy proxy = null, string contentType = null)
+        public static HttpWebResponse CreatePostHttpResponse(string url, string postData, int timeout = 8000, string userAgent = null, CookieContainer cookies = null, string referer = null, IWebProxy proxy = null, string contentType = null, Dictionary<string,string> headers = null)
         {
             HttpWebRequest request = null;
             //如果是发送HTTPS请求
@@ -282,6 +291,15 @@

             request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
             request.Headers.Add(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4");
+
+            if (headers != null && headers.Count > 0)
+            {
+                foreach (var header in headers)
+                {
+                    request.Headers.Add(header.Key, header.Value);
+                }
+            }
+
             request.ContentType = string.IsNullOrEmpty(contentType) ? "application/x-www-form-urlencoded" : contentType;
             request.UserAgent = string.IsNullOrEmpty(userAgent) ? "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36" : userAgent;

@@ -468,5 +486,34 @@
             }
             return cookieContainer;
         }
+
+        /// <summary>
+        ///     根据异常内容判断状态类型
+        /// </summary>
+        /// <param name="ex"></param>
+        /// <returns></returns>
+        private static int DetermineResultStatus(Exception ex)
+        {
+            string Msg = ex.Message.ToLower();
+            if (Msg.Contains("超时") || Msg.Contains("timeout") || Msg.Contains("timed out")
+                                   || Msg.Contains("502"))
+            {
+                return 502;
+            }
+            if (Msg.Contains("dns") || Msg.Contains("resolved"))
+            {
+                return 404;
+            }
+            if (Msg.Contains("404"))
+            {
+                return 404;
+            }
+            if (Msg.Contains("500"))
+            {
+                return 500;
+            }
+
+            return 500;
+        }
     }
 }


Fix #33 - support readonly keyfile

Fix #33 - support readonly keyfile

--- ILRepack/ILRepack.cs
+++ ILRepack/ILRepack.cs
@@ -684,7 +684,7 @@
             StrongNameKeyPair snkp = null;
             if (KeyFile != null && File.Exists(KeyFile))
             {
-                using (var stream = new FileStream(KeyFile, FileMode.Open))
+                using (var stream = new FileStream(KeyFile, FileMode.Open, FileAccess.Read, FileShare.Read))
                 {
                     snkp = new StrongNameKeyPair(stream);
                 }


init sample

init sample

--- IcySample/Program.cs
+++ IcySample/Program.cs
@@ -13,16 +13,29 @@

     class Program
     {
+        static IcyApp app;
+        static DatabaseManager dm;
+
         static void Main(string[] args)
         {
-            var app = new IcyApp();
+            // initialize the app
+            app = new IcyApp();

+            // put some config
             app.config<ApplicationDatabaseConfig>().defaults = "test";
             app.config<ApplicationDatabaseConfig>().connections["test"] = new ApplicationDatabaseConnectionConfig()
             {
                 host = "localhost",
-                database =
+                database = "TEST",
+                username = "sa",
+                password = ""
             };
+
+            // initialize the database manager
+            dm = new DatabaseManager(app, new Icy.Database.Connectors.ConnectionFactory());
+
+            // perform queries! :D
+            dm.connection().query().select().from("table").where("column", "=", 1).first();
         }
     }
 }


Update label before clearing item list

Update label before clearing item list

--- ItemCollage/Form1.cs
+++ ItemCollage/Form1.cs
@@ -243,8 +243,8 @@
                 var fileName = string.Format("items-{0:yyyy-MM-dd-HH-mm-ss}.png", DateTime.UtcNow);
                 var file = Path.Combine(picFolder, fileName);
                 b.Save(file);
+                UpdateLabel();
                 items.Clear();
-                UpdateLabel();
             }
             catch { }
         }


Serve a cached version of the Scope

Serve a cached version of the Scope

The Merge now only takes place once on first retrieve, or when the User
config is updated

--- JsonConfig/Config.cs
+++ JsonConfig/Config.cs
@@ -15,11 +15,22 @@
 		public static dynamic Default = new ConfigObject ();
 		public static dynamic User = new ConfigObject ();

+		/// <summary>
+		/// Gets the scope. The Scope is calculated as a Merge of the User and Default settings.
+		/// Once the Scope is retrieved for the first time, the merge takes place, as well as when the User
+		/// setting gets updated.
+		/// </summary>
+		/// <value>
+		/// The scope.
+		/// </value>
 		public static dynamic Scope {
 			get {
-				return Merger.Merge (User, Default);
+				if (scope == null)
+					scope = Merger.Merge (User, Default);
+				return scope;
 			}
 		}
+		protected static dynamic scope = null;

 		static Config ()
 		{
@@ -57,6 +68,8 @@
 			userConfigWatcher.NotifyFilter = NotifyFilters.LastWrite;
 			userConfigWatcher.Changed += delegate {
 				User = (ConfigObject) ParseJson (File.ReadAllText (info.FullName));
+				// update the scope config after merge
+				scope = Merger.Merge (User, Default);
 			};
 			userConfigWatcher.EnableRaisingEvents = true;
 		}


Move "app installed" message into OnAppInitialInstall from OnFirstRun

--- KAGTools/App.xaml.cs
+++ KAGTools/App.xaml.cs
@@ -47,7 +47,6 @@
             using (UpdateManager mgr = new UpdateManager(""))
             {
                 SquirrelAwareApp.HandleEvents(
-                    onFirstRun: OnFirstRun,
                     onInitialInstall: (v) => OnAppInitialInstall(v, mgr),
                     onAppUpdate: (v) => OnAppUpdate(v, mgr),
                     onAppUninstall: (v) => OnAppUninstall(v, mgr));
@@ -106,20 +105,14 @@
         }

         #region Squirrel Events
-        // Runs after install
-        private static void OnFirstRun()
-        {
-            AlertInformation("App successfully installed.");
-        }
-
-        // Runs before app launch
         private static void OnAppInitialInstall(Version version, UpdateManager mgr)
         {
             mgr.CreateShortcutsForExecutable(AppInfo.ExeName, ShortcutLocations, false);
             mgr.CreateUninstallerRegistryEntry();
-        }
-
-        // Runs before app launch
+
+            AlertInformation("App successfully installed.");
+        }
+
         private static void OnAppUpdate(Version version, UpdateManager mgr)
         {
             mgr.CreateShortcutsForExecutable(AppInfo.ExeName, ShortcutLocations, true);


Removed the logic in MimeMessage.WriteTo() that enforced a Date header.

Fixes issue #41

--- MimeKit/MimeMessage.cs
+++ MimeKit/MimeMessage.cs
@@ -759,9 +759,6 @@

 			if (stream == null)
 				throw new ArgumentNullException ("stream");
-
-			if (!Headers.Contains ("Date"))
-				Date = DateTimeOffset.Now;

 			if (messageId == null)
 				MessageId = MimeUtils.GenerateMessageId ();


Do not reserve on player join

Do not reserve on player join

--- LmpClient/Systems/PlayerConnection/PlayerConnectionMessageHandler.cs
+++ LmpClient/Systems/PlayerConnection/PlayerConnectionMessageHandler.cs
@@ -2,7 +2,6 @@
 using LmpClient.Base.Interface;
 using LmpClient.Systems.Status;
 using LmpClient.Systems.Warp;
-using LmpClient.Utilities;
 using LmpCommon.Message.Data.PlayerConnection;
 using LmpCommon.Message.Interface;
 using LmpCommon.Message.Types;
@@ -23,7 +22,6 @@
             {
                 case PlayerConnectionMessageType.Join:
                     LunaScreenMsg.PostScreenMessage($"{playerName} has joined the server", 3f, ScreenMessageStyle.UPPER_CENTER);
-                    CommonUtil.Reserve20Mb();
                     break;
                 case PlayerConnectionMessageType.Leave:
                     WarpSystem.Singleton.RemovePlayer(playerName);


Connection Pool Issue solved

Connection Pool Issue solved

--- Master/Appleseed/Projects/Appleseed.Framework.Core/DAL/RecyclerDB.cs
+++ Master/Appleseed/Projects/Appleseed.Framework.Core/DAL/RecyclerDB.cs
@@ -148,6 +148,7 @@
                     m.MobileSrc = result["MobileSrc"].ToString();
                     m.Admin = bool.Parse(result["Admin"].ToString());
                 }
+                connection.Close(); //Added by Ashish Patel - Connection pool issue

                 return m;
             }
@@ -260,6 +261,11 @@
                     ErrorHandler.Publish(
                         LogLevel.Warn, "An Error Occurred in MoveModuleToNewTab. Parameter : " + moduleId, ex);
                 }
+                //Added by Ashish - Connection Pool Issue
+                finally
+                {
+                    connection.Close();
+                }
             }
         }


keep buttons in sorted order as they are added

--- Launcher/MainForm.cs
+++ Launcher/MainForm.cs
@@ -54,6 +54,7 @@
                 };

                 panel.Controls.Add(button);
+                panel.Controls.SetChildIndex(button, panel.Controls.Count - 1);
             }
         }


Fix EventEmitter so that it can be returned as an invoke result.

- Added missing On method which is an alias for AddListener.

--- electron-dotnet/src/websharpjs/WebSharp.js/dotnet/WebSharpJs.NodeJS/EventEmitter.cs
+++ electron-dotnet/src/websharpjs/WebSharp.js/dotnet/WebSharpJs.NodeJS/EventEmitter.cs
@@ -14,9 +14,12 @@
             return proxy;
         }

-        private EventEmitter() : base() { }
+        protected EventEmitter() : base() { }

-        private EventEmitter(ScriptObjectProxy scriptObject) : base(scriptObject)
+        protected EventEmitter(object scriptObject) : base(scriptObject)
+        { }
+
+        public EventEmitter(ScriptObjectProxy scriptObject) : base(scriptObject)
         { }

         public static explicit operator EventEmitter(ScriptObjectProxy sop)
@@ -25,7 +28,7 @@
         }

         static NodeObjectProxy scriptProxy;
-        private async Task Initialize()
+        protected async Task Initialize()
         {

             if (scriptProxy == null)
@@ -68,6 +71,11 @@
             return await InvokeAsync<object[]>("listeners", eventName);
         }

+        public async Task<EventEmitter> On(string eventName, Func<object, Task<object>> listener)
+        {
+            return await InvokeAsync<EventEmitter>("on", eventName, listener);
+        }
+
         public async Task<object> Once(string eventName, Func<object, Task<object>> listener)
         {
             return await InvokeAsync<object>("once", eventName, listener);
@@ -93,9 +101,9 @@
             return await InvokeAsync<object>("removeListener", eventName, listener);
         }

-        public async Task<object> SetMaxListeners(int n)
+        public async Task<EventEmitter> SetMaxListeners(int n)
         {
-            return await InvokeAsync<object>("setMaxListeners", n);
+            return await InvokeAsync<EventEmitter>("setMaxListeners", n);
         }

     }


For IDisposiblie

For IDisposiblie

--- MonoDevelop.VersionControl.Mercurial/Hg.Net/HgCommandServerClient.cs
+++ MonoDevelop.VersionControl.Mercurial/Hg.Net/HgCommandServerClient.cs
@@ -55,6 +55,11 @@
 			}

 			return true;
+		}
+
+		public void Disconnect()
+		{
+			_cmdServer.Close();
 		}

 		public static void Init(string path, string hgPath)


fixing test (I think)

fixing test (I think)

git-svn-id: 6eea8ec865c4fa60105bc56808c028bdcf72a817@2135 079b0acf-d9fa-0310-9935-e5ade295c882

--- esb/Rhino.ServiceBus.Tests/RhinoQueues/RhinoQueue_Messages_that_have_no_handlers.cs
+++ esb/Rhino.ServiceBus.Tests/RhinoQueues/RhinoQueue_Messages_that_have_no_handlers.cs
@@ -11,9 +11,8 @@

 namespace Rhino.ServiceBus.Tests
 {
-	public class RhinoQueues_Messages_that_have_no_handlers : WithDebugging, IDisposable
+	public class RhinoQueues_Messages_that_have_no_handlers : WithDebugging
     {
-        private readonly IWindsorContainer container;

 		public RhinoQueues_Messages_that_have_no_handlers()
         {
@@ -23,29 +22,35 @@
             if (Directory.Exists("test_subscriptions.esent"))
                 Directory.Delete("test_subscriptions.esent", true);

-            container = new WindsorContainer(new XmlInterpreter("RhinoQueues/RhinoQueues.config"));
-            container.Kernel.AddFacility("rhino.esb", new RhinoServiceBusFacility());
         }

+		private static IWindsorContainer CreateContainer()
+		{
+			var container = new WindsorContainer(new XmlInterpreter("RhinoQueues/RhinoQueues.config"));
+			container.Kernel.AddFacility("rhino.esb", new RhinoServiceBusFacility());
+			return container;
+		}

-        [Fact]
+
+		[Fact]
         public void Should_go_to_discard_sub_queue_and_be_able_to_restart_bus()
         {
+			using (var container = CreateContainer())
             using (var bus = container.Resolve<IStartableServiceBus>())
             {
                 bus.Start();
-                bus.Send(bus.Endpoint, "foobar");
-            	var transport = (RhinoQueuesTransport) container.Resolve<ITransport>();
-				Thread.Sleep(2000);
-				//in RhinoQueuesTransport.Start() the TimeoutAction is created and threw NullReferenceException
-				//if the queue had discarded message due to no handlers
-            	var timeoutAction = new TimeoutAction(transport.Queue);
+            	var wait = new ManualResetEvent(false);
+				var transport = (RhinoQueuesTransport)container.Resolve<ITransport>();
+            	transport.MessageProcessingCompleted += (information, exception) => wait.Set();
+				bus.Send(bus.Endpoint, "foobar");
+            	wait.WaitOne();
             }
+
+			using (var container = CreateContainer())
+			using (var bus = container.Resolve<IStartableServiceBus>())
+			{
+				bus.Start();
+			}
         }
-
-		public void Dispose()
-		{
-			container.Dispose();
-		}
     }
 }


Bayesian Learning with MCMC

Bayesian Learning with MCMC

--- MonteCarlos/Program.cs
+++ MonteCarlos/Program.cs
@@ -1,14 +1,11 @@
 using System;
-using System.Collections.Generic;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;

 namespace MonteCarlos
 {
     class Program
     {
-        private const int trials = 1000000;
+        private const int trials = 100000;

         static void Main(string[] args)
         {
@@ -16,6 +13,105 @@

             Random random = new Random(0);

+            SampleNonUniformGrid(random);
+
+            Console.WriteLine("Bayesian Learning");
+            BayesianLearning(random);
+        }
+
+        private static void BayesianLearning(Random random)
+        {
+            const int numSamples = 1000;
+            // Generating some Gaussian samples
+            double[] samples = new double[numSamples];
+            for (int i = 0; i < numSamples; i += 2)
+            {
+                double u1 = random.NextDouble();
+                double u2 = random.NextDouble();
+                double r = Math.Sqrt(-2 * Math.Log(u1));
+                double theta = 2 * Math.PI * u2;
+                double x = r * Math.Cos(theta);
+                double y = r * Math.Sin(theta);
+
+                // Mean 30 - Variance 400
+                x *= 20;
+                x += 30;
+                y *= 20;
+                y += 30;
+
+                samples[i] = x;
+                samples[i + 1] = y;
+            }
+
+            // Bayesian learning
+
+            // Here is our state space of two real numbers (i.e. the plane)
+            // Variance has to be positive, but log variance can take any value, that make the markov chain part easy.
+            double mean = samples.Min();
+            double logVariance = 0;
+
+            // Here are the integral values to compute,
+            double meanSum = 0;
+            double varianceSum = 0;
+
+            for (int i = 0; i < trials; i++)
+            {
+                double logLikelihood = GetLogLikelihood(samples, mean, logVariance);
+                double delta_mean = random.NextDouble() - 0.5;
+                double delta_log_variance = random.NextDouble() - 0.5;
+                double newLogLikelihood = GetLogLikelihood(samples, mean + delta_mean, logVariance + delta_log_variance);
+
+                // Implicitly, we are assuming a flat, uninformative prior here.
+
+                // P(theta'|D) = P(D|theta') * P(theta') / P(D)
+                // P(theta|D) = P(D|theta) * P(theta) / P(D)
+                // => P(theta'|D) / P(theta|D) = P(D|theta') / P(D|theta)
+
+                double acceptanceLogLikelihood = newLogLikelihood - logLikelihood;
+
+                if (Math.Log(random.NextDouble()) < acceptanceLogLikelihood)
+                {
+                    mean += delta_mean;
+                    logVariance += delta_log_variance;
+                }
+
+                // Here we are processing a sample in the parameter space according to the posterior probability distribution
+                // Computing expected value like this is no different from computing the expected value of a dice by averaging
+                // a lot of samples.
+                meanSum += mean;
+                varianceSum += Math.Exp(logVariance);
+            }
+
+            // We could have other statistics about the parameters too, if we wish.
+            Console.WriteLine(meanSum / trials);
+            Console.WriteLine(varianceSum / trials);
+        }
+
+        // The interesting thing about this example is that the probability model we wanted can be arbitrarily complex
+        // As long as we know how to compute the log likelihood, we are good to go to estimate the parameters using MCMC.
+        private static double GetLogLikelihood(double[] samples, double mean, double logVariance)
+        {
+            double logLikelihood = 0;
+            double variance = Math.Exp(logVariance);
+            double sigma = Math.Sqrt(variance);
+            double logSigma = Math.Log(sigma);
+            for (int j = 0; j < samples.Length; j++)
+            {
+                logLikelihood += LogNormDist(samples[j], mean, variance, logSigma, logVariance);
+            }
+
+            return logLikelihood;
+        }
+
+        private static double LogNormDist(double v, double mean, double variance, double logSigma, double logVariance)
+        {
+            double diff = v - mean;
+            return -logSigma - diff * diff / 2 / variance;
+        }
+
+
+        private static void SampleNonUniformGrid(Random random)
+        {
             // The goal of this program is to generate random sample such that the cell with weight 9 is 9 time more probable to be sampled
             // This small problem would look like stupid because it is really easy to generate such a distribution without a Markov Chain,
             // but we will try Markov chain anyway.


improve UI

improve UI

--- NormalPainter/Assets/UTJ/NormalPainter/Editor/NormalPainterWindow.cs
+++ NormalPainter/Assets/UTJ/NormalPainter/Editor/NormalPainterWindow.cs
@@ -842,25 +842,29 @@

             EditorGUILayout.Space();

+            EditorGUILayout.BeginVertical("Box");
             settings.foldEdit = EditorGUILayout.Foldout(settings.foldEdit, "Edit");
             if (settings.foldEdit)
                 DrawEditPanel();
-
+            EditorGUILayout.EndVertical();
+
+            EditorGUILayout.BeginVertical("Box");
             settings.foldMisc = EditorGUILayout.Foldout(settings.foldMisc, "Misc");
             if (settings.foldMisc)
                 DrawMiscPanel();
-
-            EditorGUILayout.Space();
-
+            EditorGUILayout.EndVertical();
+
+            EditorGUILayout.BeginVertical("Box");
             settings.foldInExport = EditorGUILayout.Foldout(settings.foldInExport, "Import / Export");
             if (settings.foldInExport)
                 DrawInExportPanel();
-
-            EditorGUILayout.Space();
-
+            EditorGUILayout.EndVertical();
+
+            EditorGUILayout.BeginVertical("Box");
             settings.foldDisplay = EditorGUILayout.Foldout(settings.foldDisplay, "Display");
             if (settings.foldDisplay)
                 DrawDisplayPanel();
+            EditorGUILayout.EndVertical();

             if (EditorGUI.EndChangeCheck())
                 RepaintAllViews();


Support inherited properties in gradient brushes (xlink:href) Support more fill color syntaxes (rgb(x,x,x) + "white", "black" etc.)

--- NGraphics/SvgReader.cs
+++ NGraphics/SvgReader.cs
@@ -326,25 +326,54 @@
 					var urlM = fillUrlRe.Match (fill);
 					if (urlM.Success) {
 						var id = urlM.Groups [1].Value.Trim ();
-						XElement defE;
-						if (defs.TryGetValue (id, out defE)) {
-							switch (defE.Name.LocalName) {
-							case "linearGradient":
-								brush = CreateLinearGradientBrush (defE);
-								break;
-							case "radialGradient":
-								brush = CreateRadialGradientBrush (defE);
-								break;
-							default:
-								throw new NotSupportedException ("Fill " + defE.Name);
-							}
-						} else {
-							throw new Exception ("Invalid fill url reference: " + id);
-						}
+						brush = GetGradientBrush(id, null);
 					} else {
 						throw new NotSupportedException ("Fill " + fill);
 					}
 				}
+			}
+		}
+
+		protected GradientBrush GetGradientBrush(string fill, GradientBrush child)
+		{
+			XElement defE;
+			if (defs.TryGetValue (fill, out defE)) {
+				GradientBrush brush = null;
+				switch (defE.Name.LocalName) {
+				case "linearGradient":
+					brush = CreateLinearGradientBrush (defE);
+					break;
+				case "radialGradient":
+					brush = CreateRadialGradientBrush (defE);
+					break;
+				default:
+					throw new NotSupportedException ("Fill " + defE.Name);
+				}
+				if (child != null)
+				{
+					if (child is RadialGradientBrush && brush is RadialGradientBrush)
+					{
+						((RadialGradientBrush)brush).Center = ((RadialGradientBrush)child).Center;
+						((RadialGradientBrush)brush).Focus = ((RadialGradientBrush)child).Focus;
+						((RadialGradientBrush)brush).Radius = ((RadialGradientBrush)child).Radius;
+					} else if (child is LinearGradientBrush && brush is LinearGradientBrush)
+					{
+						((LinearGradientBrush)brush).Start = ((LinearGradientBrush)child).Start;
+						((LinearGradientBrush)brush).End = ((LinearGradientBrush)child).End;
+					}
+
+					brush.AddStops(child.Stops);
+				}
+
+				XNamespace xlink = "http://www.w3.org/1999/xlink";
+				var parent = defE.Attribute(xlink + "href");
+				if (parent != null && !string.IsNullOrEmpty(parent.Value))
+				{
+					brush = GetGradientBrush(parent.Value.Substring(1), brush);
+				}
+				return brush;
+			} else {
+				throw new Exception ("Invalid fill url reference: " + fill);
 			}
 		}

@@ -594,6 +623,8 @@
 			return ReadColor (a.Value);
 		}

+		Regex rgbRe = new Regex("([0-9]+).*?([0-9]+).*?([0-9]+)");
+
 		Color ReadColor (string raw)
 		{
 			if (string.IsNullOrWhiteSpace (raw) || raw.Equals("none", StringComparison.OrdinalIgnoreCase))
@@ -609,8 +640,21 @@
 				var b = int.Parse (s.Substring (5, 2), NumberStyles.HexNumber, icult);

 				return new Color (r / 255.0, g / 255.0, b / 255.0, 1);
-
-			}
+			}
+
+			var match = rgbRe.Match(s);
+			if (match.Success && match.Groups.Count == 4)
+			{
+				var r = int.Parse( match.Groups[1].Value );
+				var g = int.Parse( match.Groups[2].Value );
+				var b = int.Parse( match.Groups[3].Value );
+
+				return new Color (r / 255.0, g / 255.0, b / 255.0, 1);
+			}
+
+			Color color;
+			if (Colors.TryParse (s, out color))
+				return color;

 			throw new NotSupportedException ("Color " + s);
 		}


Fix the solution for Ex05

Fix the solution for Ex05

--- ParallelWorkshop/Ex05DatedSerial/PossibleSolution/LazyDatedSerial.cs
+++ ParallelWorkshop/Ex05DatedSerial/PossibleSolution/LazyDatedSerial.cs
@@ -4,7 +4,8 @@
 {
     public class LazyDatedSerial
     {
-        private Lazy<ThreadSafeSerial> serial = new Lazy<ThreadSafeSerial>(LazyThreadSafetyMode.ExecutionAndPublication);
+        private Lazy<ThreadSafeSerial> serial = new Lazy<ThreadSafeSerial>
+            (() => new ThreadSafeSerial(DateTime.Now.ToShortDateString()), LazyThreadSafetyMode.ExecutionAndPublication);

         public string GetNextSerial()
         {


Added NotLow property and cleaned up WriteRestricted.

--- NtApiDotNet/NtToken.cs
+++ NtApiDotNet/NtToken.cs
@@ -1437,15 +1437,12 @@
         /// <summary>
         /// Get whether token is write restricted.
         /// </summary>
-        public bool WriteRestricted
-        {
-            get
-            {
-                if (!Restricted)
-                    return false;
-                return (Flags & TokenFlags.WriteRestricted) != 0;
-            }
-        }
+        public bool WriteRestricted => Restricted && Flags.HasFlagSet(TokenFlags.WriteRestricted);
+
+        /// <summary>
+        /// Get whether token is not low.
+        /// </summary>
+        public bool NotLow => Flags.HasFlagSet(TokenFlags.NotLow);

         /// <summary>
         /// Token access flags.


SharingStage.cs added documentation to two private variables, moved base call to OnDestroy to the end after internals.

--- Assets/HoloToolkit/Sharing/Scripts/SharingStage.cs
+++ Assets/HoloToolkit/Sharing/Scripts/SharingStage.cs
@@ -108,7 +108,14 @@
         /// </summary>
         private DiscoveryClientAdapter discoveryClientAdapter;

+        /// <summary>
+        /// The current ping interval during AutoDiscovery updates.
+        /// </summary>
         private float pingIntervalCurrent;
+
+        /// <summary>
+        /// True when AutoDiscovery is actively searching, otherwise false.
+        /// </summary>
         private bool isTryingToFindServer;

         [Tooltip("Show Detailed Information for server connections")]
@@ -128,7 +135,7 @@
             }
             set
             {
-                using (XString userName = new XString(value))
+                using (var userName = new XString(value))
                 {
                     Manager.SetUserName(userName);
                 }
@@ -171,8 +178,6 @@

         protected override void OnDestroy()
         {
-            base.OnDestroy();
-
             if (discoveryClient != null)
             {
                 discoveryClient.RemoveListener(discoveryClientAdapter);
@@ -227,6 +232,8 @@

             // Forces a garbage collection to try to clean up any additional reference to SWIG-wrapped objects
             GC.Collect();
+
+            base.OnDestroy();
         }

         private void LateUpdate()
@@ -245,7 +252,7 @@

         private void Connect()
         {
-            ClientConfig config = new ClientConfig(ClientRole);
+            var config = new ClientConfig(ClientRole);
             config.SetIsAudioEndpoint(IsAudioEndpoint);
             config.SetLogWriter(logWriter);


Fixed nunchuck buttons bug Fixed a bug where the nunchuck C and Z buttons are inverted.

--- Assets/Wiimote/Scripts/WiimoteData/NunchuckData.cs
+++ Assets/Wiimote/Scripts/WiimoteData/NunchuckData.cs
@@ -50,8 +50,8 @@
             _accel[1] = (int)data[3] << 2; _accel[1] |= (data[5] & 0x30) >> 4;
             _accel[2] = (int)data[4] << 2; _accel[2] |= (data[5] & 0x0c) >> 2;

-            _c = (data[5] & 0x02) == 0x02;
-            _z = (data[5] & 0x01) == 0x01;
+            _c = (data[5] & 0x02) != 0x02;
+            _z = (data[5] & 0x01) != 0x01;
             return true;
         }


Improve for statement debuggability

Improve for statement debuggability

--- cli/src/MsgPack/Serialization/Emittion.cs
+++ cli/src/MsgPack/Serialization/Emittion.cs
@@ -48,23 +48,23 @@
 		public static void EmitFor( TracingILGenerator il, LocalBuilder count, Action<TracingILGenerator, LocalBuilder> bodyEmitter )
 		{
 			var i = il.DeclareLocal( typeof( int ), "i" );
+			il.EmitLdc_I4_0();
+			il.EmitAnyStloc( i );
 			var forCond = il.DefineLabel( "FOR_COND" );
-			il.MarkLabel( forCond );
-
-			// cond
-			il.EmitAnyLdloc( i );
-			il.EmitAnyLdloc( count );
-			var endFor = il.DefineLabel( "END_FOR" );
-			il.EmitBeq( endFor );
-
+			il.EmitBr( forCond );
+			var body = il.DefineLabel( "BODY" );
+			il.MarkLabel( body );
 			bodyEmitter( il, i );
 			// increment
 			il.EmitAnyLdloc( i );
 			il.EmitLdc_I4_1();
 			il.EmitAdd();
 			il.EmitAnyStloc( i );
-			il.EmitBr( forCond );
-			il.MarkLabel( endFor );
+			// cond
+			il.MarkLabel( forCond );
+			il.EmitAnyLdloc( i );
+			il.EmitAnyLdloc( count );
+			il.EmitBlt( body );
 		}

 		/// <summary>


comment out code that causes blocking #5.

--- Assets/uREPL/Scripts/Completions/MonoCompletion.cs
+++ Assets/uREPL/Scripts/Completions/MonoCompletion.cs
@@ -130,11 +130,14 @@
 		}

 		// At first, try to complement the non-edited input.
+		// NOTE: this cause crash when input matches some patterns (e.g. "for (")
+		/*
 		string prefix;
 		var result = Evaluator.GetCompletions(input, out prefix);
 		if (result != null) {
 			return ConvertToCompletionInfoArray(result, prefix);
 		}
+		*/

 		// Next, try to complement input whose last line is edited.
 		// (If there is only on line, skip it.)


resolve conflicts

resolve conflicts

Merge branch 'develop' of https://github.com/grisme/BigQueryProvider into develop

Conflicts:
	BigQueryProvider/Tests/BigQueryCommandTestsBase.cs

--- BigQueryProvider/Tests/BigQueryCommandTestsBase.cs
+++ BigQueryProvider/Tests/BigQueryCommandTestsBase.cs
@@ -20,16 +20,14 @@

         protected BigQueryCommandTestsBase() {
             natalitySchemaTable = new DataTable();
-            natalitySchemaTable.Columns.Add("ColumnName", typeof(string));
-            natalitySchemaTable.Columns.Add("DataType", typeof(Type));
-            natalitySchemaTable.Rows.Add("weight_pounds", typeof(float));
-            natalitySchemaTable.Rows.Add("is_male", typeof(bool));
+            natalitySchemaTable.Columns.Add("ColumnName", typeof (string));
+            natalitySchemaTable.Columns.Add("DataType", typeof (Type));
+            natalitySchemaTable.Rows.Add("weight_pounds", typeof (float));
+            natalitySchemaTable.Rows.Add("is_male", typeof (bool));

             connection = new BigQueryConnection(GetConnectionString());
             connection.Open();
-
         }
-

         [Fact]
         public void ExecuteReaderTest_TypeText() {


Savepoint

Savepoint

--- Pocal/MainPage.xaml.cs
+++ Pocal/MainPage.xaml.cs
@@ -432,6 +432,7 @@

         public void SDV_AppointmentTap(object sender, System.Windows.Input.GestureEventArgs e)
         {
+            UpdateLayout(); // Vielleicht verlangsamt das die UX! Vielleicht behebt das jedoch den TapOffset Bug.
             PocalAppointment pocalAppointment = ((FrameworkElement)sender).DataContext as PocalAppointment;
             Dispatcher.BeginInvoke(() =>
             {


Improved error page operation

Improved error page operation

--- Source/Applications/openHistorian/openHistorian/wwwroot/Error.cshtml
+++ Source/Applications/openHistorian/openHistorian/wwwroot/Error.cshtml
@@ -21,53 +21,79 @@
 //
 //*****************************************************************************************************@
 @using System.Net.Http
+@using GSF
 @using GSF.Web
 @using GSF.Web.Model
 @using GSF.Web.Security
 @using GSF.Web.Shared
-@using openHistorian.Model
-@inherits ExtendedTemplateBase<AppModel>
+@inherits ExtendedTemplateBase
 @{
-    string rootPath = Model.Global.WebRootPath;
-}
-<!DOCTYPE html>
+    HttpRequestMessage request = ViewBag.Request;
+    Dictionary<string, string> parameters = request.QueryParameters();
+
+    bool showDebug = ViewBag.DebugBuild;
+    string showDebugValue;
+
+    if (parameters.TryGetValue("Debug", out showDebugValue)) {
+        showDebug = showDebugValue.ParseBoolean();
+    }
+}<!DOCTYPE html>

     <meta charset="utf-8"/>
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>@Model.Global.ApplicationName - Server Error</title>
+    <titleServer Error</title>
     <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
     <link href="@Resources.Root/Shared/Content/bootstrap.css" rel="stylesheet">
     <link href="Content/Site.css" rel="stylesheet">
     @Raw(Resources.HeaderIcons)
+

-

-@if (ViewBag.DebugBuild)
+@if (showDebug)
 {

         Web server razor page exception:
-

-
@ViewBag.Exception.Message

 }
 else
 {
+

-        Web server was not able to run or compile page, redirecting to home page...
+        Web server was not able to run or compile page, redirecting to home page <button id="cancelButton" type="button" class="btn btn-sm btn-warning">cancel</button>...

-        Click here if page does not redirect
+        Click here if page does not redirect

 }
+
@ViewBag.Exception.Message

-@if (!ViewBag.DebugBuild)
+@if (!showDebug)
 {

 }


Added short option.

Added short option.

--- Properties/Settings.cs
+++ Properties/Settings.cs
@@ -53,7 +53,7 @@
             set { this["Password"] = value; }
         }

-        [Option("minify", HelpText = "Minify JavaScript")]
+        [Option('m', "minify", HelpText = "Minify JavaScript")]
         [UserScopedSetting]
         [DefaultSettingValue("false")]
         public bool Minify


Minor fix: Removed unused variable

Minor fix: Removed unused variable

--- Source/System.Management/Pash/Implementation/CmdletArgumentBinder.cs
+++ Source/System.Management/Pash/Implementation/CmdletArgumentBinder.cs
@@ -224,7 +224,6 @@
             foreach (var curParam in namedParameters)
             {
                 string curName = curParam.Name;
-                bool found = false;

                 // try to get the parameter from any set. throws an error if the name is ambiguous or doesn't exist
                 var paramInfo = _cmdletInfo.LookupParameter(curName);