Show more details on Xslt failures.

Show more details on Xslt failures.

--- Source/MSBuild.Community.Tasks/Xslt/Xslt.cs
+++ Source/MSBuild.Community.Tasks/Xslt/Xslt.cs
@@ -275,7 +275,7 @@
 			}
 			catch (XsltException ex)
 			{
-				Log.LogErrorFromException(ex);
+				Log.LogErrorFromException(ex, false, true, new Uri(ex.SourceUri).LocalPath + '(' + ex.LineNumber + ',' + ex.LinePosition + ')');
 				return false;
 			}
 			catch (FileNotFoundException ex)
@@ -290,7 +290,7 @@
 			}
 			catch (XmlException ex)
 			{
-				Log.LogErrorFromException(ex);
+				Log.LogErrorFromException(ex, false, true, new Uri(ex.SourceUri).LocalPath + '(' + ex.LineNumber + ',' + ex.LinePosition + ')');
 				return false;
 			}
 			finally


- CHANGED: EntityManager now fires the EntityRemoved event before detaching all components in order to allow subsystems to wrap-up.

--- Source/RainyGames.GameBase/EntityManager.cs
+++ Source/RainyGames.GameBase/EntityManager.cs
@@ -104,14 +104,14 @@
         {
             this.CheckEntityId(id);

+            this.game.EventManager.InvokeEntityRemoved(id);
+
             foreach (ComponentManager manager in this.componentManagers.Values)
             {
                 manager.RemoveComponent(id);
             }

             this.entities.Remove(id);
-
-            this.game.EventManager.InvokeEntityRemoved(id);
         }

         /// <summary>


Fixed issue with ORACLE dates in data migration utility.

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS07]$/gsf/Main;C88738

--- Source/Tools/DataMigrationUtility/Schema.cs
+++ Source/Tools/DataMigrationUtility/Schema.cs
@@ -836,6 +836,9 @@
                                             case DatabaseType.SQLite:
                                                 encodedValue = "'" + tempDateTimeValue.ToString("yyyy-MM-dd HH:mm:ss") + "'";
                                                 break;
+                                            case DatabaseType.Oracle:
+                                                encodedValue = "to_date('" + tempDateTimeValue.ToString("dd-MMM-yyyy HH:mm:ss") + "', 'DD-MON-YYYY HH24:MI:SS')";
+                                                break;
                                             default:
                                                 encodedValue = "'" + tempDateTimeValue.ToString("dd-MMM-yyyy HH:mm:ss") + "'";
                                                 break;
@@ -964,6 +967,9 @@
                             case DatabaseType.SQLite:
                                 encodedValue = "'" + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "'";
                                 break;
+                            case DatabaseType.Oracle:
+                                encodedValue = "to_date('" + DateTime.UtcNow.ToString("dd-MMM-yyyy HH:mm:ss") + "', 'DD-MON-YYYY HH24:MI:SS')";
+                                break;
                             default:
                                 encodedValue = "'" + DateTime.UtcNow.ToString("dd-MMM-yyyy HH:mm:ss") + "'";
                                 break;


New release.

New release.

--- Source/VhdAttach/Properties/SolutionInfo.cs
+++ Source/VhdAttach/Properties/SolutionInfo.cs
@@ -4,5 +4,5 @@
 [assembly: AssemblyCompany("Josip Medved")]
 [assembly: AssemblyCopyright("Copyright (c) 2009 Josip Medved <jmedved@jmedved.com>")]

-[assembly: AssemblyVersion("0.00.*")]
-[assembly: AssemblyInformationalVersion("0.00")]
+[assembly: AssemblyVersion("4.01.*")]
+[assembly: AssemblyInformationalVersion("4.01")]


fix coding style

fix coding style

--- SumoLogic.Logging.NLog/InternalLoggerLog.cs
+++ SumoLogic.Logging.NLog/InternalLoggerLog.cs
@@ -54,41 +54,61 @@
         public void Debug(string msg)
         {
             if (InternalLogger.IsDebugEnabled)
+            {
                 InternalLogger.Debug(string.Concat(_prefix, msg));
+            }
             if (_customLog?.IsDebugEnabled == true)
+            {
                 _customLog.Debug(msg);
+            }
         }

         public void Error(string msg)
         {
             if (InternalLogger.IsErrorEnabled)
+            {
                 InternalLogger.Error(string.Concat(_prefix, msg));
+            }
             if (_customLog?.IsErrorEnabled == true)
+            {
                 _customLog.Error(msg);
+            }
         }

         public void Info(string msg)
         {
             if (InternalLogger.IsInfoEnabled)
+            {
                 InternalLogger.Info(string.Concat(_prefix, msg));
+            }
             if (_customLog?.IsInfoEnabled == true)
+            {
                 _customLog.Info(msg);
+            }
         }

         public void Trace(string msg)
         {
             if (InternalLogger.IsTraceEnabled)
+            {
                 InternalLogger.Trace(string.Concat(_prefix, msg));
+            }
             if (_customLog?.IsTraceEnabled == true)
+            {
                 _customLog.Trace(msg);
+            }
         }

         public void Warn(string msg)
         {
             if (InternalLogger.IsWarnEnabled)
+            {
                 InternalLogger.Warn(string.Concat(_prefix, msg));
+            }
             if (_customLog?.IsWarnEnabled == true)
+            {
                 _customLog.Warn(msg);
+            }
         }
     }
 }


WelfordVariance: one more test

WelfordVariance: one more test

--- test/Medo.Tests/Math/WelfordVariance.Tests.cs
+++ test/Medo.Tests/Math/WelfordVariance.Tests.cs
@@ -125,6 +125,18 @@
             Assert.Equal(3.16227766016838, stats.RelativeStandardDeviation, 15);
         }

+        [Fact(DisplayName = "WelfordVariance: Example (10)")]
+        public void Example10() {
+            var stats = new WelfordVariance();
+            stats.AddRange(new double[] { -1, 0, 1 });
+            Assert.Equal(0, stats.Mean, 15);
+            Assert.Equal(0.666666666666667, stats.Variance, 15);
+            Assert.Equal(1, stats.SampleVariance, 15);
+            Assert.Equal(0.816496580927726, stats.StandardDeviation, 15);
+            Assert.Equal(1, stats.SampleStandardDeviation, 15);
+            Assert.Equal(double.PositiveInfinity, stats.RelativeStandardDeviation, 15);
+        }
+
         [Fact(DisplayName = "WelfordVariance: No values")]
         public void NoValue() {
             var stats = new WelfordVariance();


Test for aggregate exception handling

Test for aggregate exception handling

--- tests/Bugsnag.Tests/Payload/ExceptionTests.cs
+++ tests/Bugsnag.Tests/Payload/ExceptionTests.cs
@@ -1,4 +1,5 @@
 using System.Linq;
+using System.Threading.Tasks;
 using Bugsnag.Payload;
 using Xunit;

@@ -26,5 +27,28 @@

       Assert.Equal(2, exceptions.Count());
     }
+
+    [Fact]
+    public void HandleAggregateExceptions()
+    {
+      Exceptions exceptions = null;
+      var exceptionsToThrow = new[] { new System.Exception(), new System.DllNotFoundException() };
+      var tasks = exceptionsToThrow.Select(e => Task.Run(() => { throw e; })).ToArray();
+
+      try
+      {
+        Task.WaitAll(tasks);
+      }
+      catch (System.Exception exception)
+      {
+        exceptions = new Exceptions(exception, 0);
+      }
+
+      var results = exceptions.ToArray();
+
+      Assert.Contains(results, exception => exception.ErrorClass == "System.DllNotFoundException");
+      Assert.Contains(results, exception => exception.ErrorClass == "System.Exception");
+      Assert.Contains(results, exception => exception.ErrorClass == "System.AggregateException");
+    }
   }
 }


Fixes mobs still being in the UpdateManager list after being deleted. (#6464)

--- UnityProject/Assets/Scripts/NPC/AI/MobAI.cs
+++ UnityProject/Assets/Scripts/NPC/AI/MobAI.cs
@@ -95,10 +95,14 @@

 		public virtual void OnDespawnServer(DespawnInfo info)
 		{
+			health.applyDamageEvent += AttackReceivedCoolDown;
+			ResetBehaviours();
+		}
+
+		public void OnDisable()
+		{
 			UpdateManager.Remove(CallbackType.UPDATE, UpdateMe);
 			UpdateManager.Remove(CallbackType.PERIODIC_UPDATE, PeriodicUpdate);
-			health.applyDamageEvent += AttackReceivedCoolDown;
-			ResetBehaviours();
 		}

 		/// <summary>


Delete duplicated class

Delete duplicated class

--- WPPMM/PhoneApp/CameraManager/EvConverter.cs
+++ WPPMM/PhoneApp/CameraManager/EvConverter.cs
@@ -1,76 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace WPPMM.CameraManager
-{
-    class EvConverter
-    {
-        /// <summary>
-        ///
-        /// </summary>
-        /// <param name="definition"></param>
-        /// <returns></returns>
-        public static EVStepDefinition GetDefinition(int definition)
-        {
-            switch (definition)
-            {
-                case 1:
-                    return EVStepDefinition.EV_1_3;
-                default:
-                    return EVStepDefinition.Undefined;
-            }
-        }
-
-        public static int GetIntDefinition(EVStepDefinition definition)
-        {
-            switch (definition)
-            {
-                case EVStepDefinition.EV_1_3:
-                    return 1;
-                default:
-                    return 0;
-            }
-        }
-
-        /// <summary>
-        ///
-        /// </summary>
-        /// <param name="index">Index of the EV for current step definition</param>
-        /// <param name="definition">Current step definition</param>
-        /// <returns>Exposure value to display.</returns>
-        public static float GetEV(int index, int definition)
-        {
-            return GetEV(index, GetDefinition(definition));
-        }
-
-        /// <summary>
-        ///
-        /// </summary>
-        /// <param name="index">Index of the EV for current step definition</param>
-        /// <param name="definition">Current step definition</param>
-        /// <returns>Exposure value to display</returns>
-        public static float GetEV(int index, EVStepDefinition definition)
-        {
-            float by = 0;
-            switch (definition)
-            {
-                case EVStepDefinition.EV_1_3:
-                    by = 0.33f;
-                    break;
-                default:
-                    return 0;
-            }
-
-            return (float)index * by;
-        }
-    }
-
-    enum EVStepDefinition
-    {
-        Undefined,
-        EV_1_3
-    }
-}


codefactor

codefactor

--- WalletWasabi.Fluent/Controls/Dialog.xaml.cs
+++ WalletWasabi.Fluent/Controls/Dialog.xaml.cs
@@ -13,7 +13,6 @@
     /// </summary>
     public class Dialog : ContentControl
     {
-
         public static readonly StyledProperty<bool> IsDialogOpenProperty =
             AvaloniaProperty.Register<Dialog, bool>(nameof(IsDialogOpen));


Hiding the Triggers on the GUI

Hiding the Triggers on the GUI

Changed the visibility of the triggers on the input mapper because they
are not yet implemented.

--- XboxKeyboardMouse/Forms/Options.Designer.cs
+++ XboxKeyboardMouse/Forms/Options.Designer.cs
@@ -32,6 +32,8 @@
             this.tabControl2 = new System.Windows.Forms.TabControl();
             this.tabPage4 = new System.Windows.Forms.TabPage();
             this.editor_Preset = new System.Windows.Forms.GroupBox();
+            this.comboBox1 = new System.Windows.Forms.ComboBox();
+            this.label2 = new System.Windows.Forms.Label();
             this.optDetachKey = new System.Windows.Forms.Button();
             this.label1 = new System.Windows.Forms.Label();
             this.richTextBox1 = new System.Windows.Forms.RichTextBox();
@@ -109,8 +111,6 @@
             this.btnCreatePreset = new System.Windows.Forms.Button();
             this.tbCreateName = new System.Windows.Forms.TextBox();
             this.label21 = new System.Windows.Forms.Label();
-            this.label2 = new System.Windows.Forms.Label();
-            this.comboBox1 = new System.Windows.Forms.ComboBox();
             this.tabControl1.SuspendLayout();
             this.tabPage1.SuspendLayout();
             this.tabPage2.SuspendLayout();
@@ -258,6 +258,26 @@
             this.editor_Preset.TabStop = false;
             this.editor_Preset.Text = "Select a preset to get started";
             //
+            // comboBox1
+            //
+            this.comboBox1.FormattingEnabled = true;
+            this.comboBox1.Items.AddRange(new object[] {
+            "Default"});
+            this.comboBox1.Location = new System.Drawing.Point(79, 217);
+            this.comboBox1.Name = "comboBox1";
+            this.comboBox1.Size = new System.Drawing.Size(124, 21);
+            this.comboBox1.TabIndex = 26;
+            this.comboBox1.Text = "Default";
+            //
+            // label2
+            //
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(14, 220);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(43, 13);
+            this.label2.TabIndex = 25;
+            this.label2.Text = "Engine:";
+            //
             // optDetachKey
             //
             this.optDetachKey.Location = new System.Drawing.Point(57, 272);
@@ -645,6 +665,7 @@
             this.panel2.Name = "panel2";
             this.panel2.Size = new System.Drawing.Size(58, 77);
             this.panel2.TabIndex = 21;
+            this.panel2.Visible = false;
             //
             // xbo_k_TRight
             //
@@ -929,6 +950,7 @@
             this.panel3.Name = "panel3";
             this.panel3.Size = new System.Drawing.Size(58, 77);
             this.panel3.TabIndex = 23;
+            this.panel3.Visible = false;
             //
             // xbo_m_TRight
             //
@@ -953,6 +975,7 @@
             this.panel4.Name = "panel4";
             this.panel4.Size = new System.Drawing.Size(58, 77);
             this.panel4.TabIndex = 22;
+            this.panel4.Visible = false;
             //
             // xbo_m_TLeft
             //
@@ -1225,26 +1248,6 @@
             this.label21.Size = new System.Drawing.Size(41, 13);
             this.label21.TabIndex = 0;
             this.label21.Text = "Name: ";
-            //
-            // label2
-            //
-            this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(14, 220);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(43, 13);
-            this.label2.TabIndex = 25;
-            this.label2.Text = "Engine:";
-            //
-            // comboBox1
-            //
-            this.comboBox1.FormattingEnabled = true;
-            this.comboBox1.Items.AddRange(new object[] {
-            "Default"});
-            this.comboBox1.Location = new System.Drawing.Point(79, 217);
-            this.comboBox1.Name = "comboBox1";
-            this.comboBox1.Size = new System.Drawing.Size(124, 21);
-            this.comboBox1.TabIndex = 26;
-            this.comboBox1.Text = "Default";
             //
             // Options
             //


- Added null check in BTTree's Reset function

--- BTTree.cs
+++ BTTree.cs
@@ -60,6 +60,8 @@
 	}

 	protected void Reset () {
-		_root.Clear();
+		if (_root != null) {
+			_root.Clear();
+		}
 	}
 }


Use new background for thumbnail background highlight color

--- Library/Widgets/ListView/ListView.cs
+++ Library/Widgets/ListView/ListView.cs
@@ -87,7 +87,7 @@

 		public ILibraryContainer ActiveContainer => this.LibraryContext.ActiveContainer;

-		public Color ThumbnailBackground { get; } = ActiveTheme.Instance.TertiaryBackgroundColor.AdjustLightness(1.05).ToColor();
+		public Color ThumbnailBackground { get; } = ApplicationController.Instance.Theme.ActiveTabColor.AdjustLightness(1.05).ToColor();

 		private async void ActiveContainer_Changed(object sender, ContainerChangedEventArgs e)
 		{


Adding some comments for documentation.

Adding some comments for documentation.

git-svn-id: 64cc320d9ecd7aad470f8b18be342a8e58536f88@220 a61f9e97-bd4c-0410-8c65-85b29eaa70ff

--- Gorgon/Rendering/Renderable.cs
+++ Gorgon/Rendering/Renderable.cs
@@ -780,6 +780,7 @@
 		/// <summary>
 		/// Property to set or return the alpha value used for alpha masking.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(int)), EditorMinMax(0, 255)]
 		public virtual int AlphaMaskValue
 		{
@@ -890,6 +891,7 @@
 		/// <summary>
 		/// Property to set or return the offset within the source image to start drawing from.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(Vector2D)), EditorRoundValues()]
 		public virtual Vector2D ImageOffset
 		{
@@ -996,6 +998,7 @@
 		/// <summary>
 		/// Property to set or return a uniform scale across the X and Y axis.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(float))]
 		public abstract float UniformScale
 		{
@@ -1022,6 +1025,7 @@
 		/// <summary>
 		/// Property to set or return the color.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(Drawing.Color))]
 		public abstract Drawing.Color Color
 		{
@@ -1032,6 +1036,7 @@
 		/// <summary>
 		/// Property to set or return the opacity.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(int)), EditorMinMax(0, 255)]
 		public abstract int Opacity
 		{
@@ -1042,6 +1047,7 @@
 		/// <summary>
 		/// Property to set or return the axis of the sprite.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(Vector2D))]
 		public virtual Vector2D Axis
 		{
@@ -1058,6 +1064,7 @@
 		/// <summary>
 		/// Property to set or return the scale of the sprite.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(Vector2D))]
 		public virtual Vector2D Scale
 		{
@@ -1074,6 +1081,7 @@
 		/// <summary>
 		/// Property to set or return the size of the object with scaling applied.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(Vector2D))]
 		public virtual Vector2D ScaledDimensions
 		{
@@ -1090,6 +1098,7 @@
 		/// <summary>
 		/// Property to set or return the scaled width of the object.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(float))]
 		public virtual float ScaledWidth
 		{
@@ -1106,6 +1115,7 @@
 		/// <summary>
 		/// Property to set or return the scaled height of the object.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(float))]
 		public virtual float ScaledHeight
 		{
@@ -1122,6 +1132,7 @@
 		/// <summary>
 		/// Property to set or return the image that this object is bound with.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(Image), InterpolationMode.None)]
 		public virtual Image Image
 		{
@@ -1139,6 +1150,7 @@
 		/// <summary>
 		/// Property to set or return the position of the object.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(Vector2D)), EditorRoundValues(), EditorCanDrag()]
 		public virtual Vector2D Position
 		{
@@ -1160,6 +1172,7 @@
 		/// <summary>
 		/// Property to set or return the rotation angle in degrees.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(float))]
 		public virtual float Rotation
 		{
@@ -1181,6 +1194,7 @@
 		/// <summary>
 		/// Property to set or return the size of the object.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(Vector2D)), EditorRoundValues()]
 		public virtual Vector2D Size
 		{
@@ -1204,6 +1218,7 @@
 		/// <summary>
 		/// Property to set or return the width of the object.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(float))]
 		public virtual float Width
 		{
@@ -1221,6 +1236,7 @@
 		/// <summary>
 		/// Property to set or return the height of the object.
 		/// </summary>
+		/// <remarks>Animations can be applied to this property.</remarks>
 		[Animated(typeof(float))]
 		public virtual float Height
 		{


Many fixes

Many fixes

--- Hermod/HTTP/General/HTTPURI.cs
+++ Hermod/HTTP/General/HTTPURI.cs
@@ -148,7 +148,7 @@
                 return true;
             }

-            URI = default(HTTPURI2);
+            URI = default;
             return false;

         }


Preparations for Generator level type checking

--- runtime/Generator.cs
+++ runtime/Generator.cs
@@ -26,15 +26,28 @@
     {
         private NamedType() { }
         public NamedType(string name, LLVMTypeRef type) { Name = name; Type = type; }
+
         public string Name;
         public LLVMTypeRef Type;
     }

+    internal class FunctionType
+    {
+        private FunctionType() { }
+        public FunctionType(NamedType type, NamedType[] parameters, NamedType result) { Type = type; Parameters = parameters; Result = result; }
+
+        public NamedType Type;
+        public NamedType[] Parameters;
+        public NamedType Result;
+    }
+
     internal class TypedValue
     {
         private TypedValue() { }
-        public TypedValue(TypeSpec spec, LLVMValueRef value) { TypeSpec = spec; Value = value; }
+        public TypedValue(TypeSpec spec, string name, LLVMValueRef value) { TypeSpec = spec; Name = name; Value = value; }
+
         public TypeSpec TypeSpec;
+        public string Name;
         public LLVMValueRef Value;
     }

@@ -42,6 +55,7 @@
     {
         public LLVMModuleRef Module;
         public NameDictionary Dictionary;
+        public Dictionary<string, FunctionType> FunctionTypes = new Dictionary<string, FunctionType>();
         public Dictionary<string, NamedType> Types = new Dictionary<string, NamedType>();
         public Dictionary<string, TypedValue> Values = new Dictionary<string, TypedValue>();
     }
@@ -167,14 +181,14 @@

         static TypedValue ResolveFunctionValue(Context context, Function function)
         {
-            var functionName = QualifyFunctionName(context, function);
+            var functionName = QualifyFunctionName(function);
             if (!context.Global.Values.ContainsKey(functionName))
                 CreateFunctionValue(context, function, functionName);
             var llvmFunction = context.Global.Values[function.Name];
             return llvmFunction;
         }

-        static string QualifyFunctionName(Context context, Function function)
+        static string QualifyFunctionName(Function function)
         {
             if ((function.Routine.Implementation == Implementation.Extern) || (function.Name == "main"))
                 return function.Name;
@@ -199,12 +213,304 @@
         static void CreateFunctionValue(Context context, Function function, string qualifiedName)
         {
             var functionType = ResolveFunctionType(context, function, qualifiedName);
-            var functionValue = context.Global.Module.AddFunction(qualifiedName, functionType.Type);
-            context.Global.Values.Add(qualifiedName, new TypedValue(function.Routine.Result[0].TypeSpec, functionValue));
-            ImplementRoutine(context, function.Source, functionValue, function.Routine, null, function.Span);
-        }
-
-        static void ImplementRoutine(Context context, Source source, LLVMValueRef functionValue, Routine routine, TypeSpec operatorType, Span span)
+            var functionValue = context.Global.Module.AddFunction(qualifiedName, functionType.Type.Type);
+            context.Global.Values.Add(qualifiedName, new TypedValue(function.Routine.Result[0].TypeSpec, qualifiedName, functionValue));
+            ImplementRoutine(context, function.Source, functionValue, functionType, function.Routine, null, function.Span);
+        }
+
+        static FunctionType ResolveFunctionType(Context context, Function function, string qualifiedName)
+        {
+            if (context.Global.FunctionTypes.ContainsKey(qualifiedName))
+                return context.Global.FunctionTypes[qualifiedName];
+            var functionType = CreateFunctionType(context, qualifiedName, function);
+            context.Global.FunctionTypes.Add(qualifiedName, functionType);
+            return functionType;
+        }
+
+        static FunctionType CreateFunctionType(Context context, string qualifiedName, Function function)
+        {
+            var returnType = GetSingleType(context, function.Routine.Result);
+            var parameterTypes = GetTypes(context, function.Routine.Input);
+            var functionType = new NamedType(qualifiedName, LLVMTypeRef.CreateFunction(returnType.Type, parameterTypes.ToList().ConvertAll(it => it.Type).ToArray()));
+            return new FunctionType(functionType, parameterTypes, returnType);
+        }
+
+        static NamedType GetSingleType(Context context, List<Parameter> result)
+        {
+            if (result == null)
+                return new NamedType("void", LLVMTypeRef.Void);
+
+            return ResolveType(context, result[0].TypeSpec);
+        }
+
+        static NamedType[] GetTypes(Context context, List<Parameter> result)
+        {
+            if (result == null)
+                return new NamedType[] { };
+
+            return result.ConvertAll(it => ResolveType(context, it.TypeSpec)).ToArray();
+        }
+
+        static NamedType ResolveType(Context context, TypeSpec typeSpec)
+        {
+            NamedType type;
+            if (context.GenericTypeDictionary != null && context.GenericTypeDictionary.ContainsKey(typeSpec.Name))
+                typeSpec = context.GenericTypeDictionary[typeSpec.Name];
+            var qualifiedName = QualifyName(context, typeSpec.Name);
+            var typeName = AddTypeArguments(qualifiedName, typeSpec.Arguments);
+            if (context.Global.Types.ContainsKey(typeName))
+                return context.Global.Types[typeName];
+
+            if (typeSpec.Name == "Pointer")
+            {
+                type = GetPointerType(context, typeSpec);
+            }
+            else
+            {
+                var newContext = new Context { Global = context.Global, Source = context.Global.Dictionary.Sources[qualifiedName] };
+                type = CreateType(newContext, qualifiedName, typeSpec);
+            }
+
+            context.Global.Types.Add(typeName, type);
+            return type;
+        }
+
+        static string QualifyName(Context context, string name)
+        {
+            if (context.Global.Types.ContainsKey(name))
+                return name;
+
+            if (context.Global.Dictionary.Definitions.ContainsKey(name))
+                return name;
+
+            if (context.Global.Dictionary.Functions.ContainsKey(name))
+                return name;
+
+            if (context.Global.Dictionary.Operators.ContainsKey(name))
+                return name;
+
+            if (context.Source.Uses != null && context.Source.Uses.ContainsKey(name))
+                return context.Source.Uses[name].Path;
+
+            if (context.Source.Usings != null)
+            {
+                foreach (var @using in context.Source.Usings)
+                {
+                    var usingName = @using.Path;
+
+                    var definition = context.ResolveDefinitionName(usingName, @using.Span);
+                    if (definition.Definitions != null && definition.Definitions.ContainsKey(name))
+                        return usingName + "." + name;
+
+                    if (definition.Operators != null && definition.Operators.ContainsKey(name))
+                        return usingName + "." + name;
+                }
+            }
+
+            return null;
+        }
+
+        static string AddTypeArguments(string name, List<TypeSpec> arguments)
+        {
+            if (arguments == null)
+                return name;
+
+            StringBuilder builder = new StringBuilder(name);
+            builder.Append('[');
+            bool first = true;
+            foreach (var argument in arguments)
+            {
+                if (first)
+                    first = false;
+                else
+                    builder.Append(',');
+                builder.Append(AddTypeArguments(argument.Name, argument.Arguments));
+            }
+            builder.Append(']');
+
+            return builder.ToString();
+        }
+
+        static NamedType CreateType(Context context, string qualifiedName, TypeSpec typeSpec)
+        {
+            var definition = context.ResolveDefinitionName(qualifiedName, typeSpec.Span);
+
+            if (typeSpec.Arguments != null)
+            {
+                if (definition.Type.Arguments != null)
+                {
+                    if (typeSpec.Arguments.Count != definition.Type.Arguments.Count)
+                        throw new CompilerException($"The generic type {qualifiedName} needs {definition.Type.Arguments.Count} type arguments, but {typeSpec.Arguments.Count} type arguments were given.", typeSpec.Span);
+                }
+                else
+                {
+                    throw new CompilerException($"The type {qualifiedName} is not a generic type.", typeSpec.Span);
+                }
+            }
+            else
+            {
+                if (definition.Type.Arguments != null)
+                {
+                    throw new CompilerException($"The type {qualifiedName} is a generic type. Generic arguments are missing.", typeSpec.Span);
+                }
+            }
+
+            return CreateGenericType(context, typeSpec, definition);
+        }
+
+        static NamedType CreateGenericType(Context context, TypeSpec typeSpec, Definition definition)
+        {
+            if (definition.IsIntrinsic)
+                return CreateInstrinsicType(definition.Type.Name, typeSpec.Span);
+
+            if (definition.Structure == null)
+                throw new CompilerException($"The type \"{definition.Type.Name}\" contains no data and can only be used as a namespace.", typeSpec.Span);
+
+            if (definition.Structure.Members.Count == 1 && definition.Structure.Members[0].Name == null && definition.Structure.Members[0].Type.Arguments == null)
+                return ResolveType(context, definition.Structure.Members[0].Type);
+
+            return null;
+        }
+
+        static NamedType CreateInstrinsicType(string name, Span span)
+        {
+            switch (name)
+            {
+                case "i1":
+                    return new NamedType("LLVM.i1", LLVMTypeRef.Int1);
+                case "i8":
+                    return new NamedType("LLVM.i8", LLVMTypeRef.Int8);
+                case "i32":
+                    return new NamedType("LLVM.i32", LLVMTypeRef.Int32);
+                case "i64":
+                    return new NamedType("LLVM.i64", LLVMTypeRef.Int64);
+                default:
+                    throw new CompilerException($"The intrinsic type \"{name}\" is unknown.", span);
+            }
+        }
+
+        static NamedType GetPointerType(Context context, TypeSpec typeSpec)
+        {
+            var qualifiedName = QualifyName(context, typeSpec.Name);
+            var typeName = AddTypeArguments(qualifiedName, typeSpec.Arguments);
+            if (typeSpec.Arguments == null)
+                throw new CompilerException("Pointer is a generic type which expects a type argument.", typeSpec.Span);
+            if (typeSpec.Arguments.Count != 1)
+                throw new CompilerException($"Pointer expects exactly one type argument, not {typeSpec.Arguments.Count}.", typeSpec.Span);
+            var typeArgument = typeSpec.Arguments[0];
+            var pointerTarget = (typeArgument.Name == "Pointer") ? GetPointerType(context, typeArgument) : ResolveType(context, typeArgument);
+            return new NamedType(typeName, LLVMTypeRef.CreatePointer(pointerTarget.Type, 0));
+        }
+
+        static TypedValue ResolveOperatorValue(Context context, TypeSpec operandType, Operator @operator)
+        {
+            var qualifiedName = QualifyOperatorName(context, operandType, @operator);
+            if (!context.Global.Values.ContainsKey(qualifiedName))
+                CreateOperatorValue(context, operandType, @operator, qualifiedName);
+            var llvmFunction = context.Global.Values[qualifiedName];
+            return llvmFunction;
+        }
+
+        static string QualifyOperatorName(Context context, TypeSpec operandType, Operator @operator)
+        {
+            var operatorNameBuilder = new StringBuilder();
+
+            operatorNameBuilder.Append(QualifyName(context, @operator.Definition.Type.Name));
+            operatorNameBuilder.Append('.');
+            operatorNameBuilder.Append(@operator.Name);
+            operatorNameBuilder.Append('[');
+            AppendGenericArguments(context, operatorNameBuilder, operandType, @operator.Span);
+            operatorNameBuilder.Append(']');
+            return operatorNameBuilder.ToString();
+        }
+
+        static void AppendGenericArguments(Context context, StringBuilder builder, TypeSpec operandType, Span span)
+        {
+            builder.Append(QualifyName(context, operandType.Name));
+            if (operandType.Arguments != null)
+            {
+                builder.Append('[');
+                bool first = true;
+                foreach (var type in operandType.Arguments)
+                {
+                    if (first)
+                        first = false;
+                    else
+                        builder.Append(',');
+                    AppendGenericArguments(context, builder, type, span);
+                }
+                builder.Append(']');
+            }
+        }
+
+        static void CreateOperatorValue(Context context, TypeSpec operandType, Operator @operator, string qualifiedName)
+        {
+            Dictionary<string, TypeSpec> genericTypeDictionary = CreateOperatorGenericTypeDictionary(operandType, @operator);
+            var newContext = new Context { Global = context.Global, Source = context.Source, ParentContext = context, GenericTypeDictionary = genericTypeDictionary };
+            var operatorType = ResolveOperatorType(newContext, operandType, @operator, qualifiedName);
+            var operatorFunction = context.Global.Module.AddFunction(qualifiedName, operatorType.Type.Type);
+            var operatorValue = new TypedValue(@operator.Routine.Result[0].TypeSpec, qualifiedName, operatorFunction);
+            context.Global.Values.Add(qualifiedName, operatorValue);
+            ImplementRoutine(newContext, @operator.Definition.Source, operatorFunction, operatorType, @operator.Routine, @operator.Definition.Type, @operator.Span);
+        }
+
+        static Dictionary<string, TypeSpec> CreateOperatorGenericTypeDictionary(TypeSpec operandTypeSpec, Operator @operator)
+        {
+            if (operandTypeSpec.Arguments == null)
+            {
+                if (@operator.Definition.Type.Arguments != null)
+                    throw new CompilerException($"This operator acts on a generic operand, and a non-generic operand was provided.", @operator.Span);
+                return null;
+            }
+            else
+            {
+                if (@operator.Definition.Type.Arguments == null)
+                    throw new CompilerException($"This operator acts on a non-generic operand, and a generic operand was provided.", @operator.Span);
+
+                if (operandTypeSpec.Arguments.Count != @operator.Definition.Type.Arguments.Count)
+                    throw new CompilerException($"This operator has {@operator.Definition.Type.Arguments.Count} generic type arguments, and the operand has {operandTypeSpec.Arguments.Count}.", @operator.Span);
+
+                var genericTypeDictionary = new Dictionary<string, TypeSpec>();
+                var genericArgumentEnumerator = @operator.Definition.Type.Arguments.GetEnumerator();
+                foreach (var argument in operandTypeSpec.Arguments)
+                {
+                    genericArgumentEnumerator.MoveNext();
+                    var genericArgument = genericArgumentEnumerator.Current;
+                    if (genericTypeDictionary.ContainsKey(genericArgument.Name))
+                        throw new CompilerException($"The generic type argument {genericArgument.Name} was already given.", @operator.Span);
+                    genericTypeDictionary.Add(genericArgument.Name, argument);
+                }
+
+                return genericTypeDictionary;
+            }
+        }
+
+        static FunctionType ResolveOperatorType(Context context, TypeSpec operandType, Operator @operator, string qualifiedName)
+        {
+            if (context.Global.Types.ContainsKey(qualifiedName))
+                return context.Global.FunctionTypes[qualifiedName];
+            var functionType = CreateOperatorType(context, operandType, @operator, qualifiedName);
+            context.Global.FunctionTypes.Add(qualifiedName, functionType);
+            return functionType;
+        }
+
+        static FunctionType CreateOperatorType(Context context, TypeSpec operandTypeSpec, Operator @operator, string qualifiedName)
+        {
+            var operandTypeName = QualifyName(context, operandTypeSpec.Name);
+            {
+                var operatorDefinitionTypeName = QualifyName(context, @operator.Definition.Type.Name);
+                if (operandTypeName != operatorDefinitionTypeName)
+                    throw new CompilerException($"This operator expects a {operatorDefinitionTypeName}, and a {operandTypeName} was provided.", @operator.Span);
+            }
+
+            var operandType = ResolveType(context, operandTypeSpec);
+            var parameterType = new NamedType(operandTypeName, operandType.Type);
+            var returnType = ResolveType(context, @operator.Routine.Result[0].TypeSpec);
+            var functionType = new NamedType(qualifiedName, LLVMTypeRef.CreateFunction(returnType.Type, new LLVMTypeRef[] { parameterType.Type }));
+            return new FunctionType(functionType, new NamedType[] { parameterType }, returnType);
+        }
+
+        static void ImplementRoutine(Context context, Source source, LLVMValueRef functionValue, FunctionType functionType, Routine routine, TypeSpec operatorType, Span span)
         {
             switch (routine.Implementation)
             {
@@ -221,16 +527,20 @@
                                 // function case
                                 foreach (var parameter in routine.Input)
                                 {
-                                    newContext.Values.Add(parameter.Name, new TypedValue(parameter.TypeSpec, functionValue.GetParam(paramCount)));
+                                    newContext.Values.Add(parameter.Name, new TypedValue(parameter.TypeSpec, functionType.Parameters[paramCount].Name, functionValue.GetParam(paramCount)));
                                     paramCount++;
                                 }
                             }
                             else
                             {
                                 // operator case
-                                newContext.Values.Add("this", new TypedValue(operatorType, functionValue.GetParam(0)));
+                                newContext.Values.Add("this", new TypedValue(operatorType, functionType.Result.Name, functionValue.GetParam(0)));
                             }
                             var ret = BuildOperands(newContext, routine.Operation.SourceOperands);
+                            var retName = ret.Name;
+                            var functionResultName = functionType.Result.Name;
+                            //if (ret.Name != functionType.Result.Name)
+                            //    throw new CompilerException($"The returned type {ret.Name} does not match the return type {functionType.Result.Name}", routine.Span);
                             builder.BuildRet(ret.Value);
                         }
                     }
@@ -245,298 +555,6 @@
             }
         }

-        static NamedType ResolveFunctionType(Context context, Function function, string qualifiedName)
-        {
-            if (context.Global.Types.ContainsKey(qualifiedName))
-                return context.Global.Types[qualifiedName];
-            var functionType = new NamedType(qualifiedName, CreateFunctionType(context, qualifiedName, function).Type);
-            context.Global.Types.Add(qualifiedName, functionType);
-            return functionType;
-        }
-
-        static NamedType CreateFunctionType(Context context, string qualifiedName, Function function)
-        {
-            var returnType = GetSingleType(context, function.Routine.Result);
-            var parameterTypes = GetTypes(context, function.Routine.Input);
-            return new NamedType(qualifiedName, LLVMTypeRef.CreateFunction(returnType.Type, parameterTypes.ToList().ConvertAll(it => it.Type).ToArray()));
-        }
-
-        static NamedType GetSingleType(Context context, List<Parameter> result)
-        {
-            if (result == null)
-                return new NamedType("void", LLVMTypeRef.Void);
-
-            return ResolveType(context, result[0].TypeSpec);
-        }
-
-        static NamedType[] GetTypes(Context context, List<Parameter> result)
-        {
-            if (result == null)
-                return new NamedType[] { };
-
-            return result.ConvertAll(it => ResolveType(context, it.TypeSpec)).ToArray();
-        }
-
-        static NamedType ResolveType(Context context, TypeSpec typeSpec)
-        {
-            NamedType type;
-            if (context.GenericTypeDictionary != null && context.GenericTypeDictionary.ContainsKey(typeSpec.Name))
-                typeSpec = context.GenericTypeDictionary[typeSpec.Name];
-            var qualifiedName = QualifyName(context, typeSpec.Name);
-            var typeName = AddTypeArguments(qualifiedName, typeSpec.Arguments);
-            if (context.Global.Types.ContainsKey(typeName))
-                return context.Global.Types[typeName];
-
-            if (typeSpec.Name == "Pointer")
-            {
-                type = GetPointerType(context, typeSpec);
-            }
-            else
-            {
-                var newContext = new Context { Global = context.Global, Source = context.Global.Dictionary.Sources[qualifiedName] };
-                type = CreateType(newContext, qualifiedName, typeSpec);
-            }
-
-            context.Global.Types.Add(typeName, type);
-            return type;
-        }
-
-        static string QualifyName(Context context, string name)
-        {
-            if (context.Global.Types.ContainsKey(name))
-                return name;
-
-            if (context.Global.Dictionary.Definitions.ContainsKey(name))
-                return name;
-
-            if (context.Global.Dictionary.Functions.ContainsKey(name))
-                return name;
-
-            if (context.Global.Dictionary.Operators.ContainsKey(name))
-                return name;
-
-            if (context.Source.Uses != null && context.Source.Uses.ContainsKey(name))
-                return context.Source.Uses[name].Path;
-
-            if (context.Source.Usings != null)
-            {
-                foreach (var @using in context.Source.Usings)
-                {
-                    var usingName = @using.Path;
-
-                    var definition = context.ResolveDefinitionName(usingName, @using.Span);
-                    if (definition.Definitions != null && definition.Definitions.ContainsKey(name))
-                        return usingName + "." + name;
-
-                    if (definition.Operators != null && definition.Operators.ContainsKey(name))
-                        return usingName + "." + name;
-                }
-            }
-
-            return null;
-        }
-
-        static string AddTypeArguments(string name, List<TypeSpec> arguments)
-        {
-            if (arguments == null)
-                return name;
-
-            StringBuilder builder = new StringBuilder(name);
-            builder.Append('[');
-            bool first = true;
-            foreach (var argument in arguments)
-            {
-                if (first)
-                    first = false;
-                else
-                    builder.Append(',');
-                builder.Append(AddTypeArguments(argument.Name, argument.Arguments));
-            }
-            builder.Append(']');
-
-            return builder.ToString();
-        }
-
-        static NamedType CreateType(Context context, string qualifiedName, TypeSpec typeSpec)
-        {
-            var definition = context.ResolveDefinitionName(qualifiedName, typeSpec.Span);
-
-            if (typeSpec.Arguments != null)
-            {
-                if (definition.Type.Arguments != null)
-                {
-                    if (typeSpec.Arguments.Count != definition.Type.Arguments.Count)
-                        throw new CompilerException($"The generic type {qualifiedName} needs {definition.Type.Arguments.Count} type arguments, but {typeSpec.Arguments.Count} type arguments were given.", typeSpec.Span);
-                }
-                else
-                {
-                    throw new CompilerException($"The type {qualifiedName} is not a generic type.", typeSpec.Span);
-                }
-            }
-            else
-            {
-                if (definition.Type.Arguments != null)
-                {
-                    throw new CompilerException($"The type {qualifiedName} is a generic type. Generic arguments are missing.", typeSpec.Span);
-                }
-            }
-
-            return CreateGenericType(context, typeSpec, definition);
-        }
-
-        static NamedType CreateGenericType(Context context, TypeSpec typeSpec, Definition definition)
-        {
-            if (definition.IsIntrinsic)
-                return CreateInstrinsicType(definition.Type.Name, typeSpec.Span);
-
-            if (definition.Structure == null)
-                throw new CompilerException($"The type \"{definition.Type.Name}\" contains no data and can only be used as a namespace.", typeSpec.Span);
-
-            if (definition.Structure.Members.Count == 1 && definition.Structure.Members[0].Name == null && definition.Structure.Members[0].Type.Arguments == null)
-                return ResolveType(context, definition.Structure.Members[0].Type);
-
-            return null;
-        }
-
-        static NamedType CreateInstrinsicType(string name, Span span)
-        {
-            switch (name)
-            {
-                case "i1":
-                    return new NamedType("LLVM.i1", LLVMTypeRef.Int1);
-                case "i8":
-                    return new NamedType("LLVM.i8", LLVMTypeRef.Int8);
-                case "i32":
-                    return new NamedType("LLVM.i32", LLVMTypeRef.Int32);
-                case "i64":
-                    return new NamedType("LLVM.i64", LLVMTypeRef.Int64);
-                default:
-                    throw new CompilerException($"The intrinsic type \"{name}\" is unknown.", span);
-            }
-        }
-
-        static NamedType GetPointerType(Context context, TypeSpec typeSpec)
-        {
-            var qualifiedName = QualifyName(context, typeSpec.Name);
-            var typeName = AddTypeArguments(qualifiedName, typeSpec.Arguments);
-            if (typeSpec.Arguments == null)
-                throw new CompilerException("Pointer is a generic type which expects a type argument.", typeSpec.Span);
-            if (typeSpec.Arguments.Count != 1)
-                throw new CompilerException($"Pointer expects exactly one type argument, not {typeSpec.Arguments.Count}.", typeSpec.Span);
-            var typeArgument = typeSpec.Arguments[0];
-            var pointerTarget = (typeArgument.Name == "Pointer") ? GetPointerType(context, typeArgument) : ResolveType(context, typeArgument);
-            return new NamedType(typeName, LLVMTypeRef.CreatePointer(pointerTarget.Type, 0));
-        }
-
-        static TypedValue ResolveOperatorValue(Context context, TypeSpec operandType, Operator @operator)
-        {
-            var qualifiedName = QualifyOperatorName(context, operandType, @operator);
-            if (!context.Global.Values.ContainsKey(qualifiedName))
-                CreateOperatorValue(context, operandType, @operator, qualifiedName);
-            var llvmFunction = context.Global.Values[qualifiedName];
-            return llvmFunction;
-        }
-
-        static string QualifyOperatorName(Context context, TypeSpec operandType, Operator @operator)
-        {
-            var operatorNameBuilder = new StringBuilder();
-
-            operatorNameBuilder.Append(QualifyName(context, @operator.Definition.Type.Name));
-            operatorNameBuilder.Append('.');
-            operatorNameBuilder.Append(@operator.Name);
-            operatorNameBuilder.Append('[');
-            AppendGenericArguments(context, operatorNameBuilder, operandType, @operator.Span);
-            operatorNameBuilder.Append(']');
-            return operatorNameBuilder.ToString();
-        }
-
-        static void AppendGenericArguments(Context context, StringBuilder builder, TypeSpec operandType, Span span)
-        {
-            builder.Append(QualifyName(context, operandType.Name));
-            if (operandType.Arguments != null)
-            {
-                builder.Append('[');
-                bool first = true;
-                foreach (var type in operandType.Arguments)
-                {
-                    if (first)
-                        first = false;
-                    else
-                        builder.Append(',');
-                    AppendGenericArguments(context, builder, type, span);
-                }
-                builder.Append(']');
-            }
-        }
-
-        static void CreateOperatorValue(Context context, TypeSpec operandType, Operator @operator, string qualifiedName)
-        {
-            Dictionary<string, TypeSpec> genericTypeDictionary = CreateOperatorGenericTypeDictionary(operandType, @operator);
-            var newContext = new Context { Global = context.Global, Source = context.Source, ParentContext = context, GenericTypeDictionary = genericTypeDictionary };
-            var operatorType = ResolveOperatorType(newContext, operandType, @operator, qualifiedName);
-            var operatorFunction = context.Global.Module.AddFunction(qualifiedName, operatorType.Type);
-            var operatorValue = new TypedValue(@operator.Routine.Result[0].TypeSpec, operatorFunction);
-            context.Global.Values.Add(qualifiedName, operatorValue);
-            ImplementRoutine(newContext, @operator.Definition.Source, operatorFunction, @operator.Routine, @operator.Definition.Type, @operator.Span);
-        }
-
-        static Dictionary<string, TypeSpec> CreateOperatorGenericTypeDictionary(TypeSpec operandTypeSpec, Operator @operator)
-        {
-            if (operandTypeSpec.Arguments == null)
-            {
-                if (@operator.Definition.Type.Arguments != null)
-                    throw new CompilerException($"This operator acts on a generic operand, and a non-generic operand was provided.", @operator.Span);
-                return null;
-            }
-            else
-            {
-                if (@operator.Definition.Type.Arguments == null)
-                    throw new CompilerException($"This operator acts on a non-generic operand, and a generic operand was provided.", @operator.Span);
-
-                if (operandTypeSpec.Arguments.Count != @operator.Definition.Type.Arguments.Count)
-                    throw new CompilerException($"This operator has {@operator.Definition.Type.Arguments.Count} generic type arguments, and the operand has {operandTypeSpec.Arguments.Count}.", @operator.Span);
-
-                var genericTypeDictionary = new Dictionary<string, TypeSpec>();
-                var genericArgumentEnumerator = @operator.Definition.Type.Arguments.GetEnumerator();
-                foreach (var argument in operandTypeSpec.Arguments)
-                {
-                    genericArgumentEnumerator.MoveNext();
-                    var genericArgument = genericArgumentEnumerator.Current;
-                    if (genericTypeDictionary.ContainsKey(genericArgument.Name))
-                        throw new CompilerException($"The generic type argument {genericArgument.Name} was already given.", @operator.Span);
-                    genericTypeDictionary.Add(genericArgument.Name, argument);
-                }
-
-                return genericTypeDictionary;
-            }
-        }
-
-        static NamedType ResolveOperatorType(Context context, TypeSpec operandType, Operator @operator, string qualifiedName)
-        {
-            if (context.Global.Types.ContainsKey(qualifiedName))
-                return context.Global.Types[qualifiedName];
-            var operatorFunctionType = CreateOperatorType(context, operandType, @operator, qualifiedName);
-            var namedType = new NamedType(qualifiedName, operatorFunctionType.Type);
-            context.Global.Types.Add(qualifiedName, namedType);
-            return namedType;
-        }
-
-        static NamedType CreateOperatorType(Context context, TypeSpec operandTypeSpec, Operator @operator, string qualifiedName)
-        {
-            {
-                var operandTypeName = QualifyName(context, operandTypeSpec.Name);
-                var operatorDefinitionTypeName = QualifyName(context, @operator.Definition.Type.Name);
-                if (operandTypeName != operatorDefinitionTypeName)
-                    throw new CompilerException($"This operator expects a {operatorDefinitionTypeName}, and a {operandTypeName} was provided.", @operator.Span);
-            }
-
-            var operandType = ResolveType(context, operandTypeSpec);
-            var parameterTypes = new LLVMTypeRef[] { operandType.Type };
-            var returnType = ResolveType(context, @operator.Routine.Result[0].TypeSpec);
-            LLVMTypeRef operatorFunctionType = LLVMTypeRef.CreateFunction(returnType.Type, parameterTypes.ToArray());
-            return new NamedType(qualifiedName, operatorFunctionType);
-        }
-
         static TypedValue BuildOperands(Context context, List<Operand> operands)
         {
             var newContext = new Context { Global = context.Global, Source = context.Source, Builder = context.Builder, Operands = operands.GetEnumerator(), TypedValue = null, GenericTypeDictionary = context.GenericTypeDictionary, ParentContext = context };
@@ -552,10 +570,10 @@
                 switch (operand.Expression)
                 {
                     case IntegerConstant integerConstant:
-                        context.TypedValue = new TypedValue(context.Global.Dictionary.Definitions["Integer"].Type, LLVMValueRef.CreateConstInt(LLVMTypeRef.Int32, (ulong)integerConstant.Value));
+                        context.TypedValue = new TypedValue(context.Global.Dictionary.Definitions["Integer"].Type, "Integer", LLVMValueRef.CreateConstInt(LLVMTypeRef.Int32, (ulong)integerConstant.Value));
                         break;
                     case BooleanConstant booleanConstant:
-                        context.TypedValue = new TypedValue(context.Global.Dictionary.Definitions["Boolean"].Type, LLVMValueRef.CreateConstInt(LLVMTypeRef.Int1, booleanConstant.Value ? 1UL : 0UL));
+                        context.TypedValue = new TypedValue(context.Global.Dictionary.Definitions["Boolean"].Type, "Boolean", LLVMValueRef.CreateConstInt(LLVMTypeRef.Int1, booleanConstant.Value ? 1UL : 0UL));
                         break;
                     case Name name:
                         BuildName(context, name);
@@ -566,7 +584,7 @@
                     case Tuple tuple:
                         if (context.TypedValue == null)
                             throw new CompilerException("Objects are currently only supported as parameter lists for function calls.", tuple.Span);
-                        context.TypedValue = BuildFunctionCall(context, context.TypedValue, tuple);
+                        context.TypedValue = BuildFunctionCall(context, context.TypedValue, context.Global.FunctionTypes[context.TypedValue.Name], tuple);
                         break;
                     case If @if:
                         BuildIf(context, @if);
@@ -605,7 +623,7 @@
                 if (context.TypedValue == null)
                     throw new CompilerException("An operator cannot act on nothing. It must follow an operand it can act upon.", @operator.Span);
                 var operatorValue = ResolveOperatorValue(context, context.TypedValue.TypeSpec, @operator);
-                BuildOperatorCall(context, operatorValue, context.TypedValue);
+                BuildOperatorCall(context, operatorValue, context.Global.FunctionTypes[operatorValue.Name], context.TypedValue);
                 return;
             }

@@ -627,7 +645,7 @@
                                     valueRef = ResolveFunctionValue(context, function);
                                     if (valueRef == null)
                                         throw new CompilerException("No matching function has been found for the arguments.", tuple.Span);
-                                    context.TypedValue = BuildFunctionCall(context, valueRef, tuple);
+                                    context.TypedValue = BuildFunctionCall(context, valueRef, context.Global.FunctionTypes[valueRef.Name], tuple);
                                     return;
                                 case Implementation.Instruction:
                                     context.TypedValue = BuildInstruction(context, null, function);
@@ -651,7 +669,7 @@
                                         valueRef = ResolveFunctionValue(context, function);
                                         if (valueRef == null)
                                             throw new CompilerException("No matching function has been found for the arguments.", tuple.Span);
-                                        context.TypedValue = BuildFunctionCall(context, valueRef, tuple);
+                                        context.TypedValue = BuildFunctionCall(context, valueRef, context.Global.FunctionTypes[valueRef.Name], tuple);
                                         return;
                                     case Implementation.Instruction:
                                         context.TypedValue = BuildInstruction(context, vector, function);
@@ -690,22 +708,24 @@
                         var genericType = function.Routine.Result[0].TypeSpec;
                         if (!context.GenericTypeDictionary.ContainsKey(genericType.Name))
                             throw new CompilerException($"The generic type {genericType.Name} is not defined here.", function.Span);
-                        return new TypedValue(context.GenericTypeDictionary[genericType.Name], context.Builder.BuildLoad(context.ResolveValue("this").Value));
+                        return new TypedValue(context.GenericTypeDictionary[genericType.Name], genericType.Name, context.Builder.BuildLoad(context.ResolveValue("this").Value));
                     }
                 case "trunc":
                     {
                         if (vector == null || vector.Components == null || vector.Components.Count != 1 || vector.Components == null || vector.Components[0].Count != 1)
                             throw new CompilerException($"The {function.Name} instruction needs one generic argument.", function.Span);
+                        TypeSpec destinationType;
+                        string destinationName;
                         LLVMTypeRef destinationTypeRef;
-                        TypeSpec destinationType;
                         switch (vector.Components[0][0].Expression)
                         {
                             case Name name:
-                                var destinationName = QualifyName(context, name.Path);
+                                destinationName = QualifyName(context, name.Path);
                                 switch (destinationName)
                                 {
                                     case "LLVM.i32":
                                         destinationTypeRef = context.Global.Types[destinationName].Type;
+                                        destinationName = "Integer";
                                         destinationType = context.Global.Dictionary.Definitions[destinationName].Type;
                                         break;
                                     default:
@@ -715,22 +735,24 @@
                             default:
                                 throw new CompilerException($"The {function.Name} instruction needs a literal generic argument.", function.Span);
                         }
-                        return new TypedValue(destinationType, context.Builder.BuildTrunc(context.ResolveValue("this").Value, destinationTypeRef));
+                        return new TypedValue(destinationType, destinationName, context.Builder.BuildTrunc(context.ResolveValue("this").Value, destinationTypeRef));
                     }
                 case "zext":
                     {
                         if (vector == null || vector.Components == null || vector.Components.Count != 1 || vector.Components == null || vector.Components[0].Count != 1)
                             throw new CompilerException($"The {function.Name} instruction needs one generic argument.", function.Span);
                         LLVMTypeRef destinationTypeRef;
+                        string destinationName;
                         TypeSpec destinationType;
                         switch (vector.Components[0][0].Expression)
                         {
                             case Name name:
-                                var destinationName = QualifyName(context, name.Path);
+                                destinationName = QualifyName(context, name.Path);
                                 switch (destinationName)
                                 {
                                     case "LLVM.i32":
                                         destinationTypeRef = context.Global.Types[destinationName].Type;
+                                        destinationName = "Integer";
                                         destinationType = context.Global.Dictionary.Definitions[destinationName].Type;
                                         break;
                                     default:
@@ -740,7 +762,7 @@
                             default:
                                 throw new CompilerException($"The {function.Name} instruction needs a literal generic argument.", function.Span);
                         }
-                        return new TypedValue(destinationType, context.Builder.BuildZExt(context.ResolveValue("this").Value, destinationTypeRef));
+                        return new TypedValue(destinationType, destinationName, context.Builder.BuildZExt(context.ResolveValue("this").Value, destinationTypeRef));
                     }
                 default:
                     throw new CompilerException($"The instruction {function.Name} is not implemented.", function.Span);
@@ -780,7 +802,7 @@
         {
         }

-        static TypedValue BuildFunctionCall(Context context, TypedValue function, Tuple tuple)
+        static TypedValue BuildFunctionCall(Context context, TypedValue function, FunctionType functionType, Tuple tuple)
         {
             var arguments = new List<LLVMValueRef>();
             foreach (var component in tuple.Components)
@@ -789,12 +811,12 @@
                 arguments.Add(context.TypedValue.Value);
             }

-            return new TypedValue(function.TypeSpec, context.Builder.BuildCall(function.Value, arguments.ToArray()));
-        }
-
-        static void BuildOperatorCall(Context context, TypedValue @operator, TypedValue operand)
-        {
-            context.TypedValue = new TypedValue(@operator.TypeSpec, context.Builder.BuildCall(@operator.Value, new LLVMValueRef[] { operand.Value }));
+            return new TypedValue(function.TypeSpec, functionType.Result.Name, context.Builder.BuildCall(function.Value, arguments.ToArray()));
+        }
+
+        static void BuildOperatorCall(Context context, TypedValue @operator, FunctionType functionType, TypedValue operand)
+        {
+            context.TypedValue = new TypedValue(@operator.TypeSpec, functionType.Result.Name, context.Builder.BuildCall(@operator.Value, new LLVMValueRef[] { operand.Value }));
         }

         static void CreateSourceDictionary(DictionaryContext context)


Upper cased MakeSymbol SIDC input

Upper cased MakeSymbol SIDC input

--- source/JointMilitarySymbologyLibraryCS/librarian.cs
+++ source/JointMilitarySymbologyLibraryCS/librarian.cs
@@ -1423,7 +1423,10 @@

             if (legacySIDC.Length == 15)
             {
+                legacyStandard = legacyStandard.ToUpper();
+
                 legacySIDC = legacySIDC.Replace('*', '-');
+                legacySIDC = legacySIDC.ToUpper();

                 s = new Symbol(this, legacyStandard, legacySIDC, _drawColoredOCABars);


Add testcase

Add testcase

--- osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs
+++ osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs
@@ -10,6 +10,7 @@
 using osu.Framework.Graphics.Shapes;
 using osu.Framework.MathUtils;
 using osu.Game.Graphics;
+using osu.Game.Online.API.Requests.Responses;
 using osu.Game.Overlays.BeatmapSet.Scores;
 using osu.Game.Rulesets.Mods;
 using osu.Game.Rulesets.Osu.Mods;
@@ -165,6 +166,29 @@
                 },
             };

+            var myBestScore = new APILegacyUserTopScoreInfo
+            {
+                Score = new APILegacyScoreInfo
+                {
+                    User = new User
+                    {
+                        Id = 7151382,
+                        Username = @"Mayuri Hana",
+                        Country = new Country
+                        {
+                            FullName = @"Thailand",
+                            FlagName = @"TH",
+                        },
+                    },
+                    Rank = ScoreRank.D,
+                    PP = 160,
+                    MaxCombo = 1234,
+                    TotalScore = 123456,
+                    Accuracy = 0.6543,
+                },
+                Position = 1337,
+            };
+
             foreach (var s in scores)
             {
                 s.Statistics.Add(HitResult.Great, RNG.Next(2000));
@@ -173,9 +197,18 @@
                 s.Statistics.Add(HitResult.Miss, RNG.Next(2000));
             }

-            AddStep("Load all scores", () => scoresContainer.Scores = scores);
-            AddStep("Load null scores", () => scoresContainer.Scores = null);
+            AddStep("Load all scores", () =>
+            {
+                scoresContainer.Scores = scores;
+                scoresContainer.UserScore = myBestScore;
+            });
+            AddStep("Load null scores", () =>
+            {
+                scoresContainer.Scores = null;
+                scoresContainer.UserScore = null;
+            });
             AddStep("Load only one score", () => scoresContainer.Scores = new[] { scores.First() });
+            AddStep("Add my best score", () => scoresContainer.UserScore = myBestScore);
         }

         [BackgroundDependencyLoader]


Update MetroGrid.cs

Update MetroGrid.cs

--- MetroFramework/Controls/MetroGrid.cs
+++ MetroFramework/Controls/MetroGrid.cs
@@ -329,13 +329,37 @@
             }
             else
             {
-                if (_scrollbar.Value >= 0 && _scrollbar.Value < _grid.Rows.Count)
-                {
-                    _grid.FirstDisplayedScrollingRowIndex = _scrollbar.Value + (_scrollbar.Value == 1 ? -1 : 1) >= _grid.Rows.Count ? _grid.Rows.Count - 1 : _scrollbar.Value + (_scrollbar.Value == 1 ? -1 : 1);
-                }  else
-                {
-                    _grid.FirstDisplayedScrollingRowIndex = _scrollbar.Value -1;
-                }
+
+                try
+                {
+                    int firstDisplayedRowIndex = 0;
+
+                    if (_scrollbar.Value >= 0 && _scrollbar.Value < _grid.Rows.Count)
+                    {
+                        firstDisplayedRowIndex = _scrollbar.Value + (_scrollbar.Value == 1 ? -1 : 1) >= _grid.Rows.Count ? _grid.Rows.Count - 1 : _scrollbar.Value + (_scrollbar.Value == 1 ? -1 : 1);
+                    }  else
+                    {
+                        firstDisplayedRowIndex = _scrollbar.Value -1;
+                    }
+
+                    while (! _grid.Rows[firstDisplayedRowIndex].Visible)
+	                {
+	                    if (firstDisplayedRowIndex<1)
+                        {
+                            firstDisplayedRowIndex=0;
+                        } else
+                        {
+                            firstDisplayedRowIndex -=1;
+                        }
+	                }
+
+                    _grid.FirstDisplayedScrollingRowIndex = firstDisplayedRowIndex;
+                }
+                catch (Exception)
+                {
+                    _grid.FirstDisplayedScrollingRowIndex = 0;
+                }
+
             }

             _grid.Invalidate();


Add failing test coverage of incorrect current section after quick setting search

--- osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs
+++ osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs
@@ -54,6 +54,8 @@
                                                                                .Where(f => !(f is IHasFilterableChildren))
                                                                                .All(f => f.FilterTerms.Any(t => t.Contains("scaling")))
                                                                      ));
+
+            AddAssert("ensure section is current", () => settings.CurrentSection.Value != null);
         }

         [Test]


Fix hitobjects not updating IsMaskedAway after being judged

--- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
+++ osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
@@ -7,7 +7,6 @@
 using osu.Framework.Allocation;
 using osu.Framework.Configuration;
 using osu.Framework.Extensions.TypeExtensions;
-using osu.Framework.Graphics;
 using osu.Framework.Graphics.Primitives;
 using osu.Game.Audio;
 using osu.Game.Graphics;
@@ -167,13 +166,7 @@
             }
         }

-        public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds)
-        {
-            if (!AllJudged)
-                return false;
-
-            return base.UpdateSubTreeMasking(source, maskingBounds);
-        }
+        protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => AllJudged && base.ComputeIsMaskedAway(maskingBounds);

         protected override void UpdateAfterChildren()
         {


adds: indexLanguages settings properties

fix #636

[changelog]

--- src/Algolia.Search/Models/Settings/IndexSettings.cs
+++ src/Algolia.Search/Models/Settings/IndexSettings.cs
@@ -196,6 +196,11 @@
         /// </summary>
         public List<string> QueryLanguages { get; set; }

+        /// <summary>
+        /// A list of language ISO code
+        /// </summary>
+        public List<string> IndexLanguages { get; set; }
+
         // query rules

         /// <summary>


sample: Update description of DemoDrawingArea GtkDemo sample

--- sample/GtkDemo/DemoDrawingArea.cs
+++ sample/GtkDemo/DemoDrawingArea.cs
@@ -5,7 +5,7 @@
  *
  * This demo has two drawing areas. The checkerboard area shows
  * how you can just draw something; all you have to do is write
- * a signal handler for ExposeEvent, as shown here.
+ * a signal handler for the Drawn event, as shown here.
  *
  * The "scribble" area is a bit more advanced, and shows how to handle
  * events such as button presses and mouse motion. Click the mouse


BL-5736 Small tweak to language searching

--- src/BloomExe/Collection/CollectionSettingsDialog.cs
+++ src/BloomExe/Collection/CollectionSettingsDialog.cs
@@ -152,7 +152,7 @@
 			ChangeThatRequiresRestart();
 		}

-		private LanguageInfo ChangeLanguage(string iso639Code, string potentiallyCustomName=null)
+		private static LanguageInfo ChangeLanguage(string languageIdentifier, string potentiallyCustomName=null)
 		{
 			using (var dlg = new LanguageLookupDialog())
 			{
@@ -161,13 +161,15 @@
 				dlg.IsShowRegionalDialectsCheckBoxVisible = true;
 				dlg.IsScriptAndVariantLinkVisible = true;

-				var language = new LanguageInfo() { LanguageTag = iso639Code};
+				var language = new LanguageInfo() { LanguageTag = languageIdentifier};
 				if (!string.IsNullOrEmpty(potentiallyCustomName))
 				{
 					language.DesiredName = potentiallyCustomName; // to be noticed, must set before dlg.SelectedLanguage
 				}
 				dlg.SelectedLanguage = language;
-				dlg.SearchText = iso639Code;
+				// if languageIdentifier includes Script/Region/Variant codes... which it might now...
+				// limit the SearchText to the part before the first hyphen (the iso 639 code).
+				dlg.SearchText = languageIdentifier.Split('-')[0];

 				// Following should be consistent with LanguageIdControl constructor.
 				dlg.UseSimplifiedChinese();


Cleaning up MapHelper again. Thanks Jared.

--- Template10/Services/MapService/MapHelper.cs
+++ Template10/Services/MapService/MapHelper.cs
@@ -71,9 +71,9 @@
         /// <param name="user"></param>
         /// <param name="size"></param>
         /// <returns></returns>
-        public Uri GetMapUrl(IEnumerable<StaticMapPushpin> items, StaticMapPushpin user, StaticMapPushpin center, Nullable<Size> size, int? zoom = null, StaticMapImagerySets imagery = StaticMapImagerySets.Road)
-        {
-            if (size == null)
+        public Uri GetMapUrl(IEnumerable<StaticMapPushpin> items, StaticMapPushpin user, StaticMapPushpin center, Size size, int? zoom = null, StaticMapImagerySets imagery = StaticMapImagerySets.Road)
+        {
+            if (size == default(Size))
                 throw new ArgumentNullException("size");

             var _Builder = new StringBuilder();
@@ -84,8 +84,11 @@
             var _Size = string.Format("&mapSize={0},{1}", size.Width, size.Height);
             _Builder.Append(_Size);

-            var _Zoom = string.Format("&zoomLevel={0}", zoom);
-            _Builder.Append(_Zoom);
+            if (zoom != null)
+            {
+                var _Zoom = string.Format("&zoomLevel={0}", zoom);
+                _Builder.Append(_Zoom);
+            }

             // optional is okay
             if (center != null)
@@ -167,34 +170,34 @@
         // helper method
         private static async Task<RootObject> CallService(Uri uri)
         {
-            string _JsonString = string.Empty;
+            string jsonString = string.Empty;
             try
             {
                 // fetch from rest service
-                var _HttpClient = new System.Net.Http.HttpClient();
-                var _HttpResponse = await _HttpClient.GetAsync(uri.ToString());
-                _JsonString = await _HttpResponse.Content.ReadAsStringAsync();
+                var httpClient = new System.Net.Http.HttpClient();
+                var httpResponse = await httpClient.GetAsync(uri.ToString());
+                jsonString = await httpResponse.Content.ReadAsStringAsync();

                 // check for error
-                if (!_JsonString.Contains("\"statusCode\":200"))
-                    throw new InvalidStatusCodeException { JSON = _JsonString };
-                if (_JsonString.Contains("InvalidCredentials")
-                    || _JsonString.Contains("CredentialsExpired")
-                    || _JsonString.Contains("NotAuthorized")
-                    || _JsonString.Contains("NoCredentials"))
-                    throw new InvalidCredentialsException { JSON = _JsonString };
+                if (!jsonString.Contains("\"statusCode\":200"))
+                    throw new InvalidStatusCodeException { JSON = jsonString };
+                if (jsonString.Contains("InvalidCredentials")
+                    || jsonString.Contains("CredentialsExpired")
+                    || jsonString.Contains("NotAuthorized")
+                    || jsonString.Contains("NoCredentials"))
+                    throw new InvalidCredentialsException { JSON = jsonString };

                 // deserialize json to objects
-                var _JsonBytes = Encoding.Unicode.GetBytes(_JsonString);
-                using (MemoryStream _MemoryStream = new MemoryStream(_JsonBytes))
+                var jsonBytes = Encoding.Unicode.GetBytes(jsonString);
+                using (MemoryStream _MemoryStream = new MemoryStream(jsonBytes))
                 {
-                    var _JsonSerializer = new DataContractJsonSerializer(typeof(RootObject));
-                    var _Result = (RootObject)_JsonSerializer.ReadObject(_MemoryStream);
-                    return _Result;
+                    var jsonSerializer = new DataContractJsonSerializer(typeof(RootObject));
+                    var result = (RootObject)jsonSerializer.ReadObject(_MemoryStream);
+                    return result;
                 }
             }
             catch (InvalidSomethingException) { throw; }
-            catch (Exception e) { throw new InvalidSomethingException(e) { JSON = _JsonString }; }
+            catch (Exception e) { throw new InvalidSomethingException(e) { JSON = jsonString }; }
         }

         public class InvalidSomethingException : Exception


AssertDistributionRule: Handle multiple instructions with sequence points that refer to the same line.

--- TestNess.Lib/Rule/AssertDistributionRule.cs
+++ TestNess.Lib/Rule/AssertDistributionRule.cs
@@ -19,8 +19,12 @@

             var assertingMethods = testCase.GetCalledAssertingMethods();

-            var sequencePointCount = 0;
-            var assertingSequencePoints = new List<int>();
+            // Note: The Mono compiler appears to emit multiple sequence points with the same start line,
+            // i.e. so there are multiple instructions with sequence points that refer to the same line.
+            // Therefore, let's store line numbers and associate line numbers with asserting calls.
+
+            var sequencePointsStartLines = new SortedSet<int>();
+            var assertingSequencePointsStartLines = new SortedSet<int>();

             var tm = testCase.TestMethod;
             foreach (var ins in tm.Body.Instructions)
@@ -28,18 +32,21 @@
                 var sp = ins.SequencePoint;
                 if (sp != null && IsSignificantSequencePoint(ins, sp))
                 {
-                    sequencePointCount++;
+                    sequencePointsStartLines.Add(sp.StartLine);
                 }
-                if (sequencePointCount > 0 && IsAssertCall(ins, assertingMethods))
+                if (sequencePointsStartLines.Count > 0 && IsAssertCall(ins, assertingMethods))
                 {
-                    assertingSequencePoints.Add(sequencePointCount - 1);
+                    // As sequence point, use the last one added, which isn't necessarily sp,
+                    // since the asserting instruction may lack sequence point.
+                    var lastSpLineNumber = sequencePointsStartLines.Last();
+                    assertingSequencePointsStartLines.Add(lastSpLineNumber);
                 }
             }

-            if (assertingSequencePoints.Count == 0)
+            if (assertingSequencePointsStartLines.Count == 0)
                 yield break; // this rule doesn't apply
             // If the X asserting sps are the X last ones, then it's ok!
-            if (assertingSequencePoints[0] + assertingSequencePoints.Count == sequencePointCount)
+            if (assertingSequencePointsStartLines.First() + assertingSequencePointsStartLines.Count == sequencePointsStartLines.Count)
                 yield break;
             yield return new Violation(this, testCase);
         }


修改日志文本

修改日志文本

--- src/ENode/Commanding/Impl/DefaultCommandExecutor.cs
+++ src/ENode/Commanding/Impl/DefaultCommandExecutor.cs
@@ -86,7 +86,7 @@
             try
             {
                 commandHandler.Handle(processingCommand.CommandExecuteContext, command);
-                _logger.DebugFormat("Command was handled. handlerType:{0}, commandType:{1}, commandId:{2}, aggregateRootId:{3}",
+                _logger.DebugFormat("Handle command success. handlerType:{0}, commandType:{1}, commandId:{2}, aggregateRootId:{3}",
                     commandHandler.GetInnerHandler().GetType().Name,
                     command.GetType().Name,
                     command.Id,


Open Browser (more services added)

Open Browser (more services added)

Fixed #41 earningwhispers
Fixed #40 zacks

--- Tools/Indicator/OpenBrowser_Utility_Tool.cs
+++ Tools/Indicator/OpenBrowser_Utility_Tool.cs
@@ -12,7 +12,7 @@
 using AgenaTrader.Helper;

 /// <summary>
-/// Version: 1.1.2
+/// Version: 1.1.3
 /// -------------------------------------------------------------------------
 /// Simon Pucher 2016
 /// -------------------------------------------------------------------------
@@ -36,7 +36,9 @@
         private bool _opengooglefinance = true;
         private bool _openmorningstar = true;
         private bool _openyahoofinance = true;
-
+        private bool _openearningswhispers = true;
+        private bool _openzacks = true;
+

         #endregion

@@ -158,6 +160,17 @@
                     GUIHelper.OpenInBrowser("https://finance.yahoo.com/quote/" + symbol);
                 }

+                if (this.OpenEarningswhispers)
+                {
+                    GUIHelper.OpenInBrowser("https://earningswhispers.com/stocks/" + symbol);
+                }
+
+                if (this.OpenZacks)
+                {
+                    GUIHelper.OpenInBrowser("https://www.zacks.com/search.php?q=" + Name);
+                }
+
+
             }
             else
             {
@@ -190,7 +203,9 @@

         #region Input

-        [Description("Opens Yahoo Finance with the current symbol displayed in the chart")]
+
+
+    [Description("Opens Yahoo Finance with the current symbol displayed in the chart")]
         [Category("Parameters")]
         [DisplayName("Yahoo Finance")]
         public bool OpenYahooFinance
@@ -217,6 +232,24 @@
             set { _openmorningstar = value; }
         }

+        [Description("Opens Earnings whispers with the current symbol displayed in the chart")]
+        [Category("Parameters")]
+        [DisplayName("Earnings whispers")]
+        public bool OpenEarningswhispers
+        {
+            get { return _openearningswhispers; }
+            set { _openearningswhispers = value; }
+        }
+
+
+  [Description("Opens Zacks with the current symbol displayed in the chart")]
+        [Category("Parameters")]
+        [DisplayName("Zacks")]
+        public bool OpenZacks
+        {
+            get { return _openzacks; }
+            set { _openzacks = value; }
+        }

         private Color _col_positive = Color.Green;
         /// <summary>
@@ -280,17 +313,17 @@
 		/// <summary>
 		/// Opens web browser by clicking on the chart.
 		/// </summary>
-		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar)
-        {
-			return OpenBrowser_Utility_Tool(Input, openYahooFinance, openGoogleFinance, openMorningstar);
-		}
-
-		/// <summary>
-		/// Opens web browser by clicking on the chart.
-		/// </summary>
-		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(IDataSeries input, System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar)
-		{
-			var indicator = CachedCalculationUnits.GetCachedIndicator<OpenBrowser_Utility_Tool>(input, i => i.OpenYahooFinance == openYahooFinance && i.OpenGoogleFinance == openGoogleFinance && i.OpenMorningstar == openMorningstar);
+		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar, System.Boolean openEarningswhispers, System.Boolean openZacks)
+        {
+			return OpenBrowser_Utility_Tool(Input, openYahooFinance, openGoogleFinance, openMorningstar, openEarningswhispers, openZacks);
+		}
+
+		/// <summary>
+		/// Opens web browser by clicking on the chart.
+		/// </summary>
+		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(IDataSeries input, System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar, System.Boolean openEarningswhispers, System.Boolean openZacks)
+		{
+			var indicator = CachedCalculationUnits.GetCachedIndicator<OpenBrowser_Utility_Tool>(input, i => i.OpenYahooFinance == openYahooFinance && i.OpenGoogleFinance == openGoogleFinance && i.OpenMorningstar == openMorningstar && i.OpenEarningswhispers == openEarningswhispers && i.OpenZacks == openZacks);

 			if (indicator != null)
 				return indicator;
@@ -302,7 +335,9 @@
 							Input = input,
 							OpenYahooFinance = openYahooFinance,
 							OpenGoogleFinance = openGoogleFinance,
-							OpenMorningstar = openMorningstar
+							OpenMorningstar = openMorningstar,
+							OpenEarningswhispers = openEarningswhispers,
+							OpenZacks = openZacks
 						};
 			indicator.SetUp();

@@ -321,20 +356,20 @@
 		/// <summary>
 		/// Opens web browser by clicking on the chart.
 		/// </summary>
-		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar)
-		{
-			return LeadIndicator.OpenBrowser_Utility_Tool(Input, openYahooFinance, openGoogleFinance, openMorningstar);
-		}
-
-		/// <summary>
-		/// Opens web browser by clicking on the chart.
-		/// </summary>
-		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(IDataSeries input, System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar)
+		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar, System.Boolean openEarningswhispers, System.Boolean openZacks)
+		{
+			return LeadIndicator.OpenBrowser_Utility_Tool(Input, openYahooFinance, openGoogleFinance, openMorningstar, openEarningswhispers, openZacks);
+		}
+
+		/// <summary>
+		/// Opens web browser by clicking on the chart.
+		/// </summary>
+		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(IDataSeries input, System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar, System.Boolean openEarningswhispers, System.Boolean openZacks)
 		{
 			if (InInitialize && input == null)
 				throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

-			return LeadIndicator.OpenBrowser_Utility_Tool(input, openYahooFinance, openGoogleFinance, openMorningstar);
+			return LeadIndicator.OpenBrowser_Utility_Tool(input, openYahooFinance, openGoogleFinance, openMorningstar, openEarningswhispers, openZacks);
 		}
 	}

@@ -347,17 +382,17 @@
 		/// <summary>
 		/// Opens web browser by clicking on the chart.
 		/// </summary>
-		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar)
-		{
-			return LeadIndicator.OpenBrowser_Utility_Tool(Input, openYahooFinance, openGoogleFinance, openMorningstar);
-		}
-
-		/// <summary>
-		/// Opens web browser by clicking on the chart.
-		/// </summary>
-		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(IDataSeries input, System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar)
-		{
-			return LeadIndicator.OpenBrowser_Utility_Tool(input, openYahooFinance, openGoogleFinance, openMorningstar);
+		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar, System.Boolean openEarningswhispers, System.Boolean openZacks)
+		{
+			return LeadIndicator.OpenBrowser_Utility_Tool(Input, openYahooFinance, openGoogleFinance, openMorningstar, openEarningswhispers, openZacks);
+		}
+
+		/// <summary>
+		/// Opens web browser by clicking on the chart.
+		/// </summary>
+		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(IDataSeries input, System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar, System.Boolean openEarningswhispers, System.Boolean openZacks)
+		{
+			return LeadIndicator.OpenBrowser_Utility_Tool(input, openYahooFinance, openGoogleFinance, openMorningstar, openEarningswhispers, openZacks);
 		}
 	}

@@ -370,17 +405,17 @@
 		/// <summary>
 		/// Opens web browser by clicking on the chart.
 		/// </summary>
-		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar)
-		{
-			return LeadIndicator.OpenBrowser_Utility_Tool(Input, openYahooFinance, openGoogleFinance, openMorningstar);
-		}
-
-		/// <summary>
-		/// Opens web browser by clicking on the chart.
-		/// </summary>
-		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(IDataSeries input, System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar)
-		{
-			return LeadIndicator.OpenBrowser_Utility_Tool(input, openYahooFinance, openGoogleFinance, openMorningstar);
+		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar, System.Boolean openEarningswhispers, System.Boolean openZacks)
+		{
+			return LeadIndicator.OpenBrowser_Utility_Tool(Input, openYahooFinance, openGoogleFinance, openMorningstar, openEarningswhispers, openZacks);
+		}
+
+		/// <summary>
+		/// Opens web browser by clicking on the chart.
+		/// </summary>
+		public OpenBrowser_Utility_Tool OpenBrowser_Utility_Tool(IDataSeries input, System.Boolean openYahooFinance, System.Boolean openGoogleFinance, System.Boolean openMorningstar, System.Boolean openEarningswhispers, System.Boolean openZacks)
+		{
+			return LeadIndicator.OpenBrowser_Utility_Tool(input, openYahooFinance, openGoogleFinance, openMorningstar, openEarningswhispers, openZacks);
 		}
 	}


Fixed a race condition in gathering process output, the right way by calling Process.WaitForExit with no timeout.  Removed the previous hack.

--- src/Gallio/Gallio/Common/Concurrency/ProcessTask.cs
+++ src/Gallio/Gallio/Common/Concurrency/ProcessTask.cs
@@ -15,7 +15,6 @@

 using System;
 using System.Collections.Generic;
-using System.Collections.Specialized;
 using System.Diagnostics;
 using System.IO;
 using System.Runtime.InteropServices;
@@ -38,8 +37,6 @@
     /// </remarks>
     public class ProcessTask : Task
     {
-        private readonly TimeSpan WaitForFinalIOTimeout = TimeSpan.FromMilliseconds(500);
-
         private readonly string executablePath;
         private readonly string arguments;
         private readonly string workingDirectory;
@@ -55,9 +52,6 @@

         private Process process;
         private int exited;
-
-        private ManualResetEvent consoleOutputFinished;
-        private ManualResetEvent consoleErrorFinished;
         private bool loggingStarted;

         /// <summary>
@@ -313,12 +307,7 @@
             startInfo.CreateNoWindow = ! createWindow;

             startInfo.RedirectStandardOutput = captureConsoleOutput || ConsoleOutputDataReceived != null;
-            if (startInfo.RedirectStandardOutput)
-                consoleOutputFinished = new ManualResetEvent(false);
-
             startInfo.RedirectStandardError = captureConsoleError || ConsoleErrorDataReceived != null;
-            if (startInfo.RedirectStandardError)
-                consoleErrorFinished = new ManualResetEvent(false);

             if (environmentVariables != null)
             {
@@ -395,10 +384,6 @@

         private void HandleProcessExit()
         {
-            // Note: We wait here outside of the critical section to ensure that
-            //       the caller is fully synchronized.  Otherwise we might fall
-            //       through to continue processing while the console output is
-            //       still being read out.
             WaitForConsoleToBeCompletelyReadOnceProcessHasExited();

             if (Interlocked.Exchange(ref exited, 1) == 0)
@@ -451,34 +436,18 @@

         private void LogOutputData(object sender, DataReceivedEventArgs e)
         {
-            try
-            {
-                if (captureConsoleOutput && e.Data != null)
-                    consoleOutputCaptureWriter.WriteLine(e.Data);
-
-                EventHandlerPolicy.SafeInvoke(ConsoleOutputDataReceived, this, e);
-            }
-            finally
-            {
-                if (e.Data == null)
-                    consoleOutputFinished.Set();
-            }
+            if (captureConsoleOutput && e.Data != null)
+                consoleOutputCaptureWriter.WriteLine(e.Data);
+
+            EventHandlerPolicy.SafeInvoke(ConsoleOutputDataReceived, this, e);
         }

         private void LogErrorData(object sender, DataReceivedEventArgs e)
         {
-            try
-            {
-                if (captureConsoleError && e.Data != null)
-                    consoleErrorCaptureWriter.WriteLine(e.Data);
-
-                EventHandlerPolicy.SafeInvoke(ConsoleOutputDataReceived, this, e);
-            }
-            finally
-            {
-                if (e.Data == null)
-                    consoleErrorFinished.Set();
-            }
+            if (captureConsoleError && e.Data != null)
+                consoleErrorCaptureWriter.WriteLine(e.Data);
+
+            EventHandlerPolicy.SafeInvoke(ConsoleOutputDataReceived, this, e);
         }

         private void WaitForConsoleToBeCompletelyReadOnceProcessHasExited()
@@ -486,28 +455,13 @@
             if (!loggingStarted)
                 return;

-            if (DotNetRuntimeSupport.IsUsingMono)
-                return; // hangs on Mono 1.9.1.  Seems we never get the final events.
-
-            // Since the process has exited, it should not take too long to read
-            // its remaining output buffer.  The extra synchronization code here
-            // helps clients of the ProcessTask to handle process termination more
-            // robustly as it is guaranteed to have all of the output available
-            // at that time.
-            Stopwatch timer = Stopwatch.StartNew();
-            if (consoleOutputFinished != null)
-            {
-                consoleOutputFinished.WaitOne(WaitForFinalIOTimeout, false);
-            }
-
-            if (consoleErrorFinished != null)
-            {
-                TimeSpan remaining = WaitForFinalIOTimeout - timer.Elapsed;
-                if (remaining.Ticks < 0)
-                    remaining = TimeSpan.Zero;
-
-                consoleErrorFinished.WaitOne(remaining, false);
-            }
+            // Wait for all pending I/O to be consumed.  It turns out that calling
+            // WaitForExit with no timeout waits for the output and error streams
+            // to be full read (when using BeginOutput/ErrorReadLine) but the same
+            // courtesy is not extended to WaitForExit with a timeout.  Since the process
+            // has already exited, we should only be waiting to read the streams
+            // which ought to be pretty quick.
+            process.WaitForExit();
         }
     }
 }


While Loops - While Correction: Added using.System.Collections.Generic

--- Training.CSharpWorkshop.Tests/WhileLoops.cs
+++ Training.CSharpWorkshop.Tests/WhileLoops.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Collections.Generic;
 using Microsoft.VisualStudio.TestTools.UnitTesting;

 namespace Training.CSharpWorkshop.Tests
@@ -6,5 +7,39 @@
     [TestClass]
     public class WhileLoops
     {
+        [TestMethod]
+        public void WhileTest()
+        {
+            // Arrange
+            var list = new List<string>();
+
+            list.Add("Andrew");
+            list.Add("Dave");
+            list.Add("Don");
+            list.Add("Mike");
+            list.Add("Sam");
+            list.Add("Vidya");
+
+            var expected = "Andrew, Dave, Don, Mike, Sam, Vidya";
+
+            // Act
+            var actual = String.Empty;
+
+            // Single letters typically represent indexes
+            // i, j, k are the most common used in that order.
+            var i = 0;
+
+            while (i < list.Count)
+            {
+                actual += list[i] + ", ";
+                i++;
+            }
+
+            actual = actual.Trim();
+            actual = actual.TrimEnd(',');
+
+            // Assert
+            Assert.AreEqual(expected, actual);
+        }
     }
 }


誤ってTweetの投稿時間に9時間を足していたのを修正

誤ってTweetの投稿時間に9時間を足していたのを修正

タイムゾーンにあわせて正しく表示されるようなので、+9時間は不要。

--- TwitterSample/TwitterSample/Models/Model.cs
+++ TwitterSample/TwitterSample/Models/Model.cs
@@ -56,7 +56,7 @@
                         ScreenName = tweet.User.ScreenName,
                         Name = tweet.User.Name,
                         Tweet = tweet.Text,
-                        CreatedAt = tweet.CreatedAt.AddHours(9).ToString("f"),
+                        CreatedAt = tweet.CreatedAt.ToString("f"),
                         Icon = tweet.User.ProfileImageUrl
                     });
                 }
@@ -67,4 +67,4 @@
             }
         }
     }
-}+}


Use async

Use async

--- WalletWasabi.Tests/NodeBuilding/CoreNode.cs
+++ WalletWasabi.Tests/NodeBuilding/CoreNode.cs
@@ -10,6 +10,7 @@
 using System.Linq;
 using System.Net;
 using System.Net.Sockets;
+using System.Threading;
 using System.Threading.Tasks;
 using WalletWasabi.Helpers;

@@ -138,10 +139,8 @@
 					try
 					{
 						await RpcClient.StopAsync();
-						if (!Process.WaitForExit(20000))
-						{
-							//log this
-						}
+						using var timeout = new CancellationTokenSource(20000);
+						await Process.WaitForExitAsync(timeout.Token);
 					}
 					catch (Exception)
 					{ }