Some internal behavior changes to screen. First, the TryClose method, if the screen is not in an IConductor, now searches through all cached views, not just the default, looking for one that can be closed. This fixes a bug in the case where a modal dialog with a contextual view needs to be closed. Previously, the view would not be found when calling TryClose on the screen and an exception would be thrown. Second, the view cache for a screen is now cleared when the screen is CLOSED. It is NOT cleared on deactivation only. This is because the primary use case was the need to keep expensive views around when screens were deactivated or hidden so that they wouldn't need to be reconstructed. However, if a screen is truly closed, there should be no reason to maintain a reference to its view. This seams to be the behavior that developers expected and has caused some issues in the past by not working this way. So now the Screen's view cache is cleared when the screen is closed. This also makes it easier to use singleton view models for modal dialogs.

--- src/Caliburn.PresentationFramework/Screens/Screen.cs
+++ src/Caliburn.PresentationFramework/Screens/Screen.cs
@@ -136,7 +136,7 @@

         void IDeactivate.Deactivate(bool close)
         {
-            if(!IsActive && !IsInitialized)
+            if (!IsActive && !IsInitialized)
                 return;

             AttemptingDeactivation(this, new DeactivationEventArgs {
@@ -147,12 +147,14 @@
             Log.Info("Deactivating {0}.", this);
             OnDeactivate(close);

-            if(close)
-                Log.Info("Closed {0}.", this);
-
             Deactivated(this, new DeactivationEventArgs {
                 WasClosed = close
             });
+
+            if (close) {
+                views.Clear();
+                Log.Info("Closed {0}.", this);
+            }
         }

         /// <summary>
@@ -211,67 +213,64 @@
         /// </summary>
         public event EventHandler<ViewAttachedEventArgs> ViewAttached = delegate { };

-        /// <summary>
-        /// Tries to close this instance by asking its Parent to initiate shutdown or by asking it's corresponding default view to close.
+        Action GetViewCloseAction(bool? dialogResult)
+        {
+            var conductor = Parent as IConductor;
+            if (conductor != null)
+                return () => conductor.CloseItem(this);
+
+            foreach (var contextualView in views.Values) {
+                var viewType = contextualView.GetType();
+
+                var closeMethod = viewType.GetMethod("Close");
+                if (closeMethod != null)
+                    return () => {
+#if !SILVERLIGHT
+                        if (dialogResult != null) {
+                            var resultProperty = contextualView.GetType().GetProperty("DialogResult");
+                            if (resultProperty != null)
+                                resultProperty.SetValue(contextualView, dialogResult, null);
+                        }
+#endif
+
+                        closeMethod.Invoke(contextualView, null);
+                    };
+
+                var isOpenProperty = viewType.GetProperty("IsOpen");
+                if (isOpenProperty != null)
+                    return () => isOpenProperty.SetValue(contextualView, false, null);
+            }
+
+            return () => {
+                var ex = new NotSupportedException("TryClose requires a parent IConductor or a view with a Close method or IsOpen property.");
+                Log.Error(ex);
+                throw ex;
+            };
+        }
+
+        /// <summary>
+        /// Tries to close this instance by asking its Parent to initiate shutdown or by asking it's corresponding view to close.
         /// </summary>
         public void TryClose()
         {
-            Execute.OnUIThread(() =>{
-                var conductor = Parent as IConductor;
-                if (conductor != null)
-                    conductor.CloseItem(this);
-                else
-                {
-                    var view = GetView(null);
-
-                    if(view == null)
-                    {
-                        var ex = new NotSupportedException("A Parent or default view is required.");
-                        Log.Error(ex);
-                        throw ex;
-                    }
-
-                    var method = view.GetType().GetMethod("Close");
-                    if(method != null)
-                    {
-                        method.Invoke(view, null);
-                        return;
-                    }
-
-                    var property = view.GetType().GetProperty("IsOpen");
-                    if(property != null)
-                    {
-                        property.SetValue(view, false, new object[] {});
-                        return;
-                    }
-
-                    var ex2 = new NotSupportedException("The default view does not support Close/IsOpen.");
-                    Log.Error(ex2);
-                    throw ex2;
-                }
+            Execute.OnUIThread(() => {
+                var closeAction = GetViewCloseAction(null);
+                closeAction();
             });
         }

 #if !SILVERLIGHT

         /// <summary>
-        /// Closes this instance by asking its Parent to initiate shutdown or by asking it's corresponding default view to close.
-        /// This overload also provides an opportunity to pass a dialog result to it's corresponding default view.
+        /// Closes this instance by asking its Parent to initiate shutdown or by asking it's corresponding view to close.
+        /// This overload also provides an opportunity to pass a dialog result to it's corresponding view.
         /// </summary>
         /// <param name="dialogResult">The dialog result.</param>
         public virtual void TryClose(bool? dialogResult)
         {
-            Execute.OnUIThread(() =>{
-                var view = GetView(null);
-
-                if(view != null)
-                {
-                    var property = view.GetType().GetProperty("DialogResult");
-                    if(property != null)
-                        property.SetValue(view, dialogResult, null);
-                }
-
-                TryClose();
+            Execute.OnUIThread(() => {
+                var closeAction = GetViewCloseAction(dialogResult);
+                closeAction();
             });
         }


Fixed assembly version for Core package

Fixed assembly version for Core package

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


CLEANUP Test: consistent newlines.

CLEANUP Test: consistent newlines.

--- tests/TestCases/ObjectMapper/CyclicReferenceTest.cs
+++ tests/TestCases/ObjectMapper/CyclicReferenceTest.cs
@@ -1,68 +1,68 @@
-//
-// Copyright (c) 2014 Piotr Fusik <piotr@fusik.info>
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-//   this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright notice,
-//   this list of conditions and the following disclaimer in the documentation
-//   and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Copyright (c) 2014 Piotr Fusik <piotr@fusik.info>
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+//   this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright notice,
+//   this list of conditions and the following disclaimer in the documentation
+//   and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
 //

 using NUnit.Framework;
 using Sooda.UnitTests.Objects;
-using System;
-
-namespace Sooda.UnitTests.TestCases.ObjectMapper
-{
-    [TestFixture]
-    public class CyclicReferenceTest
-    {
-        [Test]
-        public void MissingReference()
-        {
-            int id1;
-            int id2;
-            using (SoodaTransaction tran = new SoodaTransaction())
-            {
-                EightFields o1 = new EightFields();
-                EightFields o2 = new EightFields();
-                o1.TimeSpan = TimeSpan.FromSeconds(1);
-                o2.TimeSpan = TimeSpan.FromSeconds(2);
-                id1 = o1.Id;
-                id2 = o2.Id;
-                o1.Parent = o2;
-                o2.Parent = o1;
-                tran.Commit();
-            }
-
-            using (SoodaTransaction tran = new SoodaTransaction())
-            {
-                tran.CachingPolicy = new Sooda.Caching.SoodaCacheAllPolicy();
-                EightFields o1 = EightFields.GetRef(id1);
-                EightFields o2 = EightFields.GetRef(id2);
-                Assert.AreEqual(o2, o1.Parent);
-                Assert.AreEqual(o1, o2.Parent);
-                tran.Commit();
-            }
-        }
-    }
-}
+using System;
+
+namespace Sooda.UnitTests.TestCases.ObjectMapper
+{
+    [TestFixture]
+    public class CyclicReferenceTest
+    {
+        [Test]
+        public void MissingReference()
+        {
+            int id1;
+            int id2;
+            using (SoodaTransaction tran = new SoodaTransaction())
+            {
+                EightFields o1 = new EightFields();
+                EightFields o2 = new EightFields();
+                o1.TimeSpan = TimeSpan.FromSeconds(1);
+                o2.TimeSpan = TimeSpan.FromSeconds(2);
+                id1 = o1.Id;
+                id2 = o2.Id;
+                o1.Parent = o2;
+                o2.Parent = o1;
+                tran.Commit();
+            }
+
+            using (SoodaTransaction tran = new SoodaTransaction())
+            {
+                tran.CachingPolicy = new Sooda.Caching.SoodaCacheAllPolicy();
+                EightFields o1 = EightFields.GetRef(id1);
+                EightFields o2 = EightFields.GetRef(id2);
+                Assert.AreEqual(o2, o1.Parent);
+                Assert.AreEqual(o1, o2.Parent);
+                tran.Commit();
+            }
+        }
+    }
+}


Cleanup, consistency & fixes

Cleanup, consistency & fixes

--- src/redmine-net-api/RedmineManager.cs
+++ src/redmine-net-api/RedmineManager.cs
@@ -1,4 +1,4 @@
-/*
+/*
    Copyright 2011 - 2019 Adrian Popescu.

    Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,6 @@
 using System.Security.Cryptography.X509Certificates;
 using System.Text;
 using System.Text.RegularExpressions;
-using System.Web;
 using Redmine.Net.Api.Exceptions;
 using Redmine.Net.Api.Extensions;
 using Redmine.Net.Api.Internals;
@@ -43,7 +42,7 @@
         ///
         public const int DEFAULT_PAGE_SIZE_VALUE = 25;

-        private static readonly Dictionary<Type, string> routes = new Dictionary<Type, string>
+        private static readonly Dictionary<Type, string> Routes = new Dictionary<Type, string>
         {
             {typeof(Issue), "issues"},
             {typeof(Project), "projects"},
@@ -65,10 +64,9 @@
             {typeof(Watcher), "watchers"},
             {typeof(IssueCustomField), "custom_fields"},
             {typeof(CustomField), "custom_fields"}
-     //       {typeof(WikiPage), ""}
         };
-
-        private static readonly Dictionary<Type, bool> typesWithOffset = new Dictionary<Type, bool>{
+
+        private static readonly Dictionary<Type, bool> TypesWithOffset = new Dictionary<Type, bool>{
             {typeof(Issue), true},
             {typeof(Project), true},
             {typeof(User), true},
@@ -81,7 +79,9 @@
         private readonly string basicAuthorization;
         private readonly CredentialCache cache;
         private string host;
+
         internal IRedmineSerializer Serializer { get; }
+
         ///
         ///     Initializes a new instance of the <see cref="RedmineManager" /> class.
         ///
@@ -90,24 +90,23 @@
         /// <param name="verifyServerCert">if set to <c>true</c> [verify server cert].</param>
         /// <param name="proxy">The proxy.</param>
         /// <param name="securityProtocolType">Use this parameter to specify a SecurityProtcolType. Note: it is recommended to leave this parameter at its default value as this setting also affects the calling application process.</param>
+        /// <param name="scheme">http or https. Default is https</param>
         /// <exception cref="Redmine.Net.Api.Exceptions.RedmineException">
         ///     Host is not defined!
         ///     or
         ///     The host is not valid!
         /// </exception>
         public RedmineManager(string host, MimeFormat mimeFormat = MimeFormat.Xml, bool verifyServerCert = true,
-            IWebProxy proxy = null, SecurityProtocolType securityProtocolType = default(SecurityProtocolType))
+            IWebProxy proxy = null, SecurityProtocolType securityProtocolType = default, string scheme = "https")
         {
             if (string.IsNullOrEmpty(host)) throw new RedmineException("Host is not defined!");
+
             PageSize = 25;
-
-            if (default(SecurityProtocolType) == securityProtocolType)
-            {
-                securityProtocolType = ServicePointManager.SecurityProtocol;
-            }
-
+            Scheme = scheme;
             Host = host;
             MimeFormat = mimeFormat;
+            Proxy = proxy;
+
             if (mimeFormat == MimeFormat.Xml)
             {
                 Format = "xml";
@@ -119,10 +118,15 @@
                 Serializer = new JsonRedmineSerializer();
             }

-            Proxy = proxy;
+            if (default == securityProtocolType)
+            {
+                securityProtocolType = ServicePointManager.SecurityProtocol;
+            }
+
             SecurityProtocolType = securityProtocolType;

             ServicePointManager.SecurityProtocol = securityProtocolType;
+
             if (!verifyServerCert)
             {
                 ServicePointManager.ServerCertificateValidationCallback += RemoteCertValidate;
@@ -151,7 +155,7 @@
         /// <param name="securityProtocolType">Use this parameter to specify a SecurityProtcolType. Note: it is recommended to leave this parameter at its default value as this setting also affects the calling application process.</param>
         public RedmineManager(string host, string apiKey, MimeFormat mimeFormat = MimeFormat.Xml,
             bool verifyServerCert = true, IWebProxy proxy = null,
-            SecurityProtocolType securityProtocolType = default(SecurityProtocolType))
+            SecurityProtocolType securityProtocolType = default)
             : this(host, mimeFormat, verifyServerCert, proxy, securityProtocolType)
         {
             ApiKey = apiKey;
@@ -180,30 +184,33 @@
         /// <param name="securityProtocolType">Use this parameter to specify a SecurityProtcolType. Note: it is recommended to leave this parameter at its default value as this setting also affects the calling application process.</param>
         public RedmineManager(string host, string login, string password, MimeFormat mimeFormat = MimeFormat.Xml,
             bool verifyServerCert = true, IWebProxy proxy = null,
-            SecurityProtocolType securityProtocolType = default(SecurityProtocolType))
+            SecurityProtocolType securityProtocolType = default)
             : this(host, mimeFormat, verifyServerCert, proxy, securityProtocolType)
         {
             cache = new CredentialCache { { new Uri(host), "Basic", new NetworkCredential(login, password) } };

-            var token = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format(CultureInfo.InvariantCulture,"{0}:{1}", login, password)));
-            basicAuthorization = string.Format(CultureInfo.InvariantCulture,"Basic {0}", token);
-
-
-        }
-
-        ///
-        ///     Gets the sufixes.
+            var token = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format(CultureInfo.InvariantCulture, "{0}:{1}", login, password)));
+            basicAuthorization = string.Format(CultureInfo.InvariantCulture, "Basic {0}", token);
+        }
+
+        ///
+        ///     Gets the suffixes.
         ///
         /// <value>
-        ///     The sufixes.
+        ///     The suffixes.
         /// </value>
-        public static Dictionary<Type, string> Sufixes => routes;
+        public static Dictionary<Type, string> Suffixes => Routes;

         ///
         ///
         ///
         public string Format { get; }
-
+
+        ///
+        ///
+        ///
+        public string Scheme { get; private set; }
+
         ///
         ///     Gets the host.
         ///
@@ -217,14 +224,17 @@
             {
                 host = value;

-                if (!Uri.TryCreate(host, UriKind.Absolute, out Uri uriResult) ||
-                    !(uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps))
+                if (Uri.TryCreate(host, UriKind.Absolute, out Uri uriResult) &&
+                    (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps))
                 {
-                    host = $"http://{host}";
+                    return;
                 }

-                if (!Uri.TryCreate(host, UriKind.Absolute, out uriResult))
-                    throw new RedmineException("The host is not valid!");
+                host = $"{Scheme ?? "https"}://{host}";
+
+                if (!Uri.TryCreate(host, UriKind.Absolute, out uriResult)) throw new RedmineException("The host is not valid!");
+
+                Scheme = uriResult.Scheme;
             }
         }

@@ -234,7 +244,7 @@
         /// <value>
         ///     The API key.
         /// </value>
-        public string ApiKey { get; private set; }
+        public string ApiKey { get; }

         ///
         ///     Maximum page-size when retrieving complete object lists
@@ -264,7 +274,7 @@
         /// <value>
         ///     The MIME format.
         /// </value>
-        public MimeFormat MimeFormat { get; private set; }
+        public MimeFormat MimeFormat { get; }

         ///
         ///     Gets the proxy.
@@ -272,7 +282,7 @@
         /// <value>
         ///     The proxy.
         /// </value>
-        public IWebProxy Proxy { get; private set; }
+        public IWebProxy Proxy { get; }

         ///
         ///     Gets the type of the security protocol.
@@ -280,7 +290,7 @@
         /// <value>
         ///     The type of the security protocol.
         /// </value>
-        public SecurityProtocolType SecurityProtocolType { get; private set; }
+        public SecurityProtocolType SecurityProtocolType { get; }

         ///
         ///     Returns the user whose credentials are used to access the API.
@@ -294,7 +304,7 @@
         public User GetCurrentUser(NameValueCollection parameters = null)
         {
             var url = UrlHelper.GetCurrentUserUrl(this);
-            return WebApiHelper.ExecuteDownload<User>(this, url,  parameters);
+            return WebApiHelper.ExecuteDownload<User>(this, url, parameters);
         }

         ///
@@ -351,12 +361,16 @@
         public WikiPage CreateOrUpdateWikiPage(string projectId, string pageName, WikiPage wikiPage)
         {
             var result = Serializer.Serialize(wikiPage);
-            if (string.IsNullOrEmpty(result)) return null;
+
+            if (string.IsNullOrEmpty(result))
+            {
+                return null;
+            }

             var url = UrlHelper.GetWikiCreateOrUpdaterUrl(this, projectId, pageName);
-
+
             url = Uri.EscapeUriString(url);
-
+
             return WebApiHelper.ExecuteUpload<WikiPage>(this, url, HttpVerbs.PUT, result);
         }

@@ -370,9 +384,11 @@
         /// <returns></returns>
         public WikiPage GetWikiPage(string projectId, NameValueCollection parameters, string pageName, uint version = 0)
         {
-            var url = UrlHelper.GetWikiPageUrl(this, projectId,  pageName, version);
+            var url = UrlHelper.GetWikiPageUrl(this, projectId, pageName, version);
+
             url = Uri.EscapeUriString(url);
-            return WebApiHelper.ExecuteDownload<WikiPage>(this, url,  parameters);
+
+            return WebApiHelper.ExecuteDownload<WikiPage>(this, url, parameters);
         }

         ///
@@ -383,8 +399,10 @@
         public List<WikiPage> GetAllWikiPages(string projectId)
         {
             var url = UrlHelper.GetWikisUrl(this, projectId);
+
             var result = WebApiHelper.ExecuteDownloadList<WikiPage>(this, url);
-            return result == null ? null :new List<WikiPage>(result.Items);
+
+            return result == null ? null : new List<WikiPage>(result.Items);
         }

         ///
@@ -423,6 +441,7 @@
             try
             {
                 var tempResult = GetPaginatedObjects<T>(parameters);
+
                 if (tempResult != null)
                 {
                     totalCount = tempResult.TotalItems;
@@ -484,7 +503,7 @@
         {
             var parameters = new NameValueCollection();

-            if (include != null)
+            if (include != null && include.Length > 0)
             {
                 parameters.Add(RedmineKeys.INCLUDE, string.Join(",", include));
             }
@@ -510,9 +529,11 @@
         public List<T> GetObjects<T>(int limit, int offset, params string[] include) where T : class, new()
         {
             var parameters = new NameValueCollection();
+
             parameters.Add(RedmineKeys.LIMIT, limit.ToString(CultureInfo.InvariantCulture));
             parameters.Add(RedmineKeys.OFFSET, offset.ToString(CultureInfo.InvariantCulture));
-            if (include != null)
+
+            if (include != null && include.Length > 0)
             {
                 parameters.Add(RedmineKeys.INCLUDE, string.Join(",", include));
             }
@@ -561,7 +582,7 @@
                 isLimitSet = int.TryParse(parameters[RedmineKeys.LIMIT], out pageSize);
                 int.TryParse(parameters[RedmineKeys.OFFSET], out offset);
             }
-            if (pageSize == default(int))
+            if (pageSize == default)
             {
                 pageSize = PageSize > 0 ? PageSize : DEFAULT_PAGE_SIZE_VALUE;
                 parameters.Set(RedmineKeys.LIMIT, pageSize.ToString(CultureInfo.InvariantCulture));
@@ -569,29 +590,33 @@

             try
             {
-                var hasOffset = typesWithOffset.ContainsKey(typeof(T));
-                if(hasOffset)
+                var hasOffset = TypesWithOffset.ContainsKey(typeof(T));
+                if (hasOffset)
                 {
-                   do
-                   {
-                       parameters.Set(RedmineKeys.OFFSET, offset.ToString(CultureInfo.InvariantCulture));
-
-                       var tempResult = GetPaginatedObjects<T>(parameters);
-
-                       if (tempResult?.Items != null)
-                       {
-                           if (resultList == null)
-                           {
-                               resultList = new List<T>(tempResult.Items);
-                               totalCount = isLimitSet ? pageSize : tempResult.TotalItems;
-                           }
-                           else
-                           {
-                               resultList.AddRange(tempResult.Items);
-                           }
-                       }
-                       offset += pageSize;
-                   } while (offset < totalCount);
+                    do
+                    {
+                        parameters.Set(RedmineKeys.OFFSET, offset.ToString(CultureInfo.InvariantCulture));
+
+                        var tempResult = GetPaginatedObjects<T>(parameters);
+
+                        totalCount = isLimitSet ? pageSize : tempResult.TotalItems;
+
+                        if (tempResult?.Items != null)
+                        {
+                            if (resultList == null)
+                            {
+                                resultList = new List<T>(tempResult.Items);
+
+                            }
+                            else
+                            {
+                                resultList.AddRange(tempResult.Items);
+                            }
+                        }
+
+                        offset += pageSize;
+
+                    } while (offset < totalCount);
                 }
                 else
                 {
@@ -599,12 +624,12 @@
                     if (result?.Items != null)
                     {
                         return new List<T>(result.Items);
-                    }
+                    }
                 }
             }
             catch (WebException wex)
             {
-                wex.HandleWebException( Serializer);
+                wex.HandleWebException(Serializer);
             }
             return resultList;
         }
@@ -655,7 +680,9 @@
         public T CreateObject<T>(T obj, string ownerId) where T : class, new()
         {
             var url = UrlHelper.GetCreateUrl<T>(this, ownerId);
+
             var data = Serializer.Serialize(obj);
+
             return WebApiHelper.ExecuteUpload<T>(this, url, HttpVerbs.POST, data);
         }

@@ -692,8 +719,11 @@
         public void UpdateObject<T>(string id, T obj, string projectId) where T : class, new()
         {
             var url = UrlHelper.GetUploadUrl<T>(this, id);
+
             var data = Serializer.Serialize(obj);
+
             data = Regex.Replace(data, @"\r\n|\r|\n", "\r\n");
+
             WebApiHelper.ExecuteUpload(this, url, HttpVerbs.PUT, data);
         }

@@ -740,7 +770,9 @@
         public void UpdateAttachment(int issueId, Attachment attachment)
         {
             var address = UrlHelper.GetAttachmentUpdateUrl(this, issueId);
+
             var attachments = new Attachments { { attachment.Id, attachment } };
+
             var data = Serializer.Serialize(attachments);

             WebApiHelper.ExecuteUpload(this, address, HttpVerbs.PATCH, data);
@@ -773,7 +805,8 @@
         ///
         public virtual RedmineWebClient CreateWebClient(NameValueCollection parameters, bool uploadFile = false)
         {
-            var webClient = new RedmineWebClient { Proxy = Proxy };
+            var webClient = new RedmineWebClient { Proxy = Proxy, Scheme = Scheme, RedmineSerializer = Serializer};
+
             if (!uploadFile)
             {
                 webClient.Headers.Add(HttpRequestHeader.ContentType, MimeFormat == MimeFormat.Xml
@@ -829,14 +862,7 @@
         ///
         public virtual bool RemoteCertValidate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslPolicyErrors)
         {
-            if (sslPolicyErrors == SslPolicyErrors.None)
-            {
-                return true;
-            }
-
-           // Logger.Current.Error("X509Certificate [{0}] Policy Error: '{1}'", cert.Subject, error);
-
-            return false;
+            return sslPolicyErrors == SslPolicyErrors.None;
         }
     }
-}
+}


JimEvans: Updating exception thrown by .NET SafariDriver.

git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@17524 07704840-8298-11de-bf8c-fd130f914ac9

--- dotnet/src/WebDriver/Safari/SafariDriverCommandExecutor.cs
+++ dotnet/src/WebDriver/Safari/SafariDriverCommandExecutor.cs
@@ -71,6 +71,10 @@
             this.LaunchSafariProcess(connectFileName);
             this.connection = this.server.WaitForConnection(TimeSpan.FromSeconds(45));
             this.DeleteConnectFile();
+            if (this.connection == null)
+            {
+                throw new WebDriverException("Did not receive a connection from the Safari extension. Please verify that it is properly installed and is the proper version.");
+            }
         }

         /// <summary>


Fix returned error code when already owned Fixes #234


#826 Reproduce bug

#826 Reproduce bug


fix local client http accessor overrider


Error handling for missing cultures

Error handling for missing cultures

When the list of directories is used to get the list of languages a missing culture or directory that is not a culture will cause an error that prevents all the other languages from loading so check each directory as it is added.

--- src/i18n.Domain/Concrete/POTranslationRepository.cs
+++ src/i18n.Domain/Concrete/POTranslationRepository.cs
@@ -54,9 +54,17 @@

 				foreach (var dir in di.EnumerateDirectories().Select(x => x.Name))
 				{
-					lang = new Language();
-					lang.LanguageShortTag = dir;
-					dirList.Add(lang);
+					try
+					{
+						System.Globalization.CultureInfo.GetCultureInfo(dir);
+						lang = new Language();
+						lang.LanguageShortTag = dir;
+						dirList.Add(lang);
+					}
+					catch (System.Globalization.CultureNotFoundException)
+					{
+						//There is a directory in the locale directory that is not a valid culture so ignore it
+					}
 				}
 			}
 			else


Add comments about relative Service address.

Make no functional change; simply added comments to clarify that
solution uses a base address for the service, that the specific
service is specified using a relative address, and describing the
complete address of the service based on these two components.

--- labs/ch1/ServiceFromScratch/Host/Program.cs
+++ labs/ch1/ServiceFromScratch/Host/Program.cs
@@ -8,11 +8,19 @@
     {
         static void Main()
         {
+            // A side effect (although perhaps documented)  of supplying
+            // a Uri to the ServiceHost contstructor is that this Uri
+            // becomes the base address for the service.
             using (
                 var host = new ServiceHost(typeof (HelloIndigoService),
                     new Uri("http://localhost:8000/HelloIndigo")))
             {
-                host.AddServiceEndpoint(typeof (IHelloIndigoService),
+                // By specifying the base address for the service when
+                // constructing the ServiceHost, we can then specify
+                // endpoints using a relative address. That is, the
+                // complete address of the service is
+                // `http://localhost:8080/HelloIndigo/HelloIndigoService`.
+                host.AddServiceEndpoint(typeof (HelloIndigoService),
                     new BasicHttpBinding(), "HelloIndigoService");
                 host.Open();


Re-organized AudioClientWrapper.cs

Re-organized AudioClientWrapper.cs

--- src/Discord.Addons.SimpleAudio/AudioClientWrapper.cs
+++ src/Discord.Addons.SimpleAudio/AudioClientWrapper.cs
@@ -12,28 +12,48 @@
 {
     internal sealed class AudioClientWrapper
     {
+        private static readonly IEmote _playEmote = new Emoji("▶");
+        private static readonly IEmote _pauseEmote = new Emoji("⏸");
+        private static readonly IEmote _stopEmote = new Emoji("⏹");
+
+        private readonly ConcurrentQueue<string> _playlist = new ConcurrentQueue<string>();
+        private readonly object _pauseLock = new object();
+        private readonly object _cancelLock = new object();
+
+        private readonly IUserMessage _message;
+
         public IAudioClient Client { get; }
-        private ConcurrentQueue<string> Playlist { get; } = new ConcurrentQueue<string>();
-        private readonly IUserMessage _message;
-
-        public AudioClientWrapper(IAudioClient client, IUserMessage message)
-        {
-            Client = client;
-            _message = message;
-        }
+
+        private float _playingVolume = 0.5f;
+        private bool _pause = false;
+        private bool _next = false;
+        private CancellationTokenSource _pauseToken = new CancellationTokenSource();
+        private CancellationTokenSource _cancelToken = new CancellationTokenSource();

         private Process _ffmpeg;
         private string _song;
         private IEmote _statusEmote;

+        public AudioClientWrapper(IAudioClient client, IUserMessage message)
+        {
+            Client = client;
+            _message = message;
+        }
+
+        public Task AddToPlaylist(string file)
+        {
+            _playlist.Enqueue(file);
+            return RefreshEmbed();
+        }
+
         public async Task SendAudioAsync(string ffmpeg)
         {
-            while (!Playlist.IsEmpty)
-            {
-                if (Playlist.TryDequeue(out var path))
+            while (!_playlist.IsEmpty)
+            {
+                if (_playlist.TryDequeue(out var path))
                 {
                     _song = Path.GetFileNameWithoutExtension(path);
-                    _statusEmote = new Emoji("▶");
+                    _statusEmote = _playEmote;
                     await RefreshEmbed().ConfigureAwait(false);

                     using (_ffmpeg = Process.Start(new ProcessStartInfo
@@ -56,7 +76,7 @@
                             if (!_next)
                             {
                                 //TODO: Replace with .Clear() when NET Core 2.0 is a thing
-                                while (Playlist.TryDequeue(out var _)) { }
+                                while (_playlist.TryDequeue(out var _)) { }
                                 break;
                             }
                             else
@@ -73,39 +93,94 @@
             }

             _song = "Stopped";
-            _statusEmote = new Emoji("⏹");
+            _statusEmote = _stopEmote;
             await RefreshEmbed().ConfigureAwait(false);
         }

-        public Task AddToPlaylist(string file)
-        {
-            Playlist.Enqueue(file);
-            return RefreshEmbed();
-        }
-
-        private readonly object _cancelLock = new object();
-        private bool _next = false;
-        private CancellationTokenSource _cancel = new CancellationTokenSource();
-
-        public void Cancel()
-        {
-            lock (_cancelLock)
-            {
-                if (IsPlaying())
-                {
-                    using (_cancel)
-                    {
-                        _cancel.Cancel();
-                    }
-                    _cancel = new CancellationTokenSource();
-                }
-            }
+        private async Task PausableCopyToAsync(Stream source, Stream destination, int buffersize)
+        {
+            Contract.Requires(source != null);
+            Contract.Requires(destination != null);
+            Contract.Requires(buffersize > 0);
+            Contract.Requires(source.CanRead);
+            Contract.Requires(destination.CanWrite);
+
+            byte[] buffer = new byte[buffersize];
+            int count;
+
+            while ((count = await source.ReadAsync(buffer, 0, buffersize, _cancelToken.Token).ConfigureAwait(false)) > 0)
+            {
+                if (_pause)
+                {
+                    try
+                    {
+                        await Task.Delay(-1, _pauseToken.Token);
+                    }
+                    catch (OperationCanceledException) { }
+                }
+
+                var volAdjusted = ScaleVolumeUnsafeNoAlloc(buffer, _playingVolume);
+                await destination.WriteAsync(volAdjusted, 0, count, _cancelToken.Token).ConfigureAwait(false);
+            }
+        }
+
+        // setting '_pause' to true multiple times
+        // in a row *should* be completely thread-safe
+        public Task Pause()
+        {
+            if (!_pause)
+            {
+                _pause = true;
+                _statusEmote = _pauseEmote;
+                return RefreshEmbed();
+            }
+            return Task.CompletedTask;
+        }
+
+        public Task Resume()
+        {
+            lock (_pauseLock)
+            {
+                if (_pause)
+                {
+                    _pause = false;
+                    using (_pauseToken)
+                    {
+                        _pauseToken.Cancel();
+                    }
+                    _pauseToken = new CancellationTokenSource();
+                    _statusEmote = new Emoji("▶");
+                    return RefreshEmbed();
+                }
+            }
+            return Task.CompletedTask;
         }

         public void SkipToNext()
         {
             _next = true;
             Cancel();
+        }
+
+        public void Cancel()
+        {
+            lock (_cancelLock)
+            {
+                if (IsPlaying())
+                {
+                    using (_cancelToken)
+                    {
+                        _cancelToken.Cancel();
+                    }
+                    _cancelToken = new CancellationTokenSource();
+                }
+            }
+        }
+
+        public Task SetVolume(float newVolume)
+        {
+            _playingVolume = newVolume;
+            return RefreshEmbed();
         }

         public bool IsPlaying()
@@ -122,106 +197,13 @@
             return !(isDisposed || _ffmpeg.HasExited);
         }

-        private readonly object _pauseLock = new object();
-        private bool _pause = false;
-        private CancellationTokenSource _pauseToken = new CancellationTokenSource();
-
-        // setting '_pause' to true multiple times
-        // in a row *should* be completely thread-safe
-        public Task Pause()
-        {
-            _pause = true;
-            _statusEmote = new Emoji("⏸");
-            return RefreshEmbed();
-        }
-
-        public Task Resume()
-        {
-            lock (_pauseLock)
-            {
-                if (_pause)
-                {
-                    _pause = false;
-                    using (_pauseToken)
-                    {
-                        _pauseToken.Cancel();
-                    }
-                    _pauseToken = new CancellationTokenSource();
-                    _statusEmote = new Emoji("▶");
-                    return RefreshEmbed();
-                }
-            }
-            return Task.CompletedTask;
-        }
-
-        private float _playingVolume = 0.5f;
-
-        public Task SetVolume(float newVolume)
-        {
-            _playingVolume = newVolume;
-            return RefreshEmbed();
-        }
-
-        private async Task PausableCopyToAsync(Stream source, Stream destination, int buffersize)
-        {
-            Contract.Requires(source != null);
-            Contract.Requires(destination != null);
-            Contract.Requires(buffersize > 0);
-            Contract.Requires(source.CanRead);
-            Contract.Requires(destination.CanWrite);
-
-            byte[] buffer = new byte[buffersize];
-            int count;
-
-            while ((count = await source.ReadAsync(buffer, 0, buffersize, _cancel.Token).ConfigureAwait(false)) > 0)
-            {
-                if (_pause)
-                {
-                    try
-                    {
-                        await Task.Delay(-1, _pauseToken.Token);
-                    }
-                    catch (OperationCanceledException) { }
-                }
-
-                var volAdjusted = ScaleVolumeUnsafeNoAlloc(buffer, _playingVolume);
-                await destination.WriteAsync(volAdjusted, 0, count, _cancel.Token).ConfigureAwait(false);
-            }
-        }
-
-        //https://hastebin.com/umapabejis.cs
-        private unsafe static byte[] ScaleVolumeUnsafeNoAlloc(byte[] audioSamples, float volume)
-        {
-            Contract.Requires(audioSamples != null);
-            Contract.Requires(audioSamples.Length % 2 == 0);
-            Contract.Requires(volume >= 0f && volume <= 1f);
-            Contract.Assert(BitConverter.IsLittleEndian);
-
-            if (Math.Abs(volume - 1f) < 0.0001f) return audioSamples;
-
-            // 16-bit precision for the multiplication
-            int volumeFixed = (int)Math.Round(volume * 65536d);
-
-            int count = audioSamples.Length / 2;
-
-            fixed (byte* srcBytes = audioSamples)
-            {
-                short* src = (short*)srcBytes;
-
-                for (int i = count; i != 0; i--, src++)
-                    *src = (short)(((*src) * volumeFixed) >> 16);
-            }
-
-            return audioSamples;
-        }
-
         private Task RefreshEmbed()
         {
             int vol = (int)(_playingVolume * 101);
             var emb = new EmbedBuilder
             {
                 Title = "Now playing:",
-                Description = $"{_statusEmote ?? new Emoji("⏹")} {_song ?? "Stopped"}",
+                Description = $"{_statusEmote ?? _stopEmote} {_song ?? "Stopped"}",
                 Fields =
                 {
                     new EmbedFieldBuilder
@@ -234,11 +216,37 @@
                     {
                         IsInline = true,
                         Name = "Next song:",
-                        Value = (Playlist.TryPeek(out var n) ? Path.GetFileNameWithoutExtension(n) : "(None)")
+                        Value = (_playlist.TryPeek(out var n) ? Path.GetFileNameWithoutExtension(n) : "(None)")
                     }
                 }
             }.Build();
             return _message.ModifyAsync(m => m.Embed = emb);
         }
+
+        //https://hastebin.com/umapabejis.cs
+        private unsafe static byte[] ScaleVolumeUnsafeNoAlloc(byte[] audioSamples, float volume)
+        {
+            Contract.Requires(audioSamples != null);
+            Contract.Requires(audioSamples.Length % 2 == 0);
+            Contract.Requires(volume >= 0f && volume <= 1f);
+            Contract.Assert(BitConverter.IsLittleEndian);
+
+            if (Math.Abs(volume - 1f) < 0.0001f) return audioSamples;
+
+            // 16-bit precision for the multiplication
+            int volumeFixed = (int)Math.Round(volume * 65536d);
+
+            int count = audioSamples.Length / 2;
+
+            fixed (byte* srcBytes = audioSamples)
+            {
+                short* src = (short*)srcBytes;
+
+                for (int i = count; i != 0; i--, src++)
+                    *src = (short)(((*src) * volumeFixed) >> 16);
+            }
+
+            return audioSamples;
+        }
     }
 }


Changing markup control property generation to generate properties also for regular bindings.

--- src/DotVVM.Framework/Controls/DotvvmMarkupControl.cs
+++ src/DotVVM.Framework/Controls/DotvvmMarkupControl.cs
@@ -97,11 +97,11 @@
                     valueBinding.GetKnockoutBindingExpression(this)
                 );
             }
-            else if (GetBinding(property) is StaticCommandBindingExpression staticCommand)
+            else if (GetBinding(property) is ICommandBinding command)
             {
                 var call = KnockoutHelper.GenerateClientPostBackExpression(
                     property.Name,
-                    staticCommand,
+                    command,
                     this,
                     new PostbackScriptOptions(false, true, false, "$element"));

@@ -109,7 +109,7 @@
                     property,
                     $"function(){{return {call}}}"
                 );
-            }
+            }
             else
             {
                 return new PropertySerializeInfo(property, null);


corrected spacing issue

corrected spacing issue

--- src/EncompassRest/LoanPipeline/LoanPipelineCursor.cs
+++ src/EncompassRest/LoanPipeline/LoanPipelineCursor.cs
@@ -51,7 +51,7 @@
         }

         private Task<List<LoanPipelineData>> GetItemsInternalAsync(int start, int count, IEnumerable<string> itemFields, CancellationToken cancellationToken) =>
-            Client.Pipeline.ViewPipelineCursorInternalAsync(CursorId, null, itemFields ?? Fields, start, count, cancellationToken, nameof(GetItemAsync), response =>response.Content.ReadAsAsync<List<LoanPipelineData>>());
+            Client.Pipeline.ViewPipelineCursorInternalAsync(CursorId, null, itemFields ?? Fields, start, count, cancellationToken, nameof(GetItemAsync), response => response.Content.ReadAsAsync<List<LoanPipelineData>>());

         public Task<string> GetItemsRawAsync(int start, int? limit) => GetItemsRawAsync(start, limit, null, CancellationToken.None);


Fix glitched warnings

Fix glitched warnings

--- src/Framework/Framework/Binding/BindingProperties.cs
+++ src/Framework/Framework/Binding/BindingProperties.cs
@@ -167,12 +167,12 @@
     }

     /// <summary>
-    /// Contains a binding that unwraps <see cref="Controls.IBaseGridViewDataSet.Items"/>
+    /// Contains a binding that unwraps <see cref="DotVVM.Framework.Controls.IBaseGridViewDataSet.Items"/>
     /// </summary>
     public sealed record DataSourceAccessBinding(IBinding Binding);

     /// <summary>
-    /// Contains a binding that accesses $index-th element in the collection. Uses the <see cref="CurrentCollectionIndexExtensionParameter"/>.
+    /// Contains a binding that accesses $index-th element in the collection. Uses the <see cref="DotVVM.Framework.Compilation.ControlTree.CurrentCollectionIndexExtensionParameter"/>.
     /// </summary>
     public sealed record DataSourceCurrentElementBinding(IBinding Binding);

@@ -197,7 +197,7 @@
     /// <summary> Contains binding {value: _this} as the current data context. </summary>
     public sealed record ThisBindingProperty(IBinding binding);

-    /// <summary> Contains <see cref="DataContextStack">data context</see> which would be expected in a Repeater bound to this binding. </summary>
+    /// <summary> Contains <see cref="DotVVM.Framework.Compilation.ControlTree.DataContextStack">data context</see> which would be expected in a Repeater bound to this binding. </summary>
     public sealed record CollectionElementDataContextBindingProperty(
         DataContextStack DataContext
     );


Save button

Save button

--- src/FujiyBlog.Web/Areas/Admin/Views/Post/Edit.cshtml
+++ src/FujiyBlog.Web/Areas/Admin/Views/Post/Edit.cshtml
@@ -11,21 +11,21 @@
 }

-
@(Model.Post.Id.HasValue ? "Edit" : "Add") post

-
 @Html.Partial("UploadForms", uploadFolder)

 @using (Html.BeginForm())
 {
+    <button class="btn btn-primary" type="submit">Save</button>
+
@(Model.Post.Id.HasValue ? "Edit" : "Add") post

+
     @Html.ValidationSummary(true)

-
     @Html.HiddenFor(model => model.Post.Id)

-
+

                 <input asp-for="Post.Title" class="form-control" placeholder="Title" />
@@ -93,7 +93,7 @@

-            <button class="btn btn-default" type="submit">Save</button>
+            <button class="btn btn-primary" type="submit">Save</button>


서비스 비정상 종료시, 서비스 죽는 버그 해결

서비스 비정상 종료시, 서비스 죽는 버그 해결

--- server/Framework/RemoteService.cs
+++ server/Framework/RemoteService.cs
@@ -48,11 +48,21 @@
         {
             this.run = false;
             this.getSocket().EndDisconnect(ar);
+            //할당된 작업 해제 등등
         }

         protected void readCallback(IAsyncResult ar)
         {
-            int len = this.getSocket().EndReceive(ar);
+            int len;
+            try
+            {
+                len = this.getSocket().EndReceive(ar);
+            }
+            catch (SocketException)
+            {
+                return;
+            }
+
             this.getPacketBuffer().write(this.getSocketBuffer(), 0, len);

             LinkedList<dynamic> messageList = this.getPacketMessageList();


Add buddy list persistence to ClientData

--- src/Gablarski.Clients.Core/Persistence/ClientData.cs
+++ src/Gablarski.Clients.Core/Persistence/ClientData.cs
@@ -447,6 +447,37 @@
 		}
 		#endregion

+		public static async Task<IEnumerable<string>> GetBuddiesAsync()
+		{
+			using (var cmd = db.CreateCommand ("SELECT * FROM buddies"))
+			using (var reader = await cmd.ExecuteReaderAsync().ConfigureAwait (false)) {
+				List<string> buddies = new List<string>();
+				while (await reader.ReadAsync().ConfigureAwait (false)) {
+					buddies. Add(reader.GetString (0));
+				}
+
+				return buddies;
+			}
+		}
+
+		public static async Task SaveBuddiesAsync (IEnumerable<string> buddies)
+		{
+			if (buddies == null)
+				throw new ArgumentNullException ("buddies");
+
+			HashSet<string> buddySet = new HashSet<string> (buddies);
+
+			var currentBuddies = await GetBuddiesAsync().ConfigureAwait (false);
+			buddySet.ExceptWith (currentBuddies);
+
+			foreach (string identity in buddySet) {
+				using (var cmd = db.CreateCommand ("INSERT INTO buddies (identity) VALUES (?)")) {
+					cmd.Parameters.Add (new SQLiteParameter ("identity", identity));
+					await cmd.ExecuteNonQueryAsync().ConfigureAwait (false);
+				}
+			}
+		}
+
 		private static readonly DirectoryInfo DataDirectory;
 		private static readonly DbConnection db;
 		private static readonly FileInfo DbFile;
@@ -467,6 +498,9 @@

 			using (var cmd = db.CreateCommand ("CREATE TABLE IF NOT EXISTS commandbindings (commandbindingProvider string, commandbindingCommand integer, commandbindingInput varchar(255))"))
 				cmd.ExecuteNonQuery();
+
+			using (var cmd = db.CreateCommand ("CREATE TABLE IF NOT EXISTS buddies (identity string)"))
+				cmd.ExecuteNonQuery();
 		}
 	}
 }


adding target name

adding target name

--- src/Grace/DependencyInjection/InjectionTargetInfo.cs
+++ src/Grace/DependencyInjection/InjectionTargetInfo.cs
@@ -19,6 +19,7 @@
         /// <param name="injectionType"></param>
         /// <param name="requestingStrategy"></param>
         /// <param name="injectionTarget"></param>
+        /// <param name="injectionTargetName"></param>
         /// <param name="injectionDependencyType"></param>
         /// <param name="locatedType"></param>
         /// <param name="isRequired"></param>
@@ -28,6 +29,7 @@
                                    Type injectionType,
                                    IActivationStrategy requestingStrategy,
                                    object injectionTarget,
+                                   string injectionTargetName,
                                    RequestType injectionDependencyType,
                                    Type locatedType,
                                    bool isRequired,
@@ -43,6 +45,7 @@
             IsRequired = isRequired;
             DefaultValue = defaultValue;
             UniqueId = uniqueId;
+            InjectionTargetName = injectionTargetName;
         }

         /// <summary>
@@ -59,11 +62,16 @@
         /// These are the attributes for the class that it's being injected into
         /// </summary>
         public IEnumerable<Attribute> InjectionTypeAttributes => _attributeDiscoveryService.GetAttributes(InjectionType);
-
+
         /// <summary>
         /// The PropertyInfo or ParameterInfo that is being injected
         /// </summary>
         public object InjectionTarget { get; }
+
+        /// <summary>
+        /// Name of target being injected, parameter name, property name, or fieldName
+        /// </summary>
+        public string InjectionTargetName { get; }

         /// <summary>
         /// Type of injection being done, constructor, property, or method


Update GridPagerExtention.cs

Update GridPagerExtention.cs

fixed | GridPagerExtention.cs | 修复表格排序的bug

--- src/HalowerHub.JqGrid/Function/GridPagerExtention.cs
+++ src/HalowerHub.JqGrid/Function/GridPagerExtention.cs
@@ -1,4 +1,4 @@
-/****************************************************
+/****************************************************
 ** 作者： Halower (QQ:121625933)
 ** 创始时间：2015-02-01
 ** 描述：jqGrid扩展分页
@@ -33,11 +33,10 @@
                 predicate = GridSearchPredicate.MultiSearchExpression<T>(pageParams.Filters);
             if (string.IsNullOrEmpty(pageParams.Filters) && !string.IsNullOrEmpty(pageParams.SearchField))
                 predicate = GridSearchPredicate.SingleSearchExpression<T>(pageParams.SearchField, pageParams.SearchOper,pageParams.SearchString);
-            var recordes = list.Where(predicate.Compile())
-                    .Skip((pageParams.PageIndex - 1)*pageParams.PageSize)
-                    .Take(pageParams.PageSize).ToList();
-
-            recordes.Sort(new GridListSort<T>( string.IsNullOrEmpty(pageParams.SortName) ? pageParams.Gridkey : pageParams.SortName,pageParams.Sord == "desc").Compare);
+            var temp =  list.Where(predicate.Compile()).ToList();
+            var compare = new GridListSort<T>(string.IsNullOrEmpty(pageParams.SortName) ? pageParams.Gridkey : pageParams.SortName, pageParams.Sord == "desc");
+            temp.Sort(compare.Compare);
+            var recordes = temp.Skip((pageParams.PageIndex - 1)*pageParams.PageSize).Take(pageParams.PageSize).ToList();
             var gridCells = recordes.Select(p => new GridCell
             {
                 Id = p.GetType().GetProperty(pageParams.Gridkey).GetValue(p, null).ToString(),
@@ -47,9 +46,9 @@
                 new
                 {
                     pageParams.PageIndex,
-                    records =order==null? list.Count(predicate.Compile()): list.OrderByDescending(order.Compile()).Count(predicate.Compile()),
+                    records = temp.Count(predicate.Compile()),
                     rows = gridCells,
-                    total = (Math.Ceiling((double)list.Count() / pageParams.PageSize))
+                    total = (Math.Ceiling((double)temp.Count() / pageParams.PageSize))
                 }.ToSerializer();
             return result;
         }
@@ -162,4 +161,4 @@
             return result;
         }
     }
-}+}


Added Float Operators,  TexCoords, Normals, Colors

--- Graphics/Vertex.cs
+++ Graphics/Vertex.cs
@@ -10,10 +10,10 @@
     public struct Vertex
     {

-        public float X, Y, Z;    // Position
-        public float R, G, B;    // Color
-        public float NX, NY, NZ; // Normal
-        public float S, T;       // Texture
+        public float X, Y, Z;      // Position
+        public float R, G, B;      // Color
+        public float NX, NY, NZ;   // Normal
+        public float Tx, Ty;       // Texture

         #region Readonly

@@ -28,16 +28,16 @@
         /// <summary>
         /// Create a 2D Vertex with two points. Specify a third float to make a 3d vertex.
         /// </summary>
-        /// <param name="x">Float X</param>
-        /// <param name="y">Float Y</param>
-        /// <param name="z">Optional Float. Define to make this a 3d vertex</param>
+        /// <param name="x">Pos X</param>
+        /// <param name="y">Pos Y</param>
+        /// <param name="z">Pos Z</param>
         public Vertex(float x, float y, float z = 0)
         {
             X = x;
             Y = y;
             Z = z;

-            R = 1f;
+            R = 0f;
             G = 0f;
             B = 0f;

@@ -45,8 +45,8 @@
             NY = 0f;
             NZ = 1f;

-            S = 0f;
-            T = 1f;
+            Tx = 0f;
+            Ty = 0f;
         }

         #region OPERATORS OH BOY
@@ -95,8 +95,30 @@
         }
         #endregion INT MATH

+        #region FLOAT MATH
+        public static Vertex operator *(Vertex A, float B)
+        {
+            return new Vertex(A.X * B, A.Y * B, A.Z * B);
+        }
+
+        public static Vertex operator +(Vertex A, float B)
+        {
+            return new Vertex(A.X + B, A.Y + B, A.Z + B);
+        }
+
+        public static Vertex operator -(Vertex A, float B)
+        {
+            return new Vertex(A.X - B, A.Y - B, A.Z - B);
+        }
+
+        public static Vertex operator /(Vertex A, float B)
+        {
+            return new Vertex(A.X / B, A.Y / B, A.Z / B);
+        }
+        #endregion INT MATH
+
         #endregion

-
+
     }
 }


Fixes 28730

Fixes 28730

[TFS Changeset #81529]

--- umbraco/presentation/umbraco/dialogs/create.aspx.cs
+++ umbraco/presentation/umbraco/dialogs/create.aspx.cs
@@ -9,6 +9,7 @@
 using System.Web.UI.WebControls;
 using System.Web.UI.HtmlControls;
 using System.Xml;
+using umbraco.cms.businesslogic;
 using umbraco.IO;
 using umbraco.presentation;
 using umbraco.BusinessLogic.Actions;
@@ -75,7 +76,7 @@

         private bool CheckCreatePermissions(int nodeId)
         {
-            return UmbracoEnsuredPage.CurrentUser.GetPermissions(new Document(nodeId).Path)
+            return UmbracoEnsuredPage.CurrentUser.GetPermissions(new CMSNode(nodeId).Path)
                 .Contains(ActionNew.Instance.Letter.ToString());
         }


Dynamic Forward vector for the Nav Camera

--- unityproject/app/Assets/scripts/CameraController.cs
+++ unityproject/app/Assets/scripts/CameraController.cs
@@ -27,7 +27,7 @@
 			float fracJourney = distCovered / journeyLength;
 			transform.position = Vector3.Lerp (transform.position, targetPos, fracJourney);

-			if ((transform.position - targetPos).magnitude < 1 && (transform.forward - targetForward).magnitude < 1) {
+			if ((transform.position - targetPos).magnitude < 0.01 && (transform.forward - targetForward).magnitude < 0.01) {
 				isCameraTransitionRunning = false;
 			}
 		}
@@ -35,7 +35,7 @@
 		//Handles the Camera Orientation
 		if (isCameraTransitionRunning && transform.forward != targetForward) {
 			Debug.Log ("inside loop");
-			float distCovered = (Time.time - startTime) * 2.0f; //speed = 1.0f
+			float distCovered = (Time.time - startTime) * 0.035f; //speed = 1.0f
 			float fracJourney = distCovered / journeyLengthForward;

 			transform.forward = (new Vector3 (
@@ -44,7 +44,7 @@
 				Mathf.LerpAngle (transform.forward.z, targetForward.z, fracJourney)
 			));

-			if ((transform.position - targetPos).magnitude < 1 && (transform.forward - targetForward).magnitude < 1) {
+			if ((transform.position - targetPos).magnitude < 0.01 && (transform.forward - targetForward).magnitude < 0.01) {
 				isCameraTransitionRunning = false;
 			}
 		}
@@ -53,17 +53,38 @@

 		Node targetNode = MouseClickUtil.checkMouseClick (MouseClickUtil.LEFT_BTN, 10000);
 		if (targetNode != null) {
-			//get Point on the same Z level of the target
-//					Vector3 CameraToTargetVector = (new Vector3(
-//						transform.position.x,
-//						transform.position.y,
-//						targetNode.transform.position.z) - targetNode.transform.position ).normalized;
-			targetPos = targetNode.transform.position + offset;
-//					targetPos = targetNode.transform.position + CameraToTargetVector * 10f;
+
+
+			Vector3 CameraToTargetVector = (transform.position - targetNode.transform.position);
+			CameraToTargetVector.y = 0; //get Point on the same Y level of the target
+			CameraToTargetVector = CameraToTargetVector.normalized;
+
+
+			targetPos = targetNode.transform.position + (CameraToTargetVector * 25f);
+			targetForward = (targetNode.transform.position - targetPos).normalized;
+
+
 			startTime = Time.time;
-			journeyLength = Vector3.Distance (transform.position, targetPos);
-			journeyLengthForward = Vector3.Distance (transform.forward, targetNode.transform.position - transform.position);
+			journeyLength = Vector3.Distance(transform.position, targetPos);
+			journeyLengthForward = Vector3.Distance (transform.forward,  targetForward);
+
 			isCameraTransitionRunning = true;
+
+
+
+
+//
+//			//get Point on the same Z level of the target
+////					Vector3 CameraToTargetVector = (new Vector3(
+////						transform.position.x,
+////						transform.position.y,
+////						targetNode.transform.position.z) - targetNode.transform.position ).normalized;
+//			targetPos = targetNode.transform.position + offset;
+////					targetPos = targetNode.transform.position + CameraToTargetVector * 10f;
+//			startTime = Time.time;
+//			journeyLength = Vector3.Distance (transform.position, targetPos);
+//			journeyLengthForward = Vector3.Distance (transform.forward, targetNode.transform.position - transform.position);
+//			isCameraTransitionRunning = true;

 		}


don't blow away saved value with default

--- MediaBrowser.Theater.Core/MediaPlayers/ConfigureMediaPlayerPage.xaml.cs
+++ MediaBrowser.Theater.Core/MediaPlayers/ConfigureMediaPlayerPage.xaml.cs
@@ -84,7 +84,6 @@
             SelectPlayer.SelectedItemChanged += SelectPlayer_SelectedItemChanged;
             SelectMediaType.SelectedItemChanged += SelectMediaType_SelectedItemChanged;
             SelectGameSystem.SelectedItemChanged += SelectGameSystem_SelectedItemChanged;
-            TxtPath.TextChanged += TxtPath_TextChanged;
             BtnSubmit.Click += BtnSubmit_Click;
         }

@@ -296,6 +295,8 @@

         async void ConfigureMediaPlayerPage_Loaded(object sender, RoutedEventArgs e)
         {
+            TxtPath.TextChanged -= TxtPath_TextChanged;
+
             TxtTitle.Text = _isNew ? "Add Media Player" : "Edit Media Player";

             SelectMediaType_SelectedItemChanged(null, EventArgs.Empty);
@@ -333,6 +334,8 @@
                 SelectGameSystem.SelectedValue = systemToSelect.Value;
                 SelectGameSystem_SelectedItemChanged(null, EventArgs.Empty);
             }
+
+            TxtPath.TextChanged += TxtPath_TextChanged;
         }

         private IMediaPlayer SelectedPlayer


Dont launch Kernel.sln in VS after building devkit

--- source/Cosmos.Build.Builder/CosmosBuildDefinition.cs
+++ source/Cosmos.Build.Builder/CosmosBuildDefinition.cs
@@ -162,18 +162,6 @@
                 {
                     xKey.SetValue("DevKit", _cosmosDir);
                 }
-
-                // Launch VS
-
-                if (!App.BuilderConfiguration.NoVsLaunch)
-                {
-                    var vsInstance = _visualStudioInstance;
-                    var vsPath = Path.Combine(vsInstance.GetInstallationPath(), "Common7", "IDE", "devenv.exe");
-
-                    var kernelSlnPath = Path.Combine(_cosmosDir, "Kernel.sln");
-
-                    yield return new StartProcessTask(vsPath, kernelSlnPath, "Visual Studio (Kernel.sln)");
-                }
             }
         }
     }


Minor clean

Minor clean

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@5806

--- src/NHibernate.Test/NHSpecificTest/NH2100/Fixture.cs
+++ src/NHibernate.Test/NHSpecificTest/NH2100/Fixture.cs
@@ -1,4 +1,3 @@
-using System;
 using NHibernate.Cfg.MappingSchema;
 using NHibernate.Mapping.ByCode;
 using NUnit.Framework;
@@ -22,7 +21,6 @@
 			mapper.Class<Class1>(r => { r.IdBag(x => x.Class2List, map => map.Inverse(true), rel => rel.ManyToMany()); });
 			mapper.Class<Class2>(r => { r.IdBag<Class1>("_class1List", map => { }, rel => rel.ManyToMany()); });
 			HbmMapping mappings = mapper.CompileMappingFor(new[] {typeof (Class1), typeof (Class2)});
-			Console.WriteLine(mappings.AsString());
 			return mappings;
 		}


Fixed unit test

Fixed unit test

--- src/NSwag.Core.Tests/ComponentsSerializationTests.cs
+++ src/NSwag.Core.Tests/ComponentsSerializationTests.cs
@@ -15,7 +15,7 @@

             //// Act
             var json = document.ToJson(SchemaType.Swagger2);
-            document = await SwaggerDocument.FromJsonAsync(json, schemaType: SchemaType.OpenApi3);
+            document = await SwaggerDocument.FromJsonAsync(json, schemaType: SchemaType.Swagger2);

             //// Assert
             Assert.Contains("definitions", json);


Reduce the visibility of 'Numerics' to 'internal'

--- src/NUnitFramework/framework/Constraints/Numerics.cs
+++ src/NUnitFramework/framework/Constraints/Numerics.cs
@@ -8,7 +8,7 @@
     /// <summary>
     /// The Numerics class contains common operations on numeric values.
     /// </summary>
-    public static class Numerics
+    internal static class Numerics
     {
         #region Numeric Type Recognition
         /// <summary>


Added tests on setup and teardown async entry points

--- src/NUnitFramework/tests/AsyncExecutionApiAdapter.cs
+++ src/NUnitFramework/tests/AsyncExecutionApiAdapter.cs
@@ -27,6 +27,7 @@
 using System.Threading.Tasks;
 using NUnit.Framework.Constraints;
 using NUnit.Framework.Internal;
+using NUnit.Framework.Internal.Builders;
 using NUnit.TestUtilities;

 namespace NUnit.Framework
@@ -40,6 +41,10 @@
         public static IEnumerable<AsyncExecutionApiAdapter> All { get; } = new AsyncExecutionApiAdapter[]
         {
             new TaskReturningTestMethodAdapter(),
+            new TaskReturningSetUpAdapter(),
+            new TaskReturningTearDownAdapter(),
+            new TaskReturningOneTimeSetUpAdapter(),
+            new TaskReturningOneTimeTearDownAdapter(),
             new AssertThrowsAsyncAdapter(),
             new AssertDoesNotThrowAsyncAdapter(),
             new AssertCatchAsyncAdapter(),
@@ -56,24 +61,137 @@
         {
             public override void Execute(AsyncTestDelegate asyncUserCode)
             {
-                TestBuilder
-                    .RunTestCase(new Fixture(asyncUserCode), nameof(Fixture.TestMethod))
-                    .AssertPassed();
-            }
-
-            private sealed class Fixture
-            {
-                private readonly AsyncTestDelegate _asyncUserCode;
-
-                public Fixture(AsyncTestDelegate asyncUserCode)
-                {
-                    _asyncUserCode = asyncUserCode;
-                }
-
+                TestBuilder.RunTest(
+                    new NUnitTestFixtureBuilder().BuildFrom(typeof(Fixture), new TestFixtureData(asyncUserCode))
+                ).AssertPassed();
+            }
+
+            private sealed class Fixture
+            {
+                private readonly AsyncTestDelegate _asyncUserCode;
+
+                public Fixture(AsyncTestDelegate asyncUserCode)
+                {
+                    _asyncUserCode = asyncUserCode;
+                }
+
+                [Test]
                 public Task TestMethod() => _asyncUserCode.Invoke();
             }

             public override string ToString() => "[Test] Task TestMethod() { … }";
+        }
+
+        private sealed class TaskReturningSetUpAdapter : AsyncExecutionApiAdapter
+        {
+            public override void Execute(AsyncTestDelegate asyncUserCode)
+            {
+                TestBuilder.RunTest(
+                    new NUnitTestFixtureBuilder().BuildFrom(typeof(Fixture), new TestFixtureData(asyncUserCode))
+                ).AssertPassed();
+            }
+
+            private sealed class Fixture
+            {
+                private readonly AsyncTestDelegate _asyncUserCode;
+
+                public Fixture(AsyncTestDelegate asyncUserCode)
+                {
+                    _asyncUserCode = asyncUserCode;
+                }
+
+                [SetUp]
+                public Task SetUp() => _asyncUserCode.Invoke();
+
+                [Test]
+                public void DummyTest() { }
+            }
+
+            public override string ToString() => "[SetUp] Task SetUp() { … }";
+        }
+
+        private sealed class TaskReturningTearDownAdapter : AsyncExecutionApiAdapter
+        {
+            public override void Execute(AsyncTestDelegate asyncUserCode)
+            {
+                TestBuilder.RunTest(
+                    new NUnitTestFixtureBuilder().BuildFrom(typeof(Fixture), new TestFixtureData(asyncUserCode))
+                ).AssertPassed();
+            }
+
+            private sealed class Fixture
+            {
+                private readonly AsyncTestDelegate _asyncUserCode;
+
+                public Fixture(AsyncTestDelegate asyncUserCode)
+                {
+                    _asyncUserCode = asyncUserCode;
+                }
+
+                [Test]
+                public void DummyTest() { }
+
+                [TearDown]
+                public Task TearDown() => _asyncUserCode.Invoke();
+            }
+
+            public override string ToString() => "[TearDown] Task TearDown() { … }";
+        }
+
+        private sealed class TaskReturningOneTimeSetUpAdapter : AsyncExecutionApiAdapter
+        {
+            public override void Execute(AsyncTestDelegate asyncUserCode)
+            {
+                TestBuilder.RunTest(
+                    new NUnitTestFixtureBuilder().BuildFrom(typeof(Fixture), new TestFixtureData(asyncUserCode))
+                ).AssertPassed();
+            }
+
+            private sealed class Fixture
+            {
+                private readonly AsyncTestDelegate _asyncUserCode;
+
+                public Fixture(AsyncTestDelegate asyncUserCode)
+                {
+                    _asyncUserCode = asyncUserCode;
+                }
+
+                [OneTimeSetUp]
+                public Task OneTimeSetUp() => _asyncUserCode.Invoke();
+
+                [Test]
+                public void DummyTest() { }
+            }
+
+            public override string ToString() => "[OneTimeSetUp] Task OneTimeSetUp() { … }";
+        }
+
+        private sealed class TaskReturningOneTimeTearDownAdapter : AsyncExecutionApiAdapter
+        {
+            public override void Execute(AsyncTestDelegate asyncUserCode)
+            {
+                TestBuilder.RunTest(
+                    new NUnitTestFixtureBuilder().BuildFrom(typeof(Fixture), new TestFixtureData(asyncUserCode))
+                ).AssertPassed();
+            }
+
+            private sealed class Fixture
+            {
+                private readonly AsyncTestDelegate _asyncUserCode;
+
+                public Fixture(AsyncTestDelegate asyncUserCode)
+                {
+                    _asyncUserCode = asyncUserCode;
+                }
+
+                [Test]
+                public void DummyTest() { }
+
+                [OneTimeTearDown]
+                public Task OneTimeTearDown() => _asyncUserCode.Invoke();
+            }
+
+            public override string ToString() => "[OneTimeTearDown] Task OneTimeTearDown() { … }";
         }

         private sealed class AssertThrowsAsyncAdapter : AsyncExecutionApiAdapter


Typo: wrong index in a string format

Typo: wrong index in a string format

--- src/Narvalo.Mvp.Web/Core/AspNetMessageCoordinator.cs
+++ src/Narvalo.Mvp.Web/Core/AspNetMessageCoordinator.cs
@@ -17,7 +17,7 @@
     // activated during the same HTTP request.
     // When a message is published, it will be handled by all present AND future handlers.
     // You then do not have to worry about the order of the pub/sub events.
-    // A good rule of thumb is to subscribe or publish messages during the Load event.
+    // A good rule of thumb is to subscribe or publish messages during the Load event.
     // NB: After pre-render completes, the message bus is closed.
     public sealed class AspNetMessageCoordinator : IMessageCoordinator
     {
@@ -121,7 +121,7 @@
             foreach (var type in neverReceivedMessages)
             {
                 Trace.TraceWarning(
-                    "[AspNetMessageCoordinator] You published a message of type '{1}' but you did not registered any handler for it.",
+                    "[AspNetMessageCoordinator] You published a message of type '{0}' but you did not registered any handler for it.",
                     type.FullName);
             }
         }


Fixing more stale TODO comments

Fixing more stale TODO comments

--- src/Nest/Search/Suggesters/Suggest/SuggestRequest.cs
+++ src/Nest/Search/Suggesters/Suggest/SuggestRequest.cs
@@ -4,7 +4,6 @@

 namespace Nest
 {
-	//TODO UNTESTED
 	[JsonConverter(typeof(SuggestRequestJsonConverter))]
 	public partial interface ISuggestRequest
 	{


minor

minor

--- src/Net.Appclusive.Api/DataServiceQueryExtensions.cs
+++ src/Net.Appclusive.Api/DataServiceQueryExtensions.cs
@@ -37,6 +37,7 @@
         {
             Contract.Requires(0 < id);

+            // IMPORTANT: Do NOT change to dataServiceQuery.FirstOrDefault(...) as FirstOrDefault(...) is not supported!!!
             return dataServiceQuery.Where("Id == @0", id).FirstOrDefault();
         }


Delete TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs


Fixing jQuery dependency in Markdown

Fixing jQuery dependency in Markdown

--HG--
branch : 1.x

--- src/Orchard.Web/Modules/Markdown/ResourceManifest.cs
+++ src/Orchard.Web/Modules/Markdown/ResourceManifest.cs
@@ -7,7 +7,7 @@
             manifest.DefineScript("Markdown_Converter").SetUrl("Markdown.Converter.js");
             manifest.DefineScript("Markdown_Sanitizer").SetUrl("Markdown.Sanitizer.js").SetDependencies("Markdown_Converter");
             manifest.DefineScript("Markdown_Editor").SetUrl("Markdown.Editor.js").SetDependencies("Markdown_Sanitizer");
-            manifest.DefineScript("Resizer").SetUrl("jquery.textarearesizer.min.js");
+            manifest.DefineScript("Resizer").SetUrl("jquery.textarearesizer.min.js").SetDependencies("jQuery");

             manifest.DefineScript("OrchardMarkdown").SetUrl("orchard-markdown.js").SetDependencies("Resizer", "Markdown_Editor");
             manifest.DefineStyle("OrchardMarkdown").SetUrl("admin-markdown.css");


Simplify DistinctQueue.Enqueue

Simplify DistinctQueue.Enqueue

--- src/Peachpie.CodeAnalysis/Utilities/DistinctQueue.cs
+++ src/Peachpie.CodeAnalysis/Utilities/DistinctQueue.cs
@@ -50,10 +50,9 @@

             lock (_syncRoot)
             {
-                if (!_set.Contains(value))
+                if (_set.Add(value))
                 {
                     _queue.Push(value);
-                    _set.Add(value);
                     return true;
                 }
                 else


INotificationService.ListUsers() ordering alphabetically

--- JabbR/Hubs/Chat.cs
+++ JabbR/Hubs/Chat.cs
@@ -467,7 +467,7 @@

         void INotificationService.ListUsers()
         {
-            var users = _repository.Users.Online().Select(s => s.Name);
+            var users = _repository.Users.Online().Select(s => s.Name).OrderBy(s => s);
             Caller.listUsers(users);
         }


wp7: fix thread stop

wp7: fix thread stop

--- platform/wp7/RhoRubyLib/common/RhoThread.cs
+++ platform/wp7/RhoRubyLib/common/RhoThread.cs
@@ -49,7 +49,10 @@
         }

         public virtual void stop(int nTimeoutToKill)
-        {
+        {
+            if (!isAlive())
+                return;
+
     	    m_nState |= TS_STOPPING;
     	    stopWait();


Tidy up ImplementationBuilder

Tidy up ImplementationBuilder

Pull some details of opcode emission into separate methods

--- src/RestEase/Implementation/ImplementationBuilder.cs
+++ src/RestEase/Implementation/ImplementationBuilder.cs
@@ -271,6 +271,12 @@
                 if (methodInfo.IsSpecialName)
                     continue;

+                var parameters = methodInfo.GetParameters();
+                var parameterGrouping = new ParameterGrouping(parameters, methodInfo.Name);
+
+                var methodBuilder = typeBuilder.DefineMethod(methodInfo.Name, MethodAttributes.Public | MethodAttributes.Virtual, methodInfo.ReturnType, parameters.Select(x => x.ParameterType).ToArray());
+                var methodIlGenerator = methodBuilder.GetILGenerator();
+
                 var requestAttribute = methodInfo.GetCustomAttribute<RequestAttribute>();
                 if (requestAttribute == null)
                     throw new ImplementationCreationException(String.Format("Method {0} does not have a suitable [Get] / [Post] / etc attribute on it", methodInfo.Name));
@@ -280,84 +286,16 @@
                 var methodSerializationMethodsAttribute = methodInfo.GetCustomAttribute<SerializationMethodsAttribute>();
                 var serializationMethods = new ResolvedSerializationMethods(classSerializationMethodsAttribute, methodSerializationMethodsAttribute);

-                var parameters = methodInfo.GetParameters();
-                var parameterGrouping = new ParameterGrouping(parameters, methodInfo.Name);
-
                 this.ValidatePathParams(requestAttribute.Path, parameterGrouping.PathParameters.Select(x => x.Attribute.Name ?? x.Parameter.Name).ToList(), properties.Path.Select(x => x.Attribute.Name).ToList(), methodInfo.Name);

-                var methodBuilder = typeBuilder.DefineMethod(methodInfo.Name, MethodAttributes.Public | MethodAttributes.Virtual, methodInfo.ReturnType, parameters.Select(x => x.ParameterType).ToArray());
-                var methodIlGenerator = methodBuilder.GetILGenerator();
-
                 this.AddRequestInfoCreation(methodIlGenerator, requesterField, requestAttribute);
-
-                // If there's a cancellationtoken, add that
-                if (parameterGrouping.CancellationToken.HasValue)
-                {
-                    methodIlGenerator.Emit(OpCodes.Dup);
-                    methodIlGenerator.Emit(OpCodes.Ldarg, (short)parameterGrouping.CancellationToken.Value.Index);
-                    methodIlGenerator.Emit(OpCodes.Callvirt, cancellationTokenSetter);
-                }
-
-                // If there are any class headers, add them
-                if (classHeadersField != null)
-                {
-                    // requestInfo.ClassHeaders = classHeaders
-                    methodIlGenerator.Emit(OpCodes.Dup);
-                    methodIlGenerator.Emit(OpCodes.Ldsfld, classHeadersField);
-                    methodIlGenerator.Emit(OpCodes.Callvirt, setClassHeadersMethod);
-                }
-
-                // If there are any property headers, add them
-                foreach (var propertyHeader in properties.Headers)
-                {
-                    var typedMethod = addPropertyHeaderMethod.MakeGenericMethod(propertyHeader.BackingField.FieldType);
-                    methodIlGenerator.Emit(OpCodes.Dup);
-                    methodIlGenerator.Emit(OpCodes.Ldstr, propertyHeader.Attribute.Name);
-                    methodIlGenerator.Emit(OpCodes.Ldarg_0);
-                    methodIlGenerator.Emit(OpCodes.Ldfld, propertyHeader.BackingField);
-                    if (propertyHeader.Attribute.Value == null)
-                        methodIlGenerator.Emit(OpCodes.Ldnull);
-                    else
-                        methodIlGenerator.Emit(OpCodes.Ldstr, propertyHeader.Attribute.Value);
-                    methodIlGenerator.Emit(OpCodes.Callvirt, typedMethod);
-                }
-
-                // If there are path properties, add them
-                foreach (var pathProperty in properties.Path)
-                {
-                    var typedMethod = addPathPropertyMethod.MakeGenericMethod(pathProperty.BackingField.FieldType);
-                    methodIlGenerator.Emit(OpCodes.Dup);
-                    methodIlGenerator.Emit(OpCodes.Ldstr, pathProperty.Attribute.Name);
-                    methodIlGenerator.Emit(OpCodes.Ldarg_0);
-                    methodIlGenerator.Emit(OpCodes.Ldfld, pathProperty.BackingField);
-                    if (pathProperty.Attribute.Format == null)
-                        methodIlGenerator.Emit(OpCodes.Ldnull);
-                    else
-                        methodIlGenerator.Emit(OpCodes.Ldstr, pathProperty.Attribute.Format);
-                    methodIlGenerator.Emit(OpCodes.Callvirt, typedMethod);
-                }
-
-                // If there are any method headers, add them
-                var methodHeaders = methodInfo.GetCustomAttributes<HeaderAttribute>();
-
-                foreach (var methodHeader in methodHeaders)
-                {
-                    if (methodHeader.Name.Contains(':'))
-                        throw new ImplementationCreationException(String.Format("[Header(\"{0}\")] on method {1} must not have colon in its name", methodHeader.Name, methodInfo.Name));
-                    this.AddMethodHeader(methodIlGenerator, methodHeader);
-                }
-
-                // If we want to allow any status code, set that
-                var resolvedAllowAnyStatusAttribute = allowAnyStatusCodeAttribute ?? classAllowAnyStatusCodeAttribute;
-                if (resolvedAllowAnyStatusAttribute != null && resolvedAllowAnyStatusAttribute.AllowAnyStatusCode)
-                {
-                    methodIlGenerator.Emit(OpCodes.Dup);
-                    methodIlGenerator.Emit(OpCodes.Ldc_I4_1);
-                    methodIlGenerator.Emit(OpCodes.Callvirt, allowAnyStatusCodeSetter);
-                }
-
+                this.AddCancellationTokenIfNeeded(methodIlGenerator, parameterGrouping.CancellationToken);
+                this.AddClassHeadersIfNeeded(methodIlGenerator, classHeadersField);
+                this.AddPropertyHeaders(methodIlGenerator, properties.Headers);
+                this.AddPathProperties(methodIlGenerator, properties.Path);
+                this.AddMethodHeaders(methodIlGenerator, methodInfo);
+                this.AddAllowAnyStatusCodeIfNecessary(methodIlGenerator, allowAnyStatusCodeAttribute ?? classAllowAnyStatusCodeAttribute);
                 this.AddParameters(methodIlGenerator, parameterGrouping, methodInfo.Name, serializationMethods);
-
                 this.AddRequestMethodInvocation(methodIlGenerator, methodInfo);

                 // Finally, return
@@ -424,6 +362,82 @@
             // Ctor the RequestInfo
             // Stack: [this.requester, requestInfo]
             methodIlGenerator.Emit(OpCodes.Newobj, requestInfoCtor);
+        }
+
+        private void AddCancellationTokenIfNeeded(ILGenerator methodIlGenerator, IndexedParameter? cancellationToken)
+        {
+            if (cancellationToken.HasValue)
+            {
+                methodIlGenerator.Emit(OpCodes.Dup);
+                methodIlGenerator.Emit(OpCodes.Ldarg, (short)cancellationToken.Value.Index);
+                methodIlGenerator.Emit(OpCodes.Callvirt, cancellationTokenSetter);
+            }
+        }
+
+        private void AddClassHeadersIfNeeded(ILGenerator methodIlGenerator, FieldInfo classHeadersField)
+        {
+            if (classHeadersField != null)
+            {
+                // requestInfo.ClassHeaders = classHeaders
+                methodIlGenerator.Emit(OpCodes.Dup);
+                methodIlGenerator.Emit(OpCodes.Ldsfld, classHeadersField);
+                methodIlGenerator.Emit(OpCodes.Callvirt, setClassHeadersMethod);
+            }
+        }
+
+        private void AddPropertyHeaders(ILGenerator methodIlGenerator, List<AttributedProperty<HeaderAttribute>> headers)
+        {
+            foreach (var propertyHeader in headers)
+            {
+                var typedMethod = addPropertyHeaderMethod.MakeGenericMethod(propertyHeader.BackingField.FieldType);
+                methodIlGenerator.Emit(OpCodes.Dup);
+                methodIlGenerator.Emit(OpCodes.Ldstr, propertyHeader.Attribute.Name);
+                methodIlGenerator.Emit(OpCodes.Ldarg_0);
+                methodIlGenerator.Emit(OpCodes.Ldfld, propertyHeader.BackingField);
+                if (propertyHeader.Attribute.Value == null)
+                    methodIlGenerator.Emit(OpCodes.Ldnull);
+                else
+                    methodIlGenerator.Emit(OpCodes.Ldstr, propertyHeader.Attribute.Value);
+                methodIlGenerator.Emit(OpCodes.Callvirt, typedMethod);
+            }
+        }
+
+        private void AddPathProperties(ILGenerator methodIlGenerator, List<AttributedProperty<PathAttribute>> path)
+        {
+            foreach (var pathProperty in path)
+            {
+                var typedMethod = addPathPropertyMethod.MakeGenericMethod(pathProperty.BackingField.FieldType);
+                methodIlGenerator.Emit(OpCodes.Dup);
+                methodIlGenerator.Emit(OpCodes.Ldstr, pathProperty.Attribute.Name);
+                methodIlGenerator.Emit(OpCodes.Ldarg_0);
+                methodIlGenerator.Emit(OpCodes.Ldfld, pathProperty.BackingField);
+                if (pathProperty.Attribute.Format == null)
+                    methodIlGenerator.Emit(OpCodes.Ldnull);
+                else
+                    methodIlGenerator.Emit(OpCodes.Ldstr, pathProperty.Attribute.Format);
+                methodIlGenerator.Emit(OpCodes.Callvirt, typedMethod);
+            }
+        }
+
+        private void AddMethodHeaders(ILGenerator methodIlGenerator, MethodInfo methodInfo)
+        {
+            var methodHeaders = methodInfo.GetCustomAttributes<HeaderAttribute>();
+            foreach (var methodHeader in methodHeaders)
+            {
+                if (methodHeader.Name.Contains(':'))
+                    throw new ImplementationCreationException(String.Format("[Header(\"{0}\")] on method {1} must not have colon in its name", methodHeader.Name, methodInfo.Name));
+                this.AddMethodHeader(methodIlGenerator, methodHeader);
+            }
+        }
+
+        private void AddAllowAnyStatusCodeIfNecessary(ILGenerator methodIlGenerator, AllowAnyStatusCodeAttribute resolvedAllowAnyStatusCodeAttribute)
+        {
+            if (resolvedAllowAnyStatusCodeAttribute != null && resolvedAllowAnyStatusCodeAttribute.AllowAnyStatusCode)
+            {
+                methodIlGenerator.Emit(OpCodes.Dup);
+                methodIlGenerator.Emit(OpCodes.Ldc_I4_1);
+                methodIlGenerator.Emit(OpCodes.Callvirt, allowAnyStatusCodeSetter);
+            }
         }

         private void AddParameters(


Fixed wrong transformation of irregular loop edges

--- src/SME.VHDL/Transformations/FixForLoopIncrements.cs
+++ src/SME.VHDL/Transformations/FixForLoopIncrements.cs
@@ -62,7 +62,7 @@
                 return item;
             }

-            var incr = loopedges.Item3;
+            var incr = loopedges.Item3;
 			if (incr == 1)
 				return item;

@@ -77,7 +77,7 @@
 			{
 				var target = x.GetTarget();
 				if (target == stm.LoopIndex)
-					x.SetTarget(tmp);
+					x.SetTarget(tmp);
 			}

 			var exp = firstexp.SourceExpression;
@@ -97,19 +97,36 @@
 					Operator = ICSharpCode.Decompiler.CSharp.Syntax.AssignmentOperatorType.Assign,
 					Right = new BinaryOperatorExpression()
 					{
-						Left = new IdentifierExpression()
+						Left = new PrimitiveExpression()
 						{
-							Name = stm.LoopIndex.Name,
-							Target = stm.LoopIndex,
+							Value = loopedges.Item1,
+							SourceResultType = stm.LoopIndex.CecilType,
+							SourceExpression = exp
+						},
+						Operator = ICSharpCode.Decompiler.CSharp.Syntax.BinaryOperatorType.Add,
+						Right = new ParenthesizedExpression()
+						{
+							Expression = new BinaryOperatorExpression()
+							{
+								Left = new IdentifierExpression()
+								{
+									Name = stm.LoopIndex.Name,
+									Target = stm.LoopIndex,
+									SourceExpression = exp,
+									SourceResultType = tmp.CecilType
+								},
+								Operator = ICSharpCode.Decompiler.CSharp.Syntax.BinaryOperatorType.Multiply,
+								Right = new PrimitiveExpression()
+								{
+									Value = incr,
+									SourceExpression = exp,
+									SourceResultType = tmp.CecilType,
+								},
+								SourceExpression = exp,
+								SourceResultType = tmp.CecilType
+							},
 							SourceExpression = exp,
-							SourceResultType = stm.LoopIndex.CecilType
-						},
-						Operator = ICSharpCode.Decompiler.CSharp.Syntax.BinaryOperatorType.Multiply,
-						Right = new PrimitiveExpression()
-						{
-							Value = incr,
-							SourceResultType = tmp.CecilType,
-							SourceExpression = exp,
+							SourceResultType = tmp.CecilType
 						},
 						SourceExpression = exp,
 						SourceResultType = tmp.CecilType
@@ -140,14 +157,16 @@
                 new IdentifierExpression(stm.LoopIndex),
                 ICSharpCode.Decompiler.CSharp.Syntax.BinaryOperatorType.LessThan,
                 new PrimitiveExpression(
-					// Integer ceiling of Item2 / Item3
-					(loopedges.Item2-1) / loopedges.Item3 + 1,
+					// Integer ceiling of (Item2-1 - Item1) / Item3 + 1
+					(loopedges.Item2-1-loopedges.Item1) / loopedges.Item3 + 1,
 					tmp.CecilType.Module.ImportReference(typeof(int)))
             )
-            {
+            {
                 Parent = stm,
                 SourceResultType = tmp.CecilType.Module.ImportReference(typeof(bool))
             };
+
+			stm.Initializer = new PrimitiveExpression(0, tmp.CecilType);

 			return nstm;
 		}


Clean Active table after upgrade (resolves #741)

--- yafsrc/YAF.Core/Services/Migrations/V80_Migration.cs
+++ yafsrc/YAF.Core/Services/Migrations/V80_Migration.cs
@@ -268,6 +268,8 @@

                 dbCommand.Connection.AddCompositePrimaryKey<Active>(x => x.SessionID, x => x.BoardID);
             }
+
+            repository.DeleteAll();
         }

         private void UpgradeTable(IRepository<ActiveAccess> repository, IDbAccess dbAccess, IDbCommand dbCommand)