xmlns-qualified property tags support in xaml

--- Xaml/XamlParser.cs
+++ Xaml/XamlParser.cs
@@ -48,19 +48,20 @@
         private class ObjectInfo
         {
             /// <summary>
-            /// Тип конструируемого объекта.
+            /// Type of constructing object.
             /// </summary>
             public Type type;
             /// <summary>
-            /// Объект (или null если создаётся String).
+            /// Object instance (or null if String is created).
             /// </summary>
             public object obj;
             /// <summary>
-            /// Текущее свойство, которое задаётся тегом с точкой в имени.
+            /// Current property that defined using tag with dot in name.
+            /// <Window.Resources> for example
             /// </summary>
             public string currentProperty;
             /// <summary>
-            /// Задаётся при парсинге тегов, содержимое которых - текст.
+            /// For tags which content is text.
             /// </summary>
             public string currentPropertyText;
             /// <summary>
@@ -268,10 +269,17 @@
                         String name = xmlReader.Name;

                         // explicit property syntax
-                        if ( Top != null && name.StartsWith( Top.type.Name + "." ) ) {
-                            if ( Top.currentProperty != null )
-                                throw new Exception( "Illegal syntax in property value definition." );
-                            string propertyName = name.Substring(Top.type.Name.Length + 1);
+                        if (Top != null && name.Contains(".")) {
+                            // type may be qualified with xmlns namespace
+                            string typePrefix = name.Substring(0, name.IndexOf('.'));
+                            Type type = resolveType(typePrefix);
+                            if (type != Top.type) {
+                                throw new Exception($"Property {name} doesn't match current object {Top.type}");
+                            }
+                            if (Top.currentProperty != null) {
+                                throw new Exception("Illegal syntax in property value definition");
+                            }
+                            string propertyName = name.Substring(name.IndexOf('.') + 1);
                             Top.currentProperty = propertyName;
                         } else {
                             bool processingRootObject = (objects.Count == 0);
@@ -728,4 +736,4 @@
             return namespacesToScan;
         }
     }
-}+}


Fix for cluster node monitor - observing the wrong stream

--- LanguageExt.Process/ActorContext.cs
+++ LanguageExt.Process/ActorContext.cs
@@ -141,7 +141,7 @@
                     RemoveWatchingOfRemote(x.Name);
                 });

-                Process.observe<ClusterMonitor.State>(monitor).Subscribe(x =>
+                Process.observeState<ClusterMonitor.State>(monitor).Subscribe(x =>
                 {
                     clusterState = x;
                 });


Update TypeClassMonad.cs

Update TypeClassMonad.cs

--- LanguageExt.Tests/TypeClassMonad.cs
+++ LanguageExt.Tests/TypeClassMonad.cs
@@ -11,7 +11,7 @@
     public class TypeClassMonad
     {
         [Fact]
-        public void MonadBindTest()
+        public void MonadReturnTest()
         {
             var x = DoubleAndLift<MOption<int>, Option<int>, TInt, int>(100);
             Assert.True(x.IfNone(0) == 200);


Align and pad the command list using spaces

--- ManyConsole/Internal/ConsoleHelp.cs
+++ ManyConsole/Internal/ConsoleHelp.cs
@@ -14,10 +14,14 @@
         {
             console.WriteLine("Available commands are:");
             console.WriteLine();
-
-            foreach (var command in commands)
+
+            var commandList = commands.ToList();
+            var n = commandList.Max(c => c.Command.Length) + 1;
+            var commandFormatString = "    {0,-" + n + "}- {1}";
+
+            foreach (var command in commandList)
             {
-                console.WriteLine("    {0}\t- {1}", command.Command, command.OneLineDescription);
+                console.WriteLine(commandFormatString, command.Command, command.OneLineDescription);
             }
             console.WriteLine();
         }


Replaced List with IEnumerable

Replaced List with IEnumerable

--- Mapsui.Core/Utilities/Animations.cs
+++ Mapsui.Core/Utilities/Animations.cs
@@ -84,7 +84,7 @@
         /// </summary>
         /// <param name="entry">AnimationEntry to stop</param>
         /// <param name="callFinal">Final function is called, if callFinal is true</param>
-        public static void Stop(List<AnimationEntry> entries, bool callFinal = true)
+        public static void Stop(IEnumerable<AnimationEntry> entries, bool callFinal = true)
         {
             foreach (var entry in entries)
                 Stop(entry, callFinal);


remove dem notes

remove dem notes

--- ModCore/Database/DatabaseContext.cs
+++ ModCore/Database/DatabaseContext.cs
@@ -59,26 +59,11 @@

         protected override void OnModelCreating(ModelBuilder model)
         {
-            model.BuildCustomAttributes(this);
-
-            // TODO: at the end of moving all of these to annotations
-            // > add a new EF migration, don't apply it, generate a script for it, theoretically there should be nothing
-            //   changed, otherwise we messed up
-            // > test the bot (obviously)
-
-            // TODO https://stackoverflow.com/questions/2878272/when-should-i-use-primary-key-or-index
-            // the use of indices here makes sense, however, should we add [Key] to the .Id properties?
-
-            // TODO change index_id in DatabaseCommandId to somethign less likely to conflict, like
-            // mcore_cmd_state_index_id
-
             // https://www.learnentityframeworkcore.com/configuration/data-annotation-attributes
             // this site is GOLD for finding out the data annotation equivalents to fluent API methods, and finding out
             // whether or not they even exist

-            // TODO is cmd state index_id even necessary? isn't it duplicate, since we already have a key?
-            // is the alternate key needed? i guess making id an alternate key makes it unique, which is
-            // important.
+            model.BuildCustomAttributes(this);
         }
     }
 }


Remove panel from index forum page for mobile devices

--- MoreDakka/Views/Forums/Index.cshtml
+++ MoreDakka/Views/Forums/Index.cshtml
@@ -5,8 +5,6 @@

-

-

@@ -35,7 +33,5 @@

-

-


Readded code removed incorrectly

Readded code removed incorrectly

--- MotorwaySimulator/CustomControls.cs
+++ MotorwaySimulator/CustomControls.cs
@@ -380,6 +380,9 @@

             if (previousVehicle != null)
             {
+                // Calculate the stopping distance of the vehicle from the other lane
+                int vehicleFromOtherLaneProjectedStopppingDistancePixels = (int)Math.Round(MainForm.MetresToPixels(MainForm.StoppingDistance(vehicleFromOtherLane.ActualSpeedMetresHour)), 0);
+
                 // Calculate the stopping distance of the vehicle behind the vehicle from the other lane
                 int previousVehicleStoppingDistancePixels = (int)Math.Round(MainForm.MetresToPixels(MainForm.StoppingDistance(previousVehicle.ActualSpeedMetresHour)), 0);


1.0.8.11

--- NBitcoin/Properties/AssemblyInfo.cs
+++ NBitcoin/Properties/AssemblyInfo.cs
@@ -34,5 +34,5 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.8.10")]
+[assembly: AssemblyVersion("1.0.8.11")]
 [assembly: AssemblyFileVersion("1.0.0.0")]


1.0.4.10

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


'1.0.265'

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


Bump to version 2.0.2.0

Bump to version 2.0.2.0

--- PROShine/Properties/AssemblyInfo.cs
+++ PROShine/Properties/AssemblyInfo.cs
@@ -50,7 +50,7 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.1.0")]
-[assembly: AssemblyFileVersion("2.0.1.0")]
+[assembly: AssemblyVersion("2.0.2.0")]
+[assembly: AssemblyFileVersion("2.0.2.0")]
 [assembly: NeutralResourcesLanguage("en")]


Added PiccoloEngine test for missing payload scenario.

--- Piccolo.Tests/PiccoloEngineTests.cs
+++ Piccolo.Tests/PiccoloEngineTests.cs
@@ -463,6 +463,64 @@
 				}
 			}
 		}
+
+		[TestFixture]
+		public class when_processing_request_that_is_missing_payload_and_http_debugging_is_disabled : given_piccolo_engine
+		{
+			private PiccoloContext _piccoloContext;
+
+			[SetUp]
+			public void SetUp()
+			{
+				const string verb = "GET";
+				const string applicationPath = "/";
+				var uri = new Uri("http://example.com/resources/1");
+
+				HttpContextBase.Request.HttpMethod.Returns(verb);
+				HttpContextBase.Request.ApplicationPath.Returns(applicationPath);
+				HttpContextBase.Request.Url.Returns(uri);
+				HttpContextBase.Request.InputStream.Returns(new MemoryStream());
+
+				RequestRouter.When(x => x.FindRequestHandler(verb, applicationPath, uri)).Do(_ => { throw new MissingPayloadException(); });
+
+				_piccoloContext = new PiccoloContext(HttpContextBase);
+
+				Engine.ProcessRequest(_piccoloContext);
+			}
+
+			[Test]
+			public void it_should_raise_request_faulted_event()
+			{
+				EventDispatcher.Received().RaiseRequestFaultedEvent(_piccoloContext, Arg.Any<MissingPayloadException>());
+			}
+
+			[Test]
+			public void it_should_return_status_code_400()
+			{
+				HttpContextBase.Response.StatusCode.Returns(400);
+			}
+
+			[Test]
+			public void it_should_return_status_description_bad_request()
+			{
+				HttpContextBase.Response.StatusDescription.Returns("Bad Request");
+			}
+
+			[Test]
+			public void it_should_return_response_payload()
+			{
+				HttpContextBase.Response.Received().Write(Arg.Is<string>(x => x.Contains("Payload missing")));
+			}
+
+			[ExcludeFromCodeCoverage]
+			public class GetResource : IGet<string>
+			{
+				public HttpResponseMessage<string> Get()
+				{
+					return null;
+				}
+			}
+		}
 	}

 	public abstract class given_piccolo_engine


Support parsing multiple positional options

--- Pixie/Options/GnuOptionSetParser.cs
+++ Pixie/Options/GnuOptionSetParser.cs
@@ -30,10 +30,35 @@
             IReadOnlyList<Option> options,
             Option defaultOption,
             OptionForm defaultForm)
+            : this(
+                options,
+                new KeyValuePair<Option, OptionForm>[]
+                {
+                    new KeyValuePair<Option, OptionForm>(defaultOption, defaultForm)
+                })
+        { }
+
+        /// <summary>
+        /// Creates a GNU-style option parser from a list of
+        /// options and a list of positional argument options.
+        /// </summary>
+        /// <param name="options">
+        /// A list of all options known to this parser.
+        /// </param>
+        /// <param name="positionalOptions">
+        /// The default option: the option that
+        /// is implicitly parsed when no other option
+        /// can accept arguments.
+        /// </param>
+        /// <param name="defaultForm">
+        /// The preferred form for the default option.
+        /// </param>
+        public GnuOptionSetParser(
+            IReadOnlyList<Option> options,
+            IReadOnlyList<KeyValuePair<Option, OptionForm>> positionalOptions)
         {
             this.Options = options;
-            this.DefaultOption = defaultOption;
-            this.DefaultForm = defaultForm;
+            this.PositionalOptions = positionalOptions;
             this.shortForms = new TrieNode<char, Option>();
             this.longForms = new Dictionary<string, Option>();
             PopulateDataStructures();
@@ -46,18 +71,11 @@
         public IReadOnlyList<Option> Options { get; private set; }

         /// <summary>
-        /// Gets the default option: the option that
-        /// is implicitly parsed when no other option
-        /// can accept arguments.
-        /// </summary>
-        /// <returns>The default option.</returns>
-        public Option DefaultOption { get; private set; }
-
-        /// <summary>
-        /// Gets the preferred form for the default option.
-        /// </summary>
-        /// <returns>The default option's default form.</returns>
-        public OptionForm DefaultForm { get; private set; }
+        /// Gets a list of (Option, OptionForm) pairs that parse
+        /// positional arguments.
+        /// </summary>
+        /// <returns>The positional options.</returns>
+        public IReadOnlyList<KeyValuePair<Option, OptionForm>> PositionalOptions { get; private set; }

         // A trie of short option forms.
         internal TrieNode<char, Option> shortForms;
@@ -71,7 +89,10 @@
             ILog log)
         {
             var state = new GnuOptionSetParserState(this, log);
-            state.StartParsing(DefaultOption, DefaultForm);
+            for (int i = PositionalOptions.Count - 1; i >= 0; i--)
+            {
+                state.StartParsing(PositionalOptions[i].Key, PositionalOptions[i].Value);
+            }

             // Drip-feed the arguments to the state.
             int argCount = arguments.Count;


Update PBU-Main-Future.cs

Update PBU-Main-Future.cs

--- ProcessBlockUtil/PBU-Main-Future.cs
+++ ProcessBlockUtil/PBU-Main-Future.cs
@@ -65,7 +65,7 @@
 				    ar.Add(tempLine);
 			    }
 		    }
-		    list = (String) ar.ToArray();
+		    list = ar.ToArray();
 	    }
 	    else{
 		    list = {"iexplore", "360se", "qqbrowser"}


Fixed issue where the failed APNS message was being resent

--- PushSharp.Apple/ApplePushChannel.cs
+++ PushSharp.Apple/ApplePushChannel.cs
@@ -280,7 +280,7 @@
 			//Get all the notifications before the failed one and mark them as sent!
 			if (failedIndex > 0)
 			{
-				var successful = sentNotifications.GetRange (0, failedIndex - 1);
+				var successful = sentNotifications.GetRange (0, failedIndex);

 				successful.ForEach (n => {
 					Interlocked.Decrement(ref trackedNotificationCount);
@@ -289,7 +289,7 @@
 						n.Callback(this, new SendNotificationResult(n.Notification));
 				});

-				sentNotifications.RemoveRange (0, failedIndex - 1);
+				sentNotifications.RemoveRange (0, failedIndex);
 			}

 			//Get the failed notification itself
@@ -303,6 +303,7 @@

 			sentNotifications.RemoveAt(0);

+			sentNotifications.Reverse ();
 			sentNotifications.ForEach (n => {
 				Interlocked.Decrement(ref trackedNotificationCount);


Updated new fields in kettle protocol

Updated new fields in kettle protocol

--- SabberStoneKettle/KettleProtocol.cs
+++ SabberStoneKettle/KettleProtocol.cs
@@ -54,6 +54,8 @@
         public int Board;
         public int MaxSecretsPerPlayer;
         public int MaxFriendlyMinionsPerPlayer;
+        public int MaxSecretZoneSizePerPlayer;
+        public int MaxQuestsPerPlayer;

         public const String KettleName = "GameJoined";
     }


Added comments.

Added comments.

--- Salesforce.Core/SalesforceClient.cs
+++ Salesforce.Core/SalesforceClient.cs
@@ -18,7 +18,11 @@
 		internal const string RestApiPath = "/services/data/";
 #endif

-		static int defaultNetworkTimeout = 90;
+		volatile static int defaultNetworkTimeout = 90;
+		/// <summary>
+		/// The default network timeout.
+		/// </summary>
+		/// <value>The default network timeout.</value>
 		public static int DefaultNetworkTimeout
 		{
 			get
@@ -411,6 +415,8 @@

 				return response.Result;
 			}, TaskScheduler.Default);
+
+			// Don't need to await here, b/c we're already inside of a task.
 			refreshTask.Wait (TimeSpan.FromSeconds (DefaultNetworkTimeout));
 			CurrentUser.Properties ["access_token"] = refreshTask.Result ["access_token"];
 			return CurrentUser;


fix sphere collision check during movement interpolation (#3579)

--- Source/ACE.Server/Physics/Sphere.cs
+++ Source/ACE.Server/Physics/Sphere.cs
@@ -354,7 +354,7 @@
                 t = diff * 2 - t;
             var time = (float)t / lenSq;
             var timecheck = (1 - time) * transition.SpherePath.WalkInterp;
-            if (timecheck < transition.SpherePath.WalkableAllowance && timecheck < -0.1f)
+            if (timecheck >= transition.SpherePath.WalkInterp || timecheck < -0.1f)
                 return TransitionState.Collided;

             movement *= time;


reflected lazily initialized constants fix

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

--- Source/Core/Reflection/Constants.cs
+++ Source/Core/Reflection/Constants.cs
@@ -245,7 +245,7 @@
 		/// <summary>
 		/// Whether the value of the constant is known and stored in the constant-desc.
 		/// </summary>
-		public sealed override bool HasValue { get { return node == null; } }
+        public sealed override bool HasValue { get { return node == null && !ConstantDesc.ValueIsDeferred; } }

 		/// <summary>
 		/// Real storage of the constant (a field).


hiding FakeCall constructor per review comments

--- Source/FakeItEasy.Tests/FakeCall.cs
+++ Source/FakeItEasy.Tests/FakeCall.cs
@@ -10,6 +10,10 @@
     /// </summary>
     public class FakeCall : IInterceptedFakeObjectCall, ICompletedFakeObjectCall
     {
+        private FakeCall()
+        {
+        }
+
         public MethodInfo Method { get; private set; }

         public ArgumentCollection Arguments { get; private set; }


fixed missing waits

fixed missing waits

--- Source/MQTTnet/Client/MqttClient.cs
+++ Source/MQTTnet/Client/MqttClient.cs
@@ -229,11 +229,8 @@

             try
             {
-                if (clientWasConnected)
-                {
-                    await WaitForTaskAsync(_packetReceiverTask, sender).ConfigureAwait(false);
-                    await WaitForTaskAsync(_keepAliveMessageSenderTask, sender).ConfigureAwait(false);
-                }
+                await WaitForTaskAsync(_packetReceiverTask, sender).ConfigureAwait(false);
+                await WaitForTaskAsync(_keepAliveMessageSenderTask, sender).ConfigureAwait(false);

                 if (_adapter != null)
                 {


Added lock to version information

Added lock to version information

--- Source/Wifinian/Helper/OsVersion.cs
+++ Source/Wifinian/Helper/OsVersion.cs
@@ -39,15 +39,19 @@
 		#region Cache

 		private static readonly Dictionary<string, bool> _cache = new Dictionary<string, bool>();
+		private static readonly object _lock = new object();

 		private static bool IsEqualToOrNewer(int major, int minor = 0, int build = 0, [CallerMemberName] string propertyName = null)
 		{
-			if (!_cache.TryGetValue(propertyName, out bool value))
+			lock (_lock)
 			{
-				value = (new Version(major, minor, build) <= Environment.OSVersion.Version);
-				_cache.Add(propertyName, value);
+				if (!_cache.TryGetValue(propertyName, out bool value))
+				{
+					value = (new Version(major, minor, build) <= Environment.OSVersion.Version);
+					_cache.Add(propertyName, value);
+				}
+				return value;
 			}
-			return value;
 		}

 		#endregion


Minor. Require

Minor. Require

--- Src/Qart.Core/Validation/Require.cs
+++ Src/Qart.Core/Validation/Require.cs
@@ -16,7 +16,12 @@

         public static void NotNullOrEmpty(string value)
         {
-            Require.That(() => !string.IsNullOrEmpty(value), "Expected non null and not empty value.");
+            Require.NotNullOrEmpty(value, "Expected non null and not empty value.");
+        }
+
+        public static void NotNullOrEmpty(string value, string message)
+        {
+            Require.That(() => !string.IsNullOrEmpty(value), message);
         }

         public static void DoesNotContain(string value, string substring)


added takeprofit and autorestart

added takeprofit and autorestart

--- cbot.cs
+++ cbot.cs
@@ -22,6 +22,7 @@
         private int currentminute;
         private int currentslotnumber;
         private bool botactive;
+        private int hasclosedft;

         [Parameter("Contracts (EURO)", DefaultValue = 100000, MinValue = 1, MaxValue = 100000000)]
         public int ncontracts { get; set; }
@@ -34,6 +35,12 @@

         [Parameter("Invert Buy/Sell", DefaultValue = false)]
         public bool inverted { get; set; }
+
+        [Parameter("Take Profit (pips)", DefaultValue = 0, MinValue = 0, MaxValue = 100000000)]
+        public int takeprofit { get; set; }
+
+        [Parameter("Restart After Profit", DefaultValue = false)]
+        public bool restartap { get; set; }

         // Time Parameters
         [Parameter("0:00 - 0:29", DefaultValue = true)]
@@ -200,10 +207,13 @@
             currentminute = 0;
             currentslotnumber = 0;
             botactive = false;
+            hasclosedft = 0;

             candleslist.Clear();
             outlist.Clear();
             blackslots.Clear();
+
+            Positions.Closed += PositionsOnClosed;

             // Adding "black" hours

@@ -479,6 +489,11 @@
             {
                 botactive = false;

+                if (hasclosedft == 1)
+                {
+                    hasclosedft = 2;
+                }
+
                 if (is_position_open)
                 {
                     Print("Closing active position");
@@ -492,7 +507,14 @@
             }
             else
             {
-                botactive = true;
+                if (restartap)
+                {
+                    botactive = true;
+                }
+                else if (restartap == false && (hasclosedft == 2 || hasclosedft == 0))
+                {
+                    botactive = true;
+                }
             }

@@ -599,12 +621,26 @@

                         if (pointscounter == csequence)
                         {
-                            var result = ExecuteMarketOrder(TradeType.Buy, Symbol, ncontracts, "kTrade");
+                            if (takeprofit > 0)
+                            {
+                                var result = ExecuteMarketOrder(TradeType.Buy, Symbol, ncontracts, "kTrade", 0, takeprofit);
+                            }
+                            else
+                            {
+                                var result = ExecuteMarketOrder(TradeType.Buy, Symbol, ncontracts, "kTrade");
+                            }
                             position_type = "buy";
                         }
                         else
                         {
-                            var result = ExecuteMarketOrder(TradeType.Sell, Symbol, ncontracts, "kTrade");
+                            if (takeprofit > 0)
+                            {
+                                var result = ExecuteMarketOrder(TradeType.Sell, Symbol, ncontracts, "kTrade", 0, takeprofit);
+                            }
+                            else
+                            {
+                                var result = ExecuteMarketOrder(TradeType.Sell, Symbol, ncontracts, "kTrade");
+                            }
                             position_type = "sell";
                         }
                     }
@@ -650,12 +686,28 @@
         // end of on bar event
         protected override void OnTick()
         {
-            // Put your core logic here
+            // no onTick events
         }

         protected override void OnStop()
         {
-            // Put your deinitialization logic here
+            Print("kTrade stopped");
         }
+
+        private void PositionsOnClosed(PositionClosedEventArgs args)
+        {
+            var pos = args.Position;
+            Print("Position closed with €{0} profit", pos.GrossProfit);
+            is_position_open = false;
+            position_type = null;
+
+            if (!restartap)
+            {
+                hasclosedft = 1;
+                botactive = false;
+            }
+
+        }
+
     }
 }


fix delay (ms->second)

fix delay (ms->second)

--- TwVideoUp/MainWindow.xaml.cs
+++ TwVideoUp/MainWindow.xaml.cs
@@ -355,7 +355,7 @@
                 {
                     if (uploadStatus.ProcessingInfo.ProgressPercent != null)
                         SetProgress(uploadStatus.ProcessingInfo.ProgressPercent.Value);
-                    await Task.Delay(uploadStatus.ProcessingInfo.CheckAfterSecs);
+                    await Task.Delay(uploadStatus.ProcessingInfo.CheckAfterSecs*1000);
                 }

                 Status s = await tokens.Statuses.UpdateAsync(


changed TestPage2 file

changed TestPage2 file

--- webapp-net/Test/Areas/Test/Views/Page/TestPage2.cshtml
+++ webapp-net/Test/Areas/Test/Views/Page/TestPage2.cshtml
@@ -13,7 +13,7 @@

Regions

-            @Html.DxaRegions()
+            @Html.DxaRegion("TestRegion2")


Updates template to use Debug.WriteLine (#489)

***NO_CI***

--- source/CSharp.BlankApplication/Program.cs
+++ source/CSharp.BlankApplication/Program.cs
@@ -1,5 +1,6 @@
-using System;
+using System;
 using System.Threading;
+using System.Diagnostics;

 namespace $safeprojectname$
 {
@@ -7,7 +8,7 @@
     {
         public static void Main()
         {
-            Console.WriteLine("Hello world!");
+            Debug.WriteLine("Hello from nanoFramework!");

             Thread.Sleep(Timeout.Infinite);


Fix missing using statement for Nuke.Common.IO (#435)

--- source/Nuke.GlobalTool/templates/Build.cs
+++ source/Nuke.GlobalTool/templates/Build.cs
@@ -3,6 +3,7 @@
 using Nuke.Common;
 using Nuke.Common.Execution;
 using Nuke.Common.Git;                                                                          // GIT
+using Nuke.Common.IO;
 using Nuke.Common.ProjectModel;
 using Nuke.Common.Tooling;
 using Nuke.Common.Tools.DotNet;                                                                 // DOTNET


Fix for new vlc version.

Fix for new vlc version.

--- source/VideoCommander/AddDialog.cs
+++ source/VideoCommander/AddDialog.cs
@@ -1,103 +1,103 @@
-using System;
-using System.Linq;
-using System.IO;
-using System.Windows.Forms;
-
-namespace D16.VideoCommander
-{
-    internal partial class AddDialog : Form
-    {
-        private System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddDialog));
-
-        public AddDialog()
-        {
-            InitializeComponent();
-        }
-
-        /// <summary>
-        /// Path to the video file.
-        /// </summary>
-        public string Video
-        {
-            get
-            {
-                return txbPath.Text;
-            }
-            set
-            {
-                txbPath.Text = value;
-            }
-        }
-
-        private string ConvertTimeString(string timeString)
-        {
-            string raw = timeString.Replace(":", String.Empty);
-            if (raw.Trim().Length == 0 || Convert.ToInt32(raw) == 0)
-                return String.Empty;
-
-            return timeString.Replace(' ', '0');
-        }
-
-        public string StartTime
-        {
-            get { return ConvertTimeString(mtbStart.Text); }
-            set { mtbStart.Text = value; }
-        }
-
-        public string EndTime
-        {
-            get { return ConvertTimeString(mtbEnd.Text); }
-            set { mtbEnd.Text = value; }
-        }
-
-        public string Duration
-        {
-            get { return ConvertTimeString(mtbDuration.Text); }
-            set { mtbDuration.Text = value; }
-        }
-
-        private void btnOk_Click(object sender, System.EventArgs e)
-        {
-            if (!this.Video.StartsWith("dvdsimple:") && !File.Exists(this.Video))
-            {
-                MessageBox.Show(resources.GetString("Error.NoFile"), resources.GetString("Error.NoFile.Title"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
-            }
-            else
-            {
-                DialogResult = DialogResult.OK;
-                Close();
-            }
-        }
-
-        private void btnBrowse_Click(object sender, System.EventArgs e)
-        {
-            fileDialog.InitialDirectory = this.Video;
-
-            if (fileDialog.ShowDialog() == DialogResult.OK)
-            {
-                this.Video = fileDialog.FileName;
-            }
-        }
-
-        public void ResetTexts()
-        {
-            txbPath.ResetText();
-
-            mtbStart.ResetText();
-            mtbEnd.ResetText();
-            mtbDuration.ResetText();
-        }
-
-        private void btnDVD_Click(object sender, EventArgs e)
-        {
-            if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
-            {
-                if (string.IsNullOrEmpty(folderBrowserDialog.SelectedPath))
-                    return;
-
-                var volume = folderBrowserDialog.SelectedPath.Split(Path.VolumeSeparatorChar).First();
-                this.Video = "dvdsimple://" + volume + ":";
-            }
-        }
-    }
-}
+using System;
+using System.Linq;
+using System.IO;
+using System.Windows.Forms;
+
+namespace D16.VideoCommander
+{
+    internal partial class AddDialog : Form
+    {
+        private System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddDialog));
+
+        public AddDialog()
+        {
+            InitializeComponent();
+        }
+
+        /// <summary>
+        /// Path to the video file.
+        /// </summary>
+        public string Video
+        {
+            get
+            {
+                return txbPath.Text;
+            }
+            set
+            {
+                txbPath.Text = value;
+            }
+        }
+
+        private string ConvertTimeString(string timeString)
+        {
+            string raw = timeString.Replace(":", String.Empty);
+            if (raw.Trim().Length == 0 || Convert.ToInt32(raw) == 0)
+                return String.Empty;
+
+            return timeString.Replace(' ', '0');
+        }
+
+        public string StartTime
+        {
+            get { return ConvertTimeString(mtbStart.Text); }
+            set { mtbStart.Text = value; }
+        }
+
+        public string EndTime
+        {
+            get { return ConvertTimeString(mtbEnd.Text); }
+            set { mtbEnd.Text = value; }
+        }
+
+        public string Duration
+        {
+            get { return ConvertTimeString(mtbDuration.Text); }
+            set { mtbDuration.Text = value; }
+        }
+
+        private void btnOk_Click(object sender, System.EventArgs e)
+        {
+            if (!this.Video.StartsWith("dvdsimple:") && !File.Exists(this.Video))
+            {
+                MessageBox.Show(resources.GetString("Error.NoFile"), resources.GetString("Error.NoFile.Title"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+            }
+            else
+            {
+                DialogResult = DialogResult.OK;
+                Close();
+            }
+        }
+
+        private void btnBrowse_Click(object sender, System.EventArgs e)
+        {
+            fileDialog.InitialDirectory = this.Video;
+
+            if (fileDialog.ShowDialog() == DialogResult.OK)
+            {
+                this.Video = fileDialog.FileName;
+            }
+        }
+
+        public void ResetTexts()
+        {
+            txbPath.ResetText();
+
+            mtbStart.ResetText();
+            mtbEnd.ResetText();
+            mtbDuration.ResetText();
+        }
+
+        private void btnDVD_Click(object sender, EventArgs e)
+        {
+            if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                if (string.IsNullOrEmpty(folderBrowserDialog.SelectedPath))
+                    return;
+
+                var volume = folderBrowserDialog.SelectedPath.Split(Path.VolumeSeparatorChar).First();
+                this.Video = "dvdsimple:///" + volume + ":";
+            }
+        }
+    }
+}


devil origin modes once again;

devil origin modes once again;

--- src/Aardvark.Base/Images/PixImageDevil.cs
+++ src/Aardvark.Base/Images/PixImageDevil.cs
@@ -13,16 +13,25 @@
     public abstract partial class PixImage
     {
         private static object s_devilLock = new object();
-
-        static PixImage()
-        {
+        private static bool s_initialized = false;
+
+        [OnAardvarkInit]
+        public static void InitDevil()
+        {
+            if (s_initialized) return;
+            s_initialized = true;
+
             Bootstrap.Init();
             IL.Init();
+            IL.Enable(EnableCap.AbsoluteOrigin);
+            IL.OriginFunc(OriginMode.UpperLeft);
             IL.Enable(EnableCap.OverwriteExistingFile);
-            //IL.OriginFunc(OriginMode.UpperLeft);
             IL.Enable(EnableCap.ConvertPalette);
-            //IL.Enable(EnableCap.AbsoluteOrigin);
-
+        }
+
+        static PixImage()
+        {
+            InitDevil();
         }

         private static Dictionary<Devil.ChannelFormat, Col.Format> s_pixColorFormats = new Dictionary<Devil.ChannelFormat, Col.Format>()
@@ -164,6 +173,7 @@
             var mode = (OriginMode)IL.GetInteger((IntName)0x0603);
             if (mode == OriginMode.LowerLeft && !ILU.FlipImage())
                 return null;
+

             // create an appropriate PixImage instance
             var imageType = typeof(PixImage<>).MakeGenericType(type);


Fix incompatibility with .Net 3.5.

Fix incompatibility with .Net 3.5.

This patch lets a build be compatible with KSP 1.4 through 1.9.

--- src/AsteroidGroups/AbstractAsteroidSet.cs
+++ src/AsteroidGroups/AbstractAsteroidSet.cs
@@ -90,14 +90,15 @@
             if (sizeRatios != null)
             {
                 string sizeName = RandomDist.weightedSample (sizeRatios.asPairList ());
-                if (Enum.TryParse (sizeName, true, out UntrackedObjectClass size))
+                try
                 {
-                    return size;
+                    return (UntrackedObjectClass)Enum.Parse(typeof(UntrackedObjectClass), sizeName, true);
                 }
-                else
+                catch (ArgumentException e)
                 {
-                    Util.errorToPlayerLoc ("#autoLOC_CustomAsteroids_ErrorNoSize", sizeName, name);
-                    Debug.LogError ($"[CustomAsteroids]: Invalid asteroid size {sizeName} in group {name}.");
+                    Util.errorToPlayer (e, Localizer.Format (
+                        "#autoLOC_CustomAsteroids_ErrorNoSize", sizeName, name));
+                    Debug.LogException (e);
                     return UntrackedObjectClass.C;
                 }
             }


Cleanup Popup control.

Cleanup Popup control.

--- src/Avalonia.Controls/Primitives/Popup.cs
+++ src/Avalonia.Controls/Primitives/Popup.cs
@@ -2,18 +2,18 @@
 // Licensed under the MIT license. See licence.md file in the project root for full license information.

 using System;
-using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
 using System.Reactive.Disposables;
 using Avalonia.Controls.Presenters;
-using Avalonia.Data;
 using Avalonia.Input;
 using Avalonia.Input.Raw;
 using Avalonia.Interactivity;
 using Avalonia.LogicalTree;
 using Avalonia.Metadata;
 using Avalonia.VisualTree;
+
+#nullable enable

 namespace Avalonia.Controls.Primitives
 {
@@ -43,11 +43,13 @@
         public static readonly StyledProperty<PlacementMode> PlacementModeProperty =
             AvaloniaProperty.Register<Popup, PlacementMode>(nameof(PlacementMode), defaultValue: PlacementMode.Bottom);

+#pragma warning disable 618
         /// <summary>
         /// Defines the <see cref="ObeyScreenEdges"/> property.
         /// </summary>
         public static readonly StyledProperty<bool> ObeyScreenEdgesProperty =
             AvaloniaProperty.Register<Popup, bool>(nameof(ObeyScreenEdges), true);
+#pragma warning restore 618

         /// <summary>
         /// Defines the <see cref="HorizontalOffset"/> property.
@@ -80,12 +82,8 @@
             AvaloniaProperty.Register<Popup, bool>(nameof(Topmost));

         private bool _isOpen;
-        private IPopupHost _popupHost;
-        private TopLevel _topLevel;
-        private IDisposable _nonClientListener;
-        private IDisposable _presenterSubscription;
-        bool _ignoreIsOpenChanged = false;
-        private List<IDisposable> _bindings = new List<IDisposable>();
+        private bool _ignoreIsOpenChanged;
+        private PopupOpenState? _openState;

         /// <summary>
         /// Initializes static members of the <see cref="Popup"/> class.
@@ -97,22 +95,17 @@
             IsOpenProperty.Changed.AddClassHandler<Popup>((x, e) => x.IsOpenChanged(e));
         }

-        public Popup()
-        {
-
-        }
-
         /// <summary>
         /// Raised when the popup closes.
         /// </summary>
-        public event EventHandler Closed;
+        public event EventHandler? Closed;

         /// <summary>
         /// Raised when the popup opens.
         /// </summary>
-        public event EventHandler Opened;
-
-        public IPopupHost Host => _popupHost;
+        public event EventHandler? Opened;
+
+        public IPopupHost? Host => _openState?.PopupHost;

         /// <summary>
         /// Gets or sets the control to display in the popup.
@@ -131,7 +124,7 @@
         /// This property allows a client to customize the behaviour of the popup by injecting
         /// a specialized dependency resolver into the <see cref="PopupRoot"/>'s constructor.
         /// </remarks>
-        public IAvaloniaDependencyResolver DependencyResolver
+        public IAvaloniaDependencyResolver? DependencyResolver
         {
             get;
             set;
@@ -211,7 +204,7 @@
         /// <summary>
         /// Gets the root of the popup window.
         /// </summary>
-        IVisual IVisualTreeHost.Root => _popupHost?.HostedVisualTreeRoot;
+        IVisual? IVisualTreeHost.Root => _openState?.PopupHost.HostedVisualTreeRoot;

         /// <summary>
         /// Opens the popup.
@@ -219,50 +212,91 @@
         public void Open()
         {
             // Popup is currently open
-            if (_topLevel != null)
+            if (_openState != null)
+            {
                 return;
-            CloseCurrent();
+            }
+
             var placementTarget = PlacementTarget ?? this.GetLogicalAncestors().OfType<IVisual>().FirstOrDefault();
+
             if (placementTarget == null)
+            {
                 throw new InvalidOperationException("Popup has no logical parent and PlacementTarget is null");
+            }

-            _topLevel = placementTarget.GetVisualRoot() as TopLevel;
-
-            if (_topLevel == null)
+            var topLevel = placementTarget.VisualRoot as TopLevel;
+
+            if (topLevel == null)
             {
                 throw new InvalidOperationException(
                     "Attempted to open a popup not attached to a TopLevel");
             }

-            _popupHost = OverlayPopupHost.CreatePopupHost(placementTarget, DependencyResolver);
-
-            _bindings.Add(_popupHost.BindConstraints(this, WidthProperty, MinWidthProperty, MaxWidthProperty,
+            var popupHost = OverlayPopupHost.CreatePopupHost(placementTarget, DependencyResolver);
+
+            var handlerCleanup = new CompositeDisposable(5);
+
+            void DeferCleanup(IDisposable? disposable)
+            {
+                if (disposable is null)
+                {
+                    return;
+                }
+
+                handlerCleanup.Add(disposable);
+            }
+
+            DeferCleanup(popupHost.BindConstraints(this, WidthProperty, MinWidthProperty, MaxWidthProperty,
                 HeightProperty, MinHeightProperty, MaxHeightProperty, TopmostProperty));

-            _popupHost.SetChild(Child);
-            ((ISetLogicalParent)_popupHost).SetParent(this);
-            _popupHost.ConfigurePosition(placementTarget,
-                PlacementMode, new Point(HorizontalOffset, VerticalOffset));
-            _popupHost.TemplateApplied += RootTemplateApplied;
-
-            var window = _topLevel as Window;
-            if (window != null)
-            {
-                window.Deactivated += WindowDeactivated;
+            popupHost.SetChild(Child);
+            ((ISetLogicalParent)popupHost).SetParent(this);
+
+            popupHost.ConfigurePosition(
+                placementTarget,
+                PlacementMode,
+                new Point(HorizontalOffset, VerticalOffset));
+
+            DeferCleanup(SubscribeToEventHandler<IPopupHost, EventHandler<TemplateAppliedEventArgs>>(popupHost, RootTemplateApplied,
+                (x, handler) => x.TemplateApplied += handler,
+                (x, handler) => x.TemplateApplied -= handler));
+
+            if (topLevel is Window window)
+            {
+                DeferCleanup(SubscribeToEventHandler<Window, EventHandler>(window, WindowDeactivated,
+                    (x, handler) => x.Deactivated += handler,
+                    (x, handler) => x.Deactivated -= handler));
             }
             else
             {
-                var parentPopuproot = _topLevel as PopupRoot;
-                if (parentPopuproot?.Parent is Popup popup)
-                {
-                    popup.Closed += ParentClosed;
-                }
-            }
-            _topLevel.AddHandler(PointerPressedEvent, PointerPressedOutside, RoutingStrategies.Tunnel);
-            _nonClientListener = InputManager.Instance?.Process.Subscribe(ListenForNonClientClick);
-
-
-            _popupHost.Show();
+                var parentPopupRoot = topLevel as PopupRoot;
+
+                if (parentPopupRoot?.Parent is Popup popup)
+                {
+                    DeferCleanup(SubscribeToEventHandler<Popup, EventHandler>(popup, ParentClosed,
+                        (x, handler) => x.Closed += handler,
+                        (x, handler) => x.Closed -= handler));
+                }
+            }
+
+            DeferCleanup(topLevel.AddHandler(PointerPressedEvent, PointerPressedOutside, RoutingStrategies.Tunnel));
+
+            DeferCleanup(InputManager.Instance?.Process.Subscribe(ListenForNonClientClick));
+
+            var cleanupPopup = Disposable.Create((popupHost, handlerCleanup), state =>
+            {
+                state.handlerCleanup.Dispose();
+
+                state.popupHost.SetChild(null);
+                state.popupHost.Hide();
+
+                ((ISetLogicalParent)state.popupHost).SetParent(null);
+                state.popupHost.Dispose();
+            });
+
+            _openState = new PopupOpenState(topLevel, popupHost, cleanupPopup);
+
+            popupHost.Show();

             using (BeginIgnoringIsOpen())
             {
@@ -277,60 +311,25 @@
         /// </summary>
         public void Close()
         {
-            if (_topLevel is null)
-            {
+            if (_openState is null)
+            {
+                using (BeginIgnoringIsOpen())
+                {
+                    IsOpen = false;
+                }
+
                 return;
             }

-            if (_popupHost != null)
-            {
-                _popupHost.TemplateApplied -= RootTemplateApplied;
-            }
-
-            _presenterSubscription?.Dispose();
-
-            CloseCurrent();
+            _openState.Dispose();
+            _openState = null;
+
             using (BeginIgnoringIsOpen())
             {
                 IsOpen = false;
             }

             Closed?.Invoke(this, EventArgs.Empty);
-        }
-
-        void CloseCurrent()
-        {
-            if (_topLevel != null)
-            {
-                _topLevel.RemoveHandler(PointerPressedEvent, PointerPressedOutside);
-                var window = _topLevel as Window;
-                if (window != null)
-                    window.Deactivated -= WindowDeactivated;
-                else
-                {
-                    var parentPopuproot = _topLevel as PopupRoot;
-                    if (parentPopuproot?.Parent is Popup popup)
-                    {
-                        popup.Closed -= ParentClosed;
-                    }
-                }
-                _nonClientListener?.Dispose();
-                _nonClientListener = null;
-
-                _topLevel = null;
-            }
-            if (_popupHost != null)
-            {
-                foreach(var b in _bindings)
-                    b.Dispose();
-                _bindings.Clear();
-                _popupHost.SetChild(null);
-                _popupHost.Hide();
-                ((ISetLogicalParent)_popupHost).SetParent(null);
-                _popupHost.Dispose();
-                _popupHost = null;
-            }
-
         }

         /// <summary>
@@ -350,6 +349,12 @@
             Close();
         }

+        private static IDisposable SubscribeToEventHandler<T, TEventHandler>(T target, TEventHandler handler, Action<T, TEventHandler> subscribe, Action<T, TEventHandler> unsubscribe)
+        {
+            subscribe(target, handler);
+
+            return Disposable.Create((unsubscribe, target, handler), state => state.unsubscribe(state.target, state.handler));
+        }

         /// <summary>
         /// Called when the <see cref="IsOpen"/> property changes.
@@ -378,7 +383,7 @@
         {
             LogicalChildren.Clear();

-            ((ISetLogicalParent)e.OldValue)?.SetParent(null);
+            ((ISetLogicalParent?)e.OldValue)?.SetParent(null);

             if (e.NewValue != null)
             {
@@ -411,22 +416,28 @@

         private void RootTemplateApplied(object sender, TemplateAppliedEventArgs e)
         {
-            _popupHost.TemplateApplied -= RootTemplateApplied;
-
-            if (_presenterSubscription != null)
-            {
-                _presenterSubscription.Dispose();
-                _presenterSubscription = null;
-            }
+            if (_openState is null)
+            {
+                return;
+            }
+
+            var popupHost = _openState.PopupHost;
+
+            popupHost.TemplateApplied -= RootTemplateApplied;
+
+            _openState.CleanupPresenterSubscription();

             // If the Popup appears in a control template, then the child controls
             // that appear in the popup host need to have their TemplatedParent
             // properties set.
-            if (TemplatedParent != null)
-            {
-                _popupHost.Presenter?.ApplyTemplate();
-                _popupHost.Presenter?.GetObservable(ContentPresenter.ChildProperty)
+            if (TemplatedParent != null && popupHost.Presenter != null)
+            {
+                popupHost.Presenter.ApplyTemplate();
+
+                var presenterSubscription = popupHost.Presenter.GetObservable(ContentPresenter.ChildProperty)
                     .Subscribe(SetTemplatedParentAndApplyChildTemplates);
+
+                _openState.DeferCleanupPresenterSubscription(presenterSubscription);
             }
         }

@@ -445,7 +456,7 @@

                 if (!(control is IPresenter) && control.TemplatedParent == templatedParent)
                 {
-                    foreach (IControl child in control.GetVisualChildren())
+                    foreach (IControl child in control.VisualChildren)
                     {
                         SetTemplatedParentAndApplyChildTemplates(child);
                     }
@@ -455,22 +466,41 @@

         private bool IsChildOrThis(IVisual child)
         {
-            IVisual root = child.GetVisualRoot();
-            while (root is IHostedVisualTreeRoot hostedRoot )
-            {
-                if (root == this._popupHost)
+            if (_openState is null)
+            {
+                return false;
+            }
+
+            var popupHost = _openState.PopupHost;
+
+            IVisual? root = child.VisualRoot;
+
+            while (root is IHostedVisualTreeRoot hostedRoot)
+            {
+                if (root == popupHost)
+                {
                     return true;
-                root = hostedRoot.Host?.GetVisualRoot();
-            }
+                }
+
+                root = hostedRoot.Host?.VisualRoot;
+            }
+
             return false;
         }

         public bool IsInsidePopup(IVisual visual)
         {
-            return _popupHost != null && ((IVisual)_popupHost)?.IsVisualAncestorOf(visual) == true;
-        }
-
-        public bool IsPointerOverPopup => ((IInputElement)_popupHost).IsPointerOver;
+            if (_openState is null)
+            {
+                return false;
+            }
+
+            var popupHost = _openState.PopupHost;
+
+            return popupHost != null && ((IVisual)popupHost).IsVisualAncestorOf(visual);
+        }
+
+        public bool IsPointerOverPopup => ((IInputElement?)_openState?.PopupHost)?.IsPointerOver ?? false;

         private void WindowDeactivated(object sender, EventArgs e)
         {
@@ -508,5 +538,48 @@
                 _owner._ignoreIsOpenChanged = false;
             }
         }
+
+        private class PopupOpenState : IDisposable
+        {
+            private readonly IDisposable _cleanup;
+            private IDisposable? _presenterCleanup;
+
+            public PopupOpenState(TopLevel topLevel, IPopupHost popupHost, IDisposable cleanup)
+            {
+                TopLevel = topLevel;
+                PopupHost = popupHost;
+                _cleanup = cleanup;
+            }
+
+            public TopLevel TopLevel { get; }
+
+            public IPopupHost PopupHost { get; }
+
+            public void CleanupPresenterSubscription()
+            {
+                _presenterCleanup?.Dispose();
+                _presenterCleanup = null;
+            }
+
+            public void DeferCleanupPresenterSubscription(IDisposable presenterCleanup)
+            {
+                if (_presenterCleanup != null)
+                {
+                    // Shouldn't really happen since we always cleanup before calling this.
+                    Debug.Assert(false);
+
+                    _presenterCleanup.Dispose();
+                }
+
+                _presenterCleanup = presenterCleanup;
+            }
+
+            public void Dispose()
+            {
+                _presenterCleanup?.Dispose();
+
+                _cleanup.Dispose();
+            }
+        }
     }
 }


Populate free disk on Windows

Populate free disk on Windows

--- src/BugsnagUnity/Clients/WindowsClient.cs
+++ src/BugsnagUnity/Clients/WindowsClient.cs
@@ -30,6 +30,14 @@
       {
         device.AddToPayload("freeMemory", memStatus.ullAvailPhys);
       }
+
+      if (GetDiskFreeSpaceEx(@"C:\",
+                                        out ulong freeBytesAvailable,
+                                        out ulong totalNumberOfBytes,
+                                        out ulong totalNumberOfFreeBytes))
+      {
+        device.AddToPayload("freeDisk", freeBytesAvailable);
+      }
     }

     public void PopulateMetadata(Metadata metadata)
@@ -43,6 +51,13 @@
     public void SetMetadata(string tab, Dictionary<string, string> metadata)
     {
     }
+
+    [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+    [return: MarshalAs(UnmanagedType.Bool)]
+    static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,
+      out ulong lpFreeBytesAvailable,
+      out ulong lpTotalNumberOfBytes,
+      out ulong lpTotalNumberOfFreeBytes);

     [return: MarshalAs(UnmanagedType.Bool)]
     [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]


Preserve JSON deserialized properties from being trimmed away (#31951)

Fixes https://github.com/dotnet/aspnetcore/issues/31950

--- src/Components/Shared/src/WebEventData.cs
+++ src/Components/Shared/src/WebEventData.cs
@@ -79,6 +79,8 @@
             }
         }

+        [DynamicDependency(JsonSerialized, typeof(DataTransfer))]
+        [DynamicDependency(JsonSerialized, typeof(DataTransferItem))]
         private static bool TryDeserializeStandardWebEventArgs(string eventName, string eventArgsJson, [NotNullWhen(true)] out EventArgs? eventArgs)
         {
             // For back-compatibility, we recognize the built-in list of web event names and hard-code


Fixed GetLiteralDateDiff() to work even with composite arguments

git-svn-id: 1800f71f313d917366f95485fa960eed04b40598@1252 33146b6e-df29-0410-a1ca-39be37fb9416

--- src/DbLinq.PostgreSql/PgsqlSqlProvider.cs
+++ src/DbLinq.PostgreSql/PgsqlSqlProvider.cs
@@ -1,4 +1,4 @@
-#region MIT license
+#region MIT license
 //
 // MIT license
 //
@@ -72,7 +72,7 @@

         protected override SqlStatement GetLiteralDateDiff(SqlStatement dateA, SqlStatement dateB)
         {
-            return string.Format("(EXTRACT(EPOCH FROM ({0}-{1})::interval)*1000)", dateA, dateB);
+            return string.Format("(EXTRACT(EPOCH FROM ({0})::timestamp)-EXTRACT(EPOCH FROM ({1})::timestamp))*1000", dateA, dateB);
         }

         protected override SqlStatement GetLiteralEqual(SqlStatement a, SqlStatement b)
@@ -129,6 +129,7 @@

             {typeof(DateTime),"timestamp"},
             //{typeof(Guid),"uniqueidentifier"}
+            {typeof(byte[]),"bytea"},
         };

         public override SqlStatement GetLiteralConvert(SqlStatement a, Type type)


Add test for #160

Add test for #160

--- src/DelegateDecompiler.Tests/EnumTests.cs
+++ src/DelegateDecompiler.Tests/EnumTests.cs
@@ -285,6 +285,15 @@
 			Test(expected, compiled);
         }

+        [Test, Ignore("Not fixed yet")]
+        public void Issue160()
+        {
+            Expression<Func<int?, bool>> expected1 = x => (TestEnum?) x == TestEnum.Bar;
+            Expression<Func<int?, bool>> expected2 = x => (int?) x == (int?) TestEnum.Bar;
+            Func<int?, bool> compiled = x => (TestEnum?) x == TestEnum.Bar;
+            Test(expected1, expected2, compiled);
+        }
+
         private static bool TestEnumMethod(TestEnum p0)
         {
             throw new NotImplementedException();


Hack around ReflectionUtils with Reflection magic

--- src/DotVVM.Compiler/StaticViewCompiler.cs
+++ src/DotVVM.Compiler/StaticViewCompiler.cs
@@ -60,7 +60,8 @@
             Assembly dotvvmProjectAssembly,
             string dotvvmProjectDir)
         {
-            ReplaceDefaultTypeRegistry(dotvvmProjectAssembly);
+            // ReplaceDefaultTypeRegistry(dotvvmProjectAssembly);
+            ReplaceDefaultDependencyContext(dotvvmProjectAssembly);
             InitializeDotvvmControls(dotvvmProjectAssembly);
             return DotvvmProject.GetConfiguration(dotvvmProjectAssembly, dotvvmProjectDir, services =>
             {
@@ -300,6 +301,24 @@
                 return TypeRegistry.CreateStatic(type);
             });
             resolversField.SetValue(TypeRegistry.Default, resolvers);
+#endif
+        }
+
+        private static void ReplaceDefaultDependencyContext(Assembly projectAssembly)
+        {
+#if NET461
+            return;
+#else
+            var projectContext = Microsoft.Extensions.DependencyModel.DependencyContext.Load(projectAssembly);
+            var mergedContext = Microsoft.Extensions.DependencyModel.DependencyContext.Default.Merge(projectContext);
+            var fields = typeof(Microsoft.Extensions.DependencyModel.DependencyContext)
+                 .GetFields(BindingFlags.NonPublic | BindingFlags.Instance)!;
+            foreach (var field in fields)
+            {
+                field.SetValue(
+                    Microsoft.Extensions.DependencyModel.DependencyContext.Default,
+                    field.GetValue(mergedContext));
+            }
 #endif
         }


assigning max

assigning max

--- src/EasyRpc.AspNetCore/Data/ObjectPool.cs
+++ src/EasyRpc.AspNetCore/Data/ObjectPool.cs
@@ -24,6 +24,8 @@
         /// <param name="max"></param>
         public ObjectPool(Func<T> createFunc, int max = 0)
         {
+            _max = max;
+
             _createFunc = createFunc;
         }


fix formatting.

fix formatting.

--- src/Editor/OSREEditor/View/OSREWrapper.cs
+++ src/Editor/OSREEditor/View/OSREWrapper.cs
@@ -3,19 +3,25 @@
 using System.Windows.Forms;

 namespace OSREEditor.View {
+
     /// <summary>
     /// The OSRE native wrapper, contains prototypes for calling native methods from OSRE.
     /// </summary>
     public class OSREWrapper : IDisposable {
         #region Private Attributes

+
+#if DEBUG
+        private const string EditorDllName = "osre_nativeeditord.dll";
+#else
         private const string EditorDllName = "osre_nativeeditor.dll";
+#endif

         private static TextBox _logger;

-        #endregion
+#endregion

-        #region Native Interface Wrapper
+#region Native Interface Wrapper

         /// <summary>
         /// Will create the editor native application instance.
@@ -122,7 +128,7 @@
         [DllImport(EditorDllName, CharSet = CharSet.Auto)]
         public static extern void EditorResize(int x, int y, int w, int h);

-        #endregion
+#endregion

         [DllImport(EditorDllName, CharSet = CharSet.Auto)]
         private static extern void RegisterLogCallback(IntPtr fc);


Maintain JsProject.HasChanges

Maintain JsProject.HasChanges

--- src/Examples/MyStudio/Models/JsProject.cs
+++ src/Examples/MyStudio/Models/JsProject.cs
@@ -63,6 +63,13 @@

             File.WriteAllText(path, this.MainScript);
             this.MainScriptFilePath = path;
+            this.HasChanges = false;
+        }
+
+        protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e)
+        {
+            base.OnPropertyChanged(e);
+            this.HasChanges = true;
         }
     }
 }


[generator] Check if we've already visited the declaration in CheckIgnoredDecls.VisitFunctionTemplateDecl.

Thanks to @ddobrev for the heads up in code review.

--- src/Generator/Passes/CheckIgnoredDecls.cs
+++ src/Generator/Passes/CheckIgnoredDecls.cs
@@ -98,6 +98,9 @@

         public override bool VisitFunctionTemplateDecl(FunctionTemplate decl)
         {
+             if (!base.VisitFunctionTemplateDecl(decl))
+                 return false;
+
             if (decl.TemplatedFunction.IsDependent && !decl.IsExplicitlyGenerated)
             {
                 decl.TemplatedFunction.GenerationKind = GenerationKind.None;


Return early for GetAllKeys if it's TestBlobCache

--- Akavache.Tests/BlobCacheExtensionsFixture.cs
+++ Akavache.Tests/BlobCacheExtensionsFixture.cs
@@ -227,6 +227,9 @@
                     Assert.Equal("Foo", result.Item1);
                     Assert.Equal("Bar", result.Item2);
                     Assert.Equal(1, fetchCount);
+
+                    // Testing persistence makes zero sense for TestBlobCache
+                    if (fixture is TestBlobCache) return;
                 }

                 using(var fixture = CreateBlobCache(path))
@@ -368,17 +371,24 @@
                         fixture.InsertObject("Bar", 10),
                         fixture.InsertObject("Baz", new UserObject() { Bio = "Bio", Blog = "Blog", Name = "Name" })
                     ).Last();
-                }
-
-                fixture.Shutdown.Wait();
-
-                using (fixture = CreateBlobCache(path))
-                {
+
                     var keys = fixture.GetAllKeys();
                     Assert.Equal(3, keys.Count());
                     Assert.True(keys.Any(x => x.Contains("Foo")));
                     Assert.True(keys.Any(x => x.Contains("Bar")));
                 }
+
+                fixture.Shutdown.Wait();
+
+                if (fixture is TestBlobCache) return;
+
+                using (fixture = CreateBlobCache(path))
+                {
+                    var keys = fixture.GetAllKeys();
+                    Assert.Equal(3, keys.Count());
+                    Assert.True(keys.Any(x => x.Contains("Foo")));
+                    Assert.True(keys.Any(x => x.Contains("Bar")));
+                }
             }
         }
     }


Completed two outstanding TODOs

Completed two outstanding TODOs

--- AngleSharp/DOM/Html/Forms/HTMLFormElement.cs
+++ AngleSharp/DOM/Html/Forms/HTMLFormElement.cs
@@ -258,7 +258,7 @@

         void SubmitForm(HTMLElement from, Boolean submittedFromSubmitMethod)
         {
-            var formDocument = Owner;
+            var owner = Owner;

             //TODO
             //If form document has no associated browsing context or its active
@@ -276,22 +276,20 @@
                 }
             }

-            var action = String.IsNullOrEmpty(Action) ? new Url(formDocument.DocumentUri) : this.HyperReference(Action);
-
-            //TODO
-            //If the user indicated a specific browsing context to use when submitting
-            //the form, then let target browsing context be that browsing context.
-            //Otherwise, apply the rules for choosing a browsing context given a browsing
-            //context name using target as the name and form browsing context as the
-            //context in which the algorithm is executed, and let target browsing context
-            //be the resulting browsing context.
-
-            //TODO
-            //var replace = false;
-            //If target browsing context was created in the previous step, or, alternatively,
-            //if the form document has not yet completely loaded and the submitted from
-            //submit() method is set, then let replace be true. Otherwise, let it be false
-
+            var action = String.IsNullOrEmpty(Action) ? new Url(owner.DocumentUri) : this.HyperReference(Action);
+            var createdBrowsingContext = false;
+            var targetBrowsingContext = owner.Context;
+            var target = Target;
+
+            if (!String.IsNullOrEmpty(target))
+            {
+                targetBrowsingContext = owner.GetTarget(target);
+
+                if (createdBrowsingContext = (targetBrowsingContext == null))
+                    targetBrowsingContext = owner.CreateTarget(target);
+            }
+
+            var replace = createdBrowsingContext || owner.ReadyState != DocumentReadyState.Complete;
             var scheme = action.Scheme;
             var method = Method.ToEnum(HttpMethod.Get);


Fixed missing async call

Fixed missing async call

--- Arke.Steps/ArkeInitStep/ArkeInitProcessor.cs
+++ Arke.Steps/ArkeInitStep/ArkeInitProcessor.cs
@@ -35,6 +35,8 @@
             {
                 _call.CallState.TerminationCode = TerminationCode.InvalidDeviceConfig;
                 _call.CallState.AddStepToIncomingQueue(step.GetStepFromConnector(FailStep));
+                await _call.FireStateChange(SipEngine.FSM.Trigger.FailedCallFlow);
+                return;
             }

             _call.CallState.AddStepToIncomingQueue(step.GetStepFromConnector(NextStep));


new constructor, flags can now be added

new constructor, flags can now be added

--- Assets/Scripts/Model/Characters/Character.cs
+++ Assets/Scripts/Model/Characters/Character.cs
@@ -57,6 +57,8 @@

         public Character(Stats stats, Look look, Brain brain, SpellBooks spells) : this(stats, look, brain, spells, new Inventory(), new Equipment()) { }

+        public Character(Stats stats, Look look, Brain brain) : this(stats, look, brain, new SpellBooks(), new Inventory(), new Equipment()) { }
+
         /// <summary>
         /// Used in serialization for parties
         /// </summary>
@@ -88,6 +90,10 @@
                 && this.Inventory.Equals(item.Inventory)
                 && this.flags.SetEquals(item.flags)
                 && this.Equipment.Equals(item.Equipment);
+        }
+
+        public void AddFlag(Flag f) {
+            flags.Add(f);
         }

         public bool HasFlag(Flag f) {


Fixed IL2CPP compilation error: cannot initialize return object of type 'Promise_1_t6354 *' with an lvalue of type 'RejectedPromise_1_t10237 *' return __this;

--- Assets/Scripts/UniPromise/RejectedPromise.cs
+++ Assets/Scripts/UniPromise/RejectedPromise.cs
@@ -29,7 +29,7 @@
 		}

 		public override Promise<U> Then<U> (Func<T, Promise<U>> done) {
-			return this;
+			return new RejectedPromise<U>(e);
 		}

 		public override Promise<T> Clone () {


Added comments and abstracted List<string> to IList<string>

--- BlackVueDownloader.PCL/BlackVueDownloader.cs
+++ BlackVueDownloader.PCL/BlackVueDownloader.cs
@@ -10,16 +10,27 @@
     {
         private readonly IFileSystemHelper _fileSystemHelper;

+        /// <summary>
+        /// Instance Downloader with Moq friendly constructor
+        /// </summary>
+        /// <param name="fileSystemHelper"></param>
         public BlackVueDownloader(IFileSystemHelper fileSystemHelper)
         {
             _fileSystemHelper = fileSystemHelper;
         }

+        /// <summary>
+        /// Instance Downloader with base constructor
+        /// </summary>
         public BlackVueDownloader()
         {
             _fileSystemHelper = new FileSystemHelper();
         }

+        /// <summary>
+        /// Main control flow
+        /// </summary>
+        /// <param name="ip"></param>
         public void Run(string ip)
         {
             var body = QueryCameraForFileList(ip);
@@ -34,7 +45,12 @@
             return IPAddress.TryParse(ip, out address);
         }

-        public List<string> GetListOfFilesFromResponse(string body)
+        /// <summary>
+        /// Connect to the camera and get a list of files
+        /// </summary>
+        /// <param name="body"></param>
+        /// <returns>Normalized list of files</returns>
+        public IList<string> GetListOfFilesFromResponse(string body)
         {
             var fileList = new List<string>();

@@ -49,6 +65,13 @@
             return fileList;
         }

+        /// <summary>
+        /// For given camera ip, filename, and filetype, download the file and return a status
+        /// </summary>
+        /// <param name="ip"></param>
+        /// <param name="filename"></param>
+        /// <param name="filetype"></param>
+        /// <param name="blackVueDownloaderCopyStats"></param>
         public void DownloadFile(string ip, string filename, string filetype,
             ref BlackVueDownloaderCopyStats blackVueDownloaderCopyStats)
         {
@@ -88,13 +111,19 @@
             }
         }

-        public void ProcessList(string ip, List<string> list)
+        public void ProcessList(string ip, IList<string> list)
         {
             var blackVueDownloaderCopyStats = new BlackVueDownloaderCopyStats();
             ProcessList(ip, list, ref blackVueDownloaderCopyStats);
         }

-        public void ProcessList(string ip, List<string> list,
+        /// <summary>
+        /// For the list, loop through and process it
+        /// </summary>
+        /// <param name="ip"></param>
+        /// <param name="list"></param>
+        /// <param name="blackVueDownloaderCopyStats"></param>
+        public void ProcessList(string ip, IList<string> list,
             ref BlackVueDownloaderCopyStats blackVueDownloaderCopyStats)
         {
             var sw = new Stopwatch();
@@ -126,6 +155,11 @@
                 $"Copied {blackVueDownloaderCopyStats.Copied}, Ignored {blackVueDownloaderCopyStats.Ignored}, Errored {blackVueDownloaderCopyStats.Errored} TotalTime {blackVueDownloaderCopyStats.TotalTime}");
         }

+        /// <summary>
+        /// Get a raw string response from the camera
+        /// </summary>
+        /// <param name="ip"></param>
+        /// <returns>Raw string list of files</returns>
         public string QueryCameraForFileList(string ip)
         {
             try


Reversed return values.

Reversed return values.

--- source/Cosmos.IL2CPU/AppAssembler.cs
+++ source/Cosmos.IL2CPU/AppAssembler.cs
@@ -357,7 +357,7 @@
             if (xReturnSize > 0)
             {
                 var xOffset = GetResultCodeOffset(xReturnSize, (uint)xTotalArgsSize);
-                for (int i = ((int)(xReturnSize/4)) - 1; i >= 0; i--)
+                for (int i = 0; i < ((int)(xReturnSize/4)); i++)
                 {
                     new Pop { DestinationReg = Registers.EAX };
                     new Mov { DestinationReg = Registers.EBP, DestinationIsIndirect = true, DestinationDisplacement = (int)(xOffset + ((i + 0) * 4)), SourceReg = Registers.EAX };


Set some tests to Ignore (need to stub Http Requests)

--- DriverTest/Form.cs
+++ DriverTest/Form.cs
@@ -150,6 +150,7 @@
 		}

 		[Test]
+    [Ignore]
 		public void SubmitGetForm()
 		{
 			Browser b = new Browser();
@@ -191,6 +192,7 @@
 			Assert.That(lastRequest.Contains("submitButton=button1"), "Value of submit button not posted");
 		}
 		[Test]
+    [Ignore]
 		public void SubmitPostForm()
 		{
 			Browser b = new Browser();
@@ -238,6 +240,7 @@
 			Assert.That(lastRequest.AllKeys.Contains("submitButton2") && lastRequest["submitButton2"].Contains("button2"), "Value of submit button not posted");
 		}
 		[Test]
+    [Ignore]
 		public void PostAspnetPostbackForm()
 		{
 			Browser b = new Browser();


Eliminated BuildFunction stuff, check main signature

--- runtime/Generator.cs
+++ runtime/Generator.cs
@@ -94,32 +94,37 @@

         internal static Main JitProgram(List<Source> sources)
         {
-            LLVMModuleRef module = LLVMModuleRef.CreateWithName("JIT module");
-            Generate(module, sources);
-            VerifyAndInitialize(module);
+            LLVMModuleRef module = LLVMModuleRef.CreateWithName("");
+            var function = GenerateAndVerify(sources, module);
             var engine = module.CreateMCJITCompiler();
-            var function = module.GetNamedFunction("main");
             var jitMain = engine.GetPointerToGlobal<Main>(function);
             return jitMain;
         }

         internal static void GenerateProgram(List<Source> sources, string outputName)
         {
-            LLVMModuleRef module = LLVMModuleRef.CreateWithName(string.Empty);
-            Generate(module, sources);
-
-            VerifyAndInitialize(module);
+            LLVMModuleRef module = LLVMModuleRef.CreateWithName("");
+            GenerateAndVerify(sources, module);
             LLVM.InitializeAllTargetInfos();
             var triple = LLVMTargetRef.DefaultTriple;
             LLVMTargetRef target = LLVMTargetRef.GetTargetFromTriple(triple);
             LLVMTargetMachineRef targetMachine = target.CreateTargetMachine(triple, "", "",
                 LLVMCodeGenOptLevel.LLVMCodeGenLevelDefault, LLVMRelocMode.LLVMRelocDefault,
                 LLVMCodeModel.LLVMCodeModelDefault);
-            var message = "";
-            targetMachine.TryEmitToFile(module, $"{outputName}.o", LLVMCodeGenFileType.LLVMObjectFile, out message);
-        }
-
-        static void Generate(LLVMModuleRef module, List<Source> sources)
+            targetMachine.EmitToFile(module, $"{outputName}.o", LLVMCodeGenFileType.LLVMObjectFile);
+        }
+
+        static LLVMValueRef GenerateAndVerify(List<Source> sources, LLVMModuleRef module)
+        {
+            var function = Generate(module, sources);
+            module.Verify(LLVMVerifierFailureAction.LLVMPrintMessageAction);
+            LLVM.InitializeNativeTarget();
+            LLVM.InitializeNativeAsmParser();
+            LLVM.InitializeNativeAsmPrinter();
+            return function;
+        }
+
+        static LLVMValueRef Generate(LLVMModuleRef module, List<Source> sources)
         {
             var dictionary = new NameDictionary();
             {
@@ -133,42 +138,58 @@

             {
                 var globalContext = new GlobalContext { Module = module, Dictionary = dictionary };
-                foreach (var source in sources)
-                {
-                    var context = new Context { Global = globalContext, Source = source };
-                    BuildSourceFunctions(context);
-                }
-            }
-        }
-
-        static void BuildSourceFunctions(Context context)
-        {
-            if (context.Source.Functions != null)
-            {
-                foreach (var function in context.Source.Functions)
-                {
-                    BuildFunction(context, null, function);
-                }
-            }
-
-            if (context.Source.Sources != null)
-            {
-                foreach (var source in context.Source.Sources)
-                {
-                    var newContext = new Context { Global = context.Global, Source = source };
-                    BuildSourceFunctions(newContext);
-                }
-            }
-        }
-
-        static KeyValuePair<TypeSpec, LLVMValueRef> BuildFunction(Context context, Dictionary<string, TypeSpec> genericTypeDictionary, Function function)
-        {
-            var functionValue = ResolveFunctionValue(context, genericTypeDictionary, function);
+                var mainName = "main";
+                var context = new Context { Global = globalContext, Source = globalContext.Dictionary.Sources[mainName] };
+                var function = GetMainFunction(context, mainName);
+                var functionValue = ResolveFunctionValue(context, null, function);
+                return functionValue.Value;
+            }
+        }
+
+        static KeyValuePair<TypeSpec, LLVMValueRef> ResolveFunctionValue(Context context, Dictionary<string, TypeSpec> genericTypeDictionary, Function function)
+        {
+            var functionName = QualifyFunctionName(context, function);
+            if (!context.Global.Values.ContainsKey(functionName))
+                CreateFunctionValue(context, genericTypeDictionary, function);
+            var llvmFunction = context.Global.Values[function.Name];
+            return llvmFunction;
+        }
+
+        static string QualifyFunctionName(Context context, Function function)
+        {
+            if ((function.Routine.Implementation == Implementation.Extern) || (function.Name == "main"))
+                return function.Name;
+
+            var functionNameBuilder = new StringBuilder();
+
+            functionNameBuilder.Append(function.Name);
+            functionNameBuilder.Append('(');
+            var first = true;
+            foreach (var parameter in function.Routine.Input)
+            {
+                if (first)
+                    first = false;
+                else
+                    functionNameBuilder.Append(',');
+                functionNameBuilder.Append(parameter.TypeSpec.Name);
+            }
+            functionNameBuilder.Append(')');
+            return functionNameBuilder.ToString();
+        }
+
+        static void CreateFunctionValue(Context context, Dictionary<string, TypeSpec> genericTypeDictionary, Function function)
+        {
+            var functionType = ResolveFunctionType(context, genericTypeDictionary, function);
+            var functionName = QualifyFunctionName(context, function);
+            if (context.Global.Values.ContainsKey(functionName))
+                throw new CompilerException($"Function {function.Name} was already defined with the same arguments.", function.Span);
+            var functionValue = context.Global.Module.AddFunction(functionName, functionType);
+            context.Global.Values.Add(functionName, new KeyValuePair<TypeSpec, LLVMValueRef>(function.Routine.Result[0].TypeSpec, functionValue));
             switch (function.Routine.Implementation)
             {
                 case Implementation.Intern:
                     {
-                        var block = functionValue.Value.AppendBasicBlock(string.Empty);
+                        var block = functionValue.AppendBasicBlock(string.Empty);
                         using (var builder = context.Global.Module.Context.CreateBuilder())
                         {
                             var newContext = new Context { Global = context.Global, Builder = builder, Source = context.Source, };
@@ -176,7 +197,7 @@
                             uint paramCount = 0;
                             foreach (var parameter in function.Routine.Input)
                             {
-                                newContext.Values.Add(parameter.Name, new KeyValuePair<TypeSpec, LLVMValueRef>(parameter.TypeSpec, functionValue.Value.GetParam(paramCount)));
+                                newContext.Values.Add(parameter.Name, new KeyValuePair<TypeSpec, LLVMValueRef>(parameter.TypeSpec, functionValue.GetParam(paramCount)));
                                 paramCount++;
                             }
                             builder.BuildRet(BuildOperands(newContext, function.Routine.Operation.Operands).Value);
@@ -185,54 +206,12 @@
                     break;
                 case Implementation.Extern:
                     {
-                        var f = functionValue.Value;
-                        f.Linkage = LLVMLinkage.LLVMExternalLinkage;
+                        functionValue.Linkage = LLVMLinkage.LLVMExternalLinkage;
                         break;
                     }
                 default:
                     throw new CompilerException($"The implementation type {function.Routine.Implementation} is not implemented.", function.Span);
             }
-            return functionValue;
-        }
-
-        static KeyValuePair<TypeSpec, LLVMValueRef> ResolveFunctionValue(Context context, Dictionary<string, TypeSpec> genericTypeDictionary, Function function)
-        {
-            var functionName = QualifyFunctionName(context, function);
-            if (!context.Global.Values.ContainsKey(functionName))
-                CreateFunctionValue(context, genericTypeDictionary, function);
-            var llvmFunction = context.Global.Values[function.Name];
-            return llvmFunction;
-        }
-
-        static string QualifyFunctionName(Context context, Function function)
-        {
-            if ((function.Routine.Implementation == Implementation.Extern) || (function.Name == "main"))
-                return function.Name;
-
-            var functionNameBuilder = new StringBuilder();
-
-            functionNameBuilder.Append(function.Name);
-            functionNameBuilder.Append('(');
-            var first = true;
-            foreach (var parameter in function.Routine.Input)
-            {
-                if (first)
-                    first = false;
-                else
-                    functionNameBuilder.Append(',');
-                functionNameBuilder.Append(parameter.TypeSpec.Name);
-            }
-            functionNameBuilder.Append(')');
-            return functionNameBuilder.ToString();
-        }
-
-        static void CreateFunctionValue(Context context, Dictionary<string, TypeSpec> genericTypeDictionary, Function function)
-        {
-            var functionType = ResolveFunctionType(context, genericTypeDictionary, function);
-            var functionName = QualifyFunctionName(context, function);
-            if (context.Global.Values.ContainsKey(functionName))
-                throw new CompilerException($"Function {function.Name} was already defined with the same arguments.", function.Span);
-            context.Global.Values.Add(functionName, new KeyValuePair<TypeSpec, LLVMValueRef>(function.Routine.Result[0].TypeSpec, context.Global.Module.AddFunction(functionName, functionType)));
         }

         static LLVMTypeRef ResolveFunctionType(Context context, Dictionary<string, TypeSpec> genericTypeDictionary, Function function)
@@ -735,12 +714,54 @@
             context.Dictionary.Sources.Add(path, context.Source);
         }

-        static void VerifyAndInitialize(LLVMModuleRef module)
-        {
-            module.Verify(LLVMVerifierFailureAction.LLVMPrintMessageAction);
-            LLVM.InitializeNativeTarget();
-            LLVM.InitializeNativeAsmParser();
-            LLVM.InitializeNativeAsmPrinter();
+        static Function GetMainFunction(Context context, string mainName)
+        {
+            if (!context.Global.Dictionary.Functions.ContainsKey(mainName))
+                throw new CompilerException("No main function found.", new Span { file = "", start = new Position { line = 0, column = 0 }, end = new Position { line = 0, column = 0 }, });
+            var functions = context.Global.Dictionary.Functions[mainName];
+            if (functions.Count == 0)
+                throw new CompilerException("No main function found.", new Span { file = "", start = new Position { line = 0, column = 0 }, end = new Position { line = 0, column = 0 }, });
+            if (functions.Count > 1)
+                throw new CompilerException("More than one main function found.", new Span { file = "", start = new Position { line = 0, column = 0 }, end = new Position { line = 0, column = 0 }, });
+            var function = functions.First();
+            if (function.Routine.Result == null)
+                throw new CompilerException("Main function has no return value. The return value must be Integer.", function.Span);
+            if (function.Routine.Result.Count != 1)
+                throw new CompilerException("Main function has the wrong number of results. It has to return exactly one Integer.", function.Span);
+            var result = function.Routine.Result[0].TypeSpec;
+            if (result.Name != "Integer")
+                throw new CompilerException("Main function has the wrong return value type. The return value must be of type Integer.", function.Span);
+            var argcName = "argument count";
+            var argcType = "Integer";
+            var argvName = "argument values";
+            var argvType = "Pointer";
+            var charType = "Byte";
+            var parameterSentence = $"The parameters must be '{argcName}': {argcType}, '{argvName}': {argvType}.";
+            if (function.Routine.Input == null)
+                throw new CompilerException($"Main function has no parameters. {parameterSentence}", function.Span);
+            if (function.Routine.Input.Count != 2)
+                throw new CompilerException($"Main function has the wrong number of parameters. {parameterSentence}", function.Span);
+            var argc = function.Routine.Input[0];
+            if (argc.Name != argcName)
+                throw new CompilerException($"The first parameter of the main function has the wrong name. {parameterSentence}", function.Span);
+            if (argc.TypeSpec.Name != argcType)
+                throw new CompilerException($"The first parameter of the main function has the wrong type. {parameterSentence}", function.Span);
+            var argv = function.Routine.Input[1];
+            if (argv.Name != argvName)
+                throw new CompilerException($"The second parameter of the main function has the wrong name. {parameterSentence}", function.Span);
+            if
+            (
+                argv.TypeSpec.Name == argvType
+                && argv.TypeSpec.Arguments != null
+                && argv.TypeSpec.Arguments.Count == 1
+                && argv.TypeSpec.Arguments[0].Name == argvType
+                && argv.TypeSpec.Arguments[0].Arguments != null
+                && argv.TypeSpec.Arguments[0].Arguments.Count == 1
+                && argv.TypeSpec.Arguments[0].Arguments[0].Name == charType
+            )
+                return function;
+            else
+                throw new CompilerException($"The second parameter of the main function has the wrong type. {parameterSentence}", function.Span);
         }
     }
 }


v0.8.12

--- TCC.Core/Properties/AssemblyInfo.cs
+++ TCC.Core/Properties/AssemblyInfo.cs
@@ -49,5 +49,5 @@
 // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
 // usando l'asterisco '*' come illustrato di seguito:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.8.11.0")]
-[assembly: AssemblyFileVersion("0.8.11.0")]
+[assembly: AssemblyVersion("0.8.12.0")]
+[assembly: AssemblyFileVersion("0.8.12.0")]


Fix V3105 warning from PVS-Studio Static Analyzer

--- TaskEditor/SystemEventEnumerator.cs
+++ TaskEditor/SystemEventEnumerator.cs
@@ -91,7 +91,7 @@
 				Type elhType = session?.GetType().Assembly.GetType("System.Diagnostics.Eventing.Reader.EventLogHandle");
 				SessionHandlePI = session?.GetType().GetProperty("Handle", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, elhType, Type.EmptyTypes, null);
 			}
-			object o = SessionHandlePI.GetValue(session, null);
+			object o = SessionHandlePI?.GetValue(session, null);
 			if (o != null)
 				hEvt = ((SafeHandle)o).DangerousGetHandle();


javascript months are 0 based.

javascript months are 0 based.

--- source/MongoDB/Util/JsonFormatter.cs
+++ source/MongoDB/Util/JsonFormatter.cs
@@ -44,7 +44,7 @@
             if (value is DateTime)
             {
                 DateTime d = (DateTime)value;
-                sb.AppendFormat("new Date({0},{1},{2},{3},{4},{5},{6})", d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second, d.Millisecond);
+                sb.AppendFormat("new Date({0},{1},{2},{3},{4},{5},{6})", d.Year, d.Month - 1, d.Day, d.Hour, d.Minute, d.Second, d.Millisecond);
             }
             else
                 SerializeType(value, sb);


Minor display fix

Minor display fix

--- WinPlayer/MainWindow.xaml.cs
+++ WinPlayer/MainWindow.xaml.cs
@@ -48,9 +48,9 @@

             LoginBtn.Content = Server.Login;
             if (!string.IsNullOrEmpty(Server.AccountInfo.StorageProviderName))
-                StorageBtn.Content = "Storage: " + Server.AccountInfo.StorageProviderName;
+                StorageBtn.Content = Server.AccountInfo.StorageProviderName;
             else
-                StorageBtn.Content = "Storage: none";
+                StorageBtn.Content = "No storage";
             OnLibSelect(curLib.Id);   // Select first lib
             ShowDetails(null);   // Hide the details pane
             ProdType.Text = Server.License.ProdTypeStr().ToUpper();


Change LxWxH in Parcel to doubles

Change LxWxH in Parcel to doubles

--- EasyPost/Parcel.cs
+++ EasyPost/Parcel.cs
@@ -11,9 +11,9 @@
         public string id { get; set; }
         public DateTime created_at { get; set; }
         public DateTime updated_at { get; set; }
-        public int length { get; set; }
-        public int width { get; set; }
-        public int height { get; set; }
+        public double length { get; set; }
+        public double width { get; set; }
+        public double height { get; set; }
         public double weight { get; set; }
         public string predefined_package { get; set; }
         public string mode { get; set; }


Bumping version to 1.2.5-beta

Bumping version to 1.2.5-beta

--- Uncommon/Properties/AssemblyInfo.cs
+++ Uncommon/Properties/AssemblyInfo.cs
@@ -26,4 +26,4 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.4.0")]
+[assembly: AssemblyVersion("1.2.5.0")]