Test for bug 1040171: ETA crashes if labeled statement is used as an embedded statement (changeset 1346866)

--- Src/Compilers/CSharp/Test/Symbol/Compilation/SemanticModelGetSemanticInfoTests.cs
+++ Src/Compilers/CSharp/Test/Symbol/Compilation/SemanticModelGetSemanticInfoTests.cs
@@ -1,11 +1,10 @@
 // Copyright (c) Microsoft Open Technologies, Inc.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

 using System;
-using System.Collections.Immutable;
 using System.Linq;
 using Microsoft.CodeAnalysis.CSharp.Symbols;
 using Microsoft.CodeAnalysis.CSharp.Syntax;
-using Microsoft.CodeAnalysis.Text;
+using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
 using Roslyn.Test.Utilities;
 using Xunit;

@@ -15,7 +14,6 @@
 namespace Microsoft.CodeAnalysis.CSharp.UnitTests
 {
     using Utils = CompilationUtils;
-    using Microsoft.CodeAnalysis.CSharp.Test.Utilities;

     public class GetExtendedSemanticInfoTests : SemanticModelTestBase
     {
@@ -5810,6 +5808,26 @@
             Assert.False(semanticInfo.IsCompileTimeConstant);
         }

+        [WorkItem(1040171, "DevDiv")]
+        [Fact(Skip = "Bug 1040171")]
+        public void LabeledEmbeddedStatement_ForEach_2()
+        {
+            const string sourceCode = @"
+class Program
+{
+    static void Main(string[] args)
+    {
+        bool c = true;
+
+        foreach (string s in args)
+            label: c = false;
+    }
+}
+";
+            var compilation = CreateCompilationWithMscorlib(sourceCode);
+            compilation.GetDiagnostics();
+        }
+
         [WorkItem(540759, "DevDiv")]
         [Fact]
         public void DeclarationEmbeddedStatement_Else()


throw and api exception if the command execution fails

--- src/DataCat.Core/Services/DataConnectionService.cs
+++ src/DataCat.Core/Services/DataConnectionService.cs
@@ -48,7 +48,11 @@
             }
             catch (MongoConfigurationException ex)
             {
-                throw new InvalidOperationException(ex.Message, ex);
+                throw new ApiException(ex.Message, HttpStatusCode.BadRequest);
+            }
+            catch (MongoCommandException ex)
+            {
+                throw new ApiException(ex.Message, HttpStatusCode.Forbidden);
             }
         }


Fix Gateway.OnGuildChannelCreated not firing for category, news, and store channels

--- src/Discore/WebSocket/Internal/Gateway.Dispatch.cs
+++ src/Discore/WebSocket/Internal/Gateway.Dispatch.cs
@@ -632,7 +632,11 @@

                 OnDMChannelCreated?.Invoke(this, new DMChannelEventArgs(shard, mutableDMChannel.ImmutableEntity));
             }
-            else if (type == DiscordChannelType.GuildText || type == DiscordChannelType.GuildVoice)
+            else if (type == DiscordChannelType.GuildText
+                || type == DiscordChannelType.GuildVoice
+                || type == DiscordChannelType.GuildCategory
+                || type == DiscordChannelType.GuildNews
+                || type == DiscordChannelType.GuildStore)
             {
                 // Guild channel
                 Snowflake guildId = data.GetSnowflake("guild_id").Value;


Updated unit test to check for specific date value

--- Src/Newtonsoft.Json.Tests/Serialization/DependencyInjectionTests.cs
+++ Src/Newtonsoft.Json.Tests/Serialization/DependencyInjectionTests.cs
@@ -234,7 +234,7 @@
             Assert.IsNotNull(o);
             Assert.IsNotNull(o.Logger);
             Assert.IsNotNull(o.Repository);
-			Assert.IsNotNull(o.Repository.CreatedOn);
+			Assert.AreEqual(o.Repository.CreatedOn, DateTime.Parse("2015-04-01 20:00"));

             Assert.AreEqual(2, count);


Make sure we dispose CancellationTokenRegistration (#2776)

* When the passed cancellation token is shared for a longer time then a single request, e.g bulkall/scrollall/reindex it will leak Register() handles and memory will keep on growing

* PostRequestAsync does not need to be generic

* include GetResponse() in using and inlined it so we can more aggresively cancel on the waithandles in the case of exceptions too

--- src/Elasticsearch.Net/Connection/HttpConnection.cs
+++ src/Elasticsearch.Net/Connection/HttpConnection.cs
@@ -180,7 +180,7 @@
 		}

-		private static void RegisterApmTaskTimeout(IAsyncResult result, WebRequest request, RequestData requestData) =>
+		private static RegisteredWaitHandle RegisterApmTaskTimeout(IAsyncResult result, WebRequest request, RequestData requestData) =>
 			ThreadPool.RegisterWaitForSingleObject(result.AsyncWaitHandle, TimeoutCallback, request, requestData.RequestTimeout, true);

 		private static void TimeoutCallback(object state, bool timedOut)
@@ -189,54 +189,69 @@
 			(state as WebRequest)?.Abort();
 		}

-		public virtual async Task<ElasticsearchResponse<TReturn>> RequestAsync<TReturn>(RequestData requestData, CancellationToken cancellationToken) where TReturn : class
+		public virtual async Task<ElasticsearchResponse<TReturn>> RequestAsync<TReturn>(RequestData requestData,
+			CancellationToken cancellationToken) where TReturn : class
 		{
 			var builder = new ResponseBuilder<TReturn>(requestData, cancellationToken);
+			WaitHandle apmWaitHandle = null;
+			RegisteredWaitHandle apmTaskTimeout = null;
 			try
 			{
+				var data = requestData.PostData;
 				var request = this.CreateHttpWebRequest(requestData);
-				cancellationToken.Register(()=>request.Abort());
-				var data = requestData.PostData;
-
-				if (data != null)
+				using (cancellationToken.Register(() => request.Abort()))
 				{
-					var apmGetRequestStreamTask = Task.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, null);
-					RegisterApmTaskTimeout(apmGetRequestStreamTask, request, requestData);
-
-					using (var stream = await apmGetRequestStreamTask.ConfigureAwait(false))
-					{
-						if (requestData.HttpCompression)
-							using (var zipStream = new GZipStream(stream, CompressionMode.Compress))
-								await data.WriteAsync(zipStream, requestData.ConnectionSettings, cancellationToken).ConfigureAwait(false);
-						else
-							await data.WriteAsync(stream, requestData.ConnectionSettings, cancellationToken).ConfigureAwait(false);
-					}
+					if (data != null)
+						await PostRequestAsync(requestData, cancellationToken, request, data);
+					requestData.MadeItToResponse = true;
+                    //http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.getresponsestream.aspx
+                    //Either the stream or the response object needs to be closed but not both although it won't
+                    //throw any errors if both are closed atleast one of them has to be Closed.
+                    //Since we expose the stream we let closing the stream determining when to close the connection
+
+                    var apmGetResponseTask = Task.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, null);
+                    apmWaitHandle = ((IAsyncResult) apmGetResponseTask).AsyncWaitHandle;
+                    apmTaskTimeout = RegisterApmTaskTimeout(apmGetResponseTask, request, requestData);
+
+                    var response = (HttpWebResponse) (await apmGetResponseTask.ConfigureAwait(false));
+                    builder.StatusCode = (int) response.StatusCode;
+                    builder.Stream = response.GetResponseStream();
+                    if (response.SupportsHeaders && response.Headers.HasKeys() && response.Headers.AllKeys.Contains("Warning"))
+                        builder.DeprecationWarnings = response.Headers.GetValues("Warning");
+                    // https://github.com/elastic/elasticsearch-net/issues/2311
+                    // if stream is null call dispose on response instead.
+                    if (builder.Stream == null || builder.Stream == Stream.Null) response.Dispose();
+                    if (apmWaitHandle != null) apmTaskTimeout?.Unregister(apmWaitHandle);
 				}
-				requestData.MadeItToResponse = true;
-
-				//http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.getresponsestream.aspx
-				//Either the stream or the response object needs to be closed but not both although it won't
-				//throw any errors if both are closed atleast one of them has to be Closed.
-				//Since we expose the stream we let closing the stream determining when to close the connection
-
-				var apmGetResponseTask = Task.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, null);
-				RegisterApmTaskTimeout(apmGetResponseTask, request, requestData);
-
-				var response = (HttpWebResponse)(await apmGetResponseTask.ConfigureAwait(false));
-				builder.StatusCode = (int)response.StatusCode;
-				builder.Stream = response.GetResponseStream();
-				if (response.SupportsHeaders && response.Headers.HasKeys() && response.Headers.AllKeys.Contains("Warning"))
-					builder.DeprecationWarnings = response.Headers.GetValues("Warning");
-				// https://github.com/elastic/elasticsearch-net/issues/2311
-				// if stream is null call dispose on response instead.
-				if (builder.Stream == null || builder.Stream == Stream.Null) response.Dispose();
 			}
 			catch (WebException e)
 			{
+				if (apmWaitHandle != null) apmTaskTimeout?.Unregister(apmWaitHandle);
 				HandleException(builder, e);
 			}
-
+			catch
+			{
+				if (apmWaitHandle != null) apmTaskTimeout?.Unregister(apmWaitHandle);
+				throw;
+			}
 			return await builder.ToResponseAsync().ConfigureAwait(false);
+		}
+
+		private static async Task PostRequestAsync(RequestData requestData, CancellationToken cancellationToken, HttpWebRequest request,
+			PostData<object> data)
+		{
+			var apmGetRequestStreamTask = Task.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, null);
+			var getRequestStreamCancellationHandle = RegisterApmTaskTimeout(apmGetRequestStreamTask, request, requestData);
+
+			using (var stream = await apmGetRequestStreamTask.ConfigureAwait(false))
+			{
+				if (requestData.HttpCompression)
+					using (var zipStream = new GZipStream(stream, CompressionMode.Compress))
+						await data.WriteAsync(zipStream, requestData.ConnectionSettings, cancellationToken).ConfigureAwait(false);
+				else
+					await data.WriteAsync(stream, requestData.ConnectionSettings, cancellationToken).ConfigureAwait(false);
+			}
+			getRequestStreamCancellationHandle.Unregister(((IAsyncResult) apmGetRequestStreamTask).AsyncWaitHandle);
 		}

 		private void HandleException<TReturn>(ResponseBuilder<TReturn> builder, WebException exception)
@@ -244,14 +259,12 @@
 		{
 			builder.Exception = exception;
 			var response = exception.Response as HttpWebResponse;
-			if (response != null)
-			{
-				builder.StatusCode = (int)response.StatusCode;
-				builder.Stream = response.GetResponseStream();
-				// https://github.com/elastic/elasticsearch-net/issues/2311
-				// if stream is null call dispose on response instead.
-				if (builder.Stream == null || builder.Stream == Stream.Null) response.Dispose();
-			}
+			if (response == null) return;
+			builder.StatusCode = (int)response.StatusCode;
+			builder.Stream = response.GetResponseStream();
+			// https://github.com/elastic/elasticsearch-net/issues/2311
+			// if stream is null call dispose on response instead.
+			if (builder.Stream == null || builder.Stream == Stream.Null) response.Dispose();
 		}

 		void IDisposable.Dispose() => this.DisposeManagedResources();


fixing #30 based on user feedback

fixing #30 based on user feedback

--- Plugin.BluetoothLE.Android/Adapter.cs
+++ Plugin.BluetoothLE.Android/Adapter.cs
@@ -34,8 +34,7 @@

         public IDevice GetKnownDevice(Guid deviceId)
         {
-            // TODO: guid flip the end in toString.... need to test this
-            var native = this.manager.Adapter.GetRemoteDevice(deviceId.ToString());
+            var native = this.manager.Adapter.GetRemoteDevice(deviceId.ToByteArray().Skip(10).Take(6).ToArray());
             var device = this.context.Devices.GetDevice(native, TaskScheduler.Current);
             return device;
         }


Raid poll on create add check reaction. Raid time change skip from the bottom.

--- PoGo.DiscordBot/Modules/RaidModule.cs
+++ PoGo.DiscordBot/Modules/RaidModule.cs
@@ -43,15 +43,17 @@
             var roles = teamService.GuildTeamRoles[Context.Guild.Id].TeamRoles.Values;
             var mention = string.Join(' ', roles.Select(t => t.Mention));
             var message = await raidChannel.SendMessageAsync(mention, embed: raidInfo.ToEmbed());
+            await Context.Message.AddReactionAsync(Emojis.Check);
             await raidService.SetDefaultReactions(message);
             raidService.Raids[message.Id] = raidInfo;
         }

         [Command("time", RunMode = RunMode.Async)]
-        public async Task AdjustLastRaidTime(string time)
+        public async Task AdjustLastRaidTime(string time, int skip = 0)
         {
             var raid = raidService.Raids.Values
                 .OrderByDescending(t => t.CreatedAt)
+                .Skip(skip)
                 .FirstOrDefault();

             if(raid == null)


Fix issue in testclient with trackerless torrents and print out stats about active peers

svn path=/trunk/bitsharp/; revision=122123

--- src/SampleClient/main.cs
+++ src/SampleClient/main.cs
@@ -210,9 +210,13 @@
                         AppendFormat(sb, "Upload Speed:       {0:0.00} kB/s", manager.Monitor.UploadSpeed / 1024.0);
                         AppendFormat(sb, "Total Downloaded:   {0:0.00} MB", manager.Monitor.DataBytesDownloaded / (1024.0 * 1024.0));
                         AppendFormat(sb, "Total Uploaded:     {0:0.00} MB", manager.Monitor.DataBytesUploaded / (1024.0 * 1024.0));
-                        AppendFormat(sb, "Tracker Status:     {0}", manager.TrackerManager.CurrentTracker.State);
-                        AppendFormat(sb, "Warning Message:    {0}", manager.TrackerManager.CurrentTracker.WarningMessage);
-                        AppendFormat(sb, "Failure Message:    {0}", manager.TrackerManager.CurrentTracker.FailureMessage);
+                        MonoTorrent.Client.Tracker.Tracker tracker = manager.TrackerManager.CurrentTracker;
+                        AppendFormat(sb, "Tracker Status:     {0}", tracker == null ? "<no tracker>" : tracker.State.ToString());
+                        AppendFormat(sb, "Warning Message:    {0}", tracker == null ? "<no tracker>" : tracker.WarningMessage);
+                        AppendFormat(sb, "Failure Message:    {0}", tracker == null ? "<no tracker>" : tracker.FailureMessage);
+
+                        foreach (PeerId p in manager.GetPeers())
+                            AppendFormat(sb, "\t{2} - {1:0.00}kB/sec - {0}", p.Peer.ConnectionUri, p.Monitor.DownloadSpeed / 1024.0, p.AmRequestingPiecesCount);
                     }
                     Console.Clear();
                     Console.WriteLine(sb.ToString());


Add a new font style for info tab.

Add a new font style for info tab.

commented code for text padding in BuildWorldInfo(): this doesn't work as the fonts used by RimWorld are not fixed fonts...

--- src/TabGuiUtilityInfo.cs
+++ src/TabGuiUtilityInfo.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System.Collections.Generic;
+using System.Linq;
 using System.Text;
 using PrepareLanding.Extensions;
 using PrepareLanding.Filters;
@@ -10,7 +11,8 @@
 {
     public class TabGuiUtilityInfo : TabGuiUtility
     {
-        private readonly GUIStyle _style;
+        private readonly GUIStyle _styleWorldInfo;
+        private readonly GUIStyle _styleFilterInfo;

         private Vector2 _scrollPosWorldInfo;
         private Vector2 _scrollPosFilterInfo;
@@ -20,7 +22,14 @@
         public TabGuiUtilityInfo(PrepareLandingUserData userData, float columnSizePercent = 0.25f) :
             base(columnSizePercent)
         {
-            _style = new GUIStyle(Text.textFieldStyles[1])
+            _styleWorldInfo = new GUIStyle(Text.textAreaReadOnlyStyles[2])
+            {
+                alignment = TextAnchor.UpperLeft,
+                wordWrap = true,
+                richText = true
+            };
+
+            _styleFilterInfo = new GUIStyle(Text.textFieldStyles[1])
             {
                 alignment = TextAnchor.UpperLeft,
                 wordWrap = true,
@@ -59,9 +68,14 @@
                 {
                     stringBuilder.AppendLine("Biomes: (number of tiles)");
                     var biomes = PrepareLanding.Instance.UserData.BiomeDefs;
+
+                    //var biomeNames = biomes.Select(biome => biome.LabelCap).ToList();
+                    //var longestBiomeName = biomeNames.Aggregate("", (max, cur) => max.Length > cur.Length ? max : cur).Length;
+
                     foreach (var biome in biomes)
                     {
                         var count = TileFilterBiomes.NumberOfTilesByBiome(biome, allValidTiles);
+                        //stringBuilder.AppendLine($"    {biome.LabelCap.PadRight(longestBiomeName)} ➠ {count}");
                         stringBuilder.AppendLine($"    {biome.LabelCap} ➠ {count}");
                     }
                 }
@@ -83,20 +97,15 @@
         {
             DrawEntryHeader("World Info", backgroundColor: Color.yellow);

-            var originalFont = Text.Font;
-            Text.Font = GameFont.Medium;
-
-            var maxHeight = InRect.height - ListingStandard.CurHeight;
+            var maxHeight = InRect.height - ListingStandard.CurHeight - 30f;
             var scrollHeight = Text.CalcHeight(WorldInfo, ListingStandard.ColumnWidth);
             scrollHeight = Mathf.Max(maxHeight, scrollHeight);

             var innerLs = ListingStandard.BeginScrollView(maxHeight, scrollHeight, ref _scrollPosWorldInfo);

-            Widgets.Label(innerLs.GetRect(maxHeight), WorldInfo);
+            GUI.TextField(innerLs.GetRect(maxHeight), WorldInfo, _styleWorldInfo);

             ListingStandard.EndScrollView(innerLs);
-
-            Text.Font = originalFont;
         }

         protected virtual void DrawFilterInfo()
@@ -120,7 +129,7 @@

             var innerLs = ListingStandard.BeginScrollView(maxHeight, scrollHeight, ref _scrollPosFilterInfo);

-            GUI.TextField(innerLs.GetRect(maxHeight), text, _style);
+            GUI.TextField(innerLs.GetRect(maxHeight), text, _styleFilterInfo);

             ListingStandard.EndScrollView(innerLs);
         }


LexRoot#UsingNamespaceプロパティを追加

LexRoot#UsingNamespaceプロパティを追加

--- src/JsonStruct.cs
+++ src/JsonStruct.cs
@@ -52,7 +52,12 @@
         [DataMember(Name = "class")]
         public string ClassName { get; set; }

-
+        /// <summary>
+        /// 使用する追加の名前空間を格納した配列を取得または設定します。
+        /// </summary>
+        /// <value>名前空間を表す文字列の配列。</value>
+        [DataMember(Name = "using")]
+        public string[] UsingNamespace { get; set; }

         /// <summary>
         /// 字句解析カテゴリの配列を取得または設定します。


update script query

update script query

--- ncmb_unity/Assets/Editor/NCMBScriptTest.cs
+++ ncmb_unity/Assets/Editor/NCMBScriptTest.cs
@@ -28,181 +28,160 @@

 public class NCMBScriptTest
 {
-    //node.jsのエンドポイント
-    static readonly string _endPoint = "http://localhost:3000/2015-09-01/script";
-
-    delegate void AsyncDelegate();
-
-    [TestFixtureSetUp]
-    public void Init()
-    {
-        NCMBTestSettings.Initialize();
-    }
-
-    [Test]
-    public void ReturnAPIKeyTest()
-    {
-        Assert.AreEqual(NCMBSettings.ApplicationKey, NCMBTestSettings.APP_KEY);
-        Assert.AreEqual(NCMBSettings.ClientKey, NCMBTestSettings.CLIENT_KEY);
-    }
-
-    [Test]
-    public void ExecuteCallbackWhenExecuteScriptTest_POST()
-    {
-        NCMBScript script = new NCMBScript("testScript_POST.js", NCMBScript.MethodType.POST, _endPoint);
-        Dictionary<string, object> body = new Dictionary<string, object>() { { "name", "tarou" } };
-        script.ExecuteAsync(null, body, null, (byte[] result, NCMBException e) => {
-            if (e == null)
-            {
-                string cmd = System.Text.Encoding.UTF8.GetString(result);
-                cmd = cmd.TrimEnd('\0');//終端文字の削除
-                Assert.AreEqual("hello,tarou", cmd);
-            }
-            else
-            {
-                Assert.Fail(e.ErrorMessage);
-            }
-            NCMBTestSettings.CallbackFlag = true;
-        });
-
-        NCMBTestSettings.AwaitAsync();
-        Assert.True(NCMBTestSettings.CallbackFlag);
-    }
-
-    [Test]
-    public void ExecuteCallbackWhenExecuteScriptTest_PUT()
-    {
-        NCMBScript script = new NCMBScript("testScript_PUT.js", NCMBScript.MethodType.PUT, _endPoint);
-        Dictionary<string, object> body = new Dictionary<string, object>() { { "name", "tarou" } };
-        script.ExecuteAsync(null, body, null, (byte[] result, NCMBException e) => {
-            if (e == null)
-            {
-                string cmd = System.Text.Encoding.UTF8.GetString(result);
-                cmd = cmd.TrimEnd('\0');//終端文字の削除
-                Assert.AreEqual("hello,tarou", cmd);
-            }
-            else
-            {
-                Assert.Fail(e.ErrorMessage);
-            }
-            NCMBTestSettings.CallbackFlag = true;
-        });
-
-        NCMBTestSettings.AwaitAsync();
-        Assert.True(NCMBTestSettings.CallbackFlag);
-    }
-
-    [Test]
-    public void ExecuteCallbackWhenExecuteScriptTest_GET()
-    {
-        NCMBScript script = new NCMBScript("testScript_GET.js", NCMBScript.MethodType.GET, _endPoint);
-        Dictionary<string, object> query = new Dictionary<string, object>() { { "name", "tarou" } };
-        script.ExecuteAsync(null, null, query, (byte[] result, NCMBException e) => {
-            if (e == null)
-            {
-                string cmd = System.Text.Encoding.UTF8.GetString(result);
-                cmd = cmd.TrimEnd('\0');//終端文字の削除
-                Assert.AreEqual("hello,tarou", cmd);
-            }
-            else
-            {
-                Assert.Fail(e.ErrorMessage);
-            }
-            NCMBTestSettings.CallbackFlag = true;
-        });
-
-        NCMBTestSettings.AwaitAsync();
-        Assert.True(NCMBTestSettings.CallbackFlag);
-    }
-
-    [Test]
-    public void ExecuteCallbackWhenExecuteScriptTest_GET_Count()
-    {
-        NCMBScript script = new NCMBScript("testScript_GET.js", NCMBScript.MethodType.GET, _endPoint);
-        Dictionary<string, object> query = new Dictionary<string, object>() { { "name", "tarou" }, { "message", "hello" } };
-        script.ExecuteAsync(null, null, query, (byte[] result, NCMBException e) => {
-            if (e == null)
-            {
-                string cmd = System.Text.Encoding.UTF8.GetString(result);
-                cmd = cmd.TrimEnd('\0');//終端文字の削除
-                Assert.AreEqual("count:2", cmd);
-            }
-            else
-            {
-                Assert.Fail(e.ErrorMessage);
-            }
-            NCMBTestSettings.CallbackFlag = true;
-        });
-
-        NCMBTestSettings.AwaitAsync();
-        Assert.True(NCMBTestSettings.CallbackFlag);
-    }
-
-    [Test]
-    public void ExecuteCallbackWhenExecuteScriptTest_DELETE()
-    {
-        NCMBScript script = new NCMBScript("testScript_DELETE.js", NCMBScript.MethodType.DELETE, _endPoint);
-        script.ExecuteAsync(null, null, null, (byte[] result, NCMBException e) => {
-            if (e == null)
-            {
-                string cmd = System.Text.Encoding.UTF8.GetString(result);
-                cmd = cmd.TrimEnd('\0');//終端文字の削除
-                Assert.AreEqual("", cmd);
-            }
-            else
-            {
-                Assert.Fail(e.ErrorMessage);
-            }
-            NCMBTestSettings.CallbackFlag = true;
-        });
-
-        NCMBTestSettings.AwaitAsync();
-        Assert.True(NCMBTestSettings.CallbackFlag);
-    }
-
-    [Test]
-    public void ExecuteCallbackWhenExecuteScriptTest_Error()
-    {
-        NCMBScript script = new NCMBScript("testScript_Error.js", NCMBScript.MethodType.GET, _endPoint);
-        script.ExecuteAsync(null, null, null, (byte[] result, NCMBException e) => {
-            if (e == null)
-            {
-                Assert.Fail("Always test case to fail.");
-            }
-            else
-            {
-                Assert.AreEqual("name must not be null.", e.ErrorMessage);
-                Assert.AreEqual(HttpStatusCode.BadRequest.ToString(), e.ErrorCode);
-            }
-            NCMBTestSettings.CallbackFlag = true;
-        });
-
-        NCMBTestSettings.AwaitAsync();
-        Assert.True(NCMBTestSettings.CallbackFlag);
-    }
-
-    [Test]
-    public void ExecuteCallbackWhenExecuteScriptTest_Header()
-    {
-        NCMBScript script = new NCMBScript("testScript_Header.js", NCMBScript.MethodType.POST, _endPoint);
-        Dictionary<string, object> header = new Dictionary<string, object>() { { "key", "value" } };
-        script.ExecuteAsync(header, null, null, (byte[] result, NCMBException e) => {
-            if (e == null)
-            {
-                string cmd = System.Text.Encoding.UTF8.GetString(result);
-                cmd = cmd.TrimEnd('\0');//終端文字の削除
-                Assert.AreEqual("value", cmd);
-            }
-            else
-            {
-                Assert.Fail(e.ErrorMessage);
-            }
-            NCMBTestSettings.CallbackFlag = true;
-        });
-
-        NCMBTestSettings.AwaitAsync();
-        Assert.True(NCMBTestSettings.CallbackFlag);
-    }
+	//node.jsのエンドポイント
+	static readonly string _endPoint = "http://localhost:3000/2015-09-01/script";
+
+	delegate void AsyncDelegate ();
+
+	[TestFixtureSetUp]
+	public void Init ()
+	{
+		NCMBTestSettings.Initialize ();
+	}
+
+	[Test]
+	public void ReturnAPIKeyTest ()
+	{
+		Assert.AreEqual (NCMBSettings.ApplicationKey, NCMBTestSettings.APP_KEY);
+		Assert.AreEqual (NCMBSettings.ClientKey, NCMBTestSettings.CLIENT_KEY);
+	}
+
+	[Test]
+	public void ExecuteCallbackWhenExecuteScriptTest_POST ()
+	{
+		NCMBScript script = new NCMBScript ("testScript_POST.js", NCMBScript.MethodType.POST, _endPoint);
+		Dictionary<string, object> body = new Dictionary<string, object> (){ { "name", "tarou" } };
+		script.ExecuteAsync (null, body, null, (byte[] result, NCMBException e) => {
+			if (e == null) {
+				string cmd = System.Text.Encoding.UTF8.GetString (result);
+				cmd = cmd.TrimEnd ('\0');//終端文字の削除
+				Assert.AreEqual ("hello,tarou", cmd);
+			} else {
+				Assert.Fail (e.ErrorMessage);
+			}
+			NCMBTestSettings.CallbackFlag = true;
+		});
+
+		NCMBTestSettings.AwaitAsync ();
+		Assert.True (NCMBTestSettings.CallbackFlag);
+	}
+
+	[Test]
+	public void ExecuteCallbackWhenExecuteScriptTest_PUT ()
+	{
+		NCMBScript script = new NCMBScript ("testScript_PUT.js", NCMBScript.MethodType.PUT, _endPoint);
+		Dictionary<string, object> body = new Dictionary<string, object> (){ { "name", "tarou" } };
+		script.ExecuteAsync (null, body, null, (byte[] result, NCMBException e) => {
+			if (e == null) {
+				string cmd = System.Text.Encoding.UTF8.GetString (result);
+				cmd = cmd.TrimEnd ('\0');//終端文字の削除
+				Assert.AreEqual ("hello,tarou", cmd);
+			} else {
+				Assert.Fail (e.ErrorMessage);
+			}
+			NCMBTestSettings.CallbackFlag = true;
+		});
+
+		NCMBTestSettings.AwaitAsync ();
+		Assert.True (NCMBTestSettings.CallbackFlag);
+	}
+
+	[Test]
+	public void ExecuteCallbackWhenExecuteScriptTest_GET ()
+	{
+		NCMBScript script = new NCMBScript ("testScript_GET.js", NCMBScript.MethodType.GET, _endPoint);
+		Dictionary<string, object> query = new Dictionary<string, object> (){ { "name", "tarou" } };
+		script.ExecuteAsync (null, null, query, (byte[] result, NCMBException e) => {
+			if (e == null) {
+				string cmd = System.Text.Encoding.UTF8.GetString (result);
+				cmd = cmd.TrimEnd ('\0');//終端文字の削除
+				Assert.AreEqual ("hello,tarou", cmd);
+			} else {
+				Assert.Fail (e.ErrorMessage);
+			}
+			NCMBTestSettings.CallbackFlag = true;
+		});
+
+		NCMBTestSettings.AwaitAsync ();
+		Assert.True (NCMBTestSettings.CallbackFlag);
+	}
+
+	[Test]
+	public void ExecuteCallbackWhenExecuteScriptTest_GET_Count ()
+	{
+		NCMBScript script = new NCMBScript ("testScript_GET.js", NCMBScript.MethodType.GET, _endPoint);
+		Dictionary<string, object> query = new Dictionary<string, object> (){ { "name", "tarou" }, { "message","hello" } };
+		script.ExecuteAsync (null, null, query, (byte[] result, NCMBException e) => {
+			if (e == null) {
+				string cmd = System.Text.Encoding.UTF8.GetString (result);
+				cmd = cmd.TrimEnd ('\0');//終端文字の削除
+				Assert.AreEqual ("count:2", cmd);
+			} else {
+				Assert.Fail (e.ErrorMessage);
+			}
+			NCMBTestSettings.CallbackFlag = true;
+		});
+
+		NCMBTestSettings.AwaitAsync ();
+		Assert.True (NCMBTestSettings.CallbackFlag);
+	}
+
+	[Test]
+	public void ExecuteCallbackWhenExecuteScriptTest_DELETE ()
+	{
+		NCMBScript script = new NCMBScript ("testScript_DELETE.js", NCMBScript.MethodType.DELETE, _endPoint);
+		script.ExecuteAsync (null, null, null, (byte[] result, NCMBException e) => {
+			if (e == null) {
+				string cmd = System.Text.Encoding.UTF8.GetString (result);
+				cmd = cmd.TrimEnd ('\0');//終端文字の削除
+				Assert.AreEqual ("", cmd);
+			} else {
+				Assert.Fail (e.ErrorMessage);
+			}
+			NCMBTestSettings.CallbackFlag = true;
+		});
+
+		NCMBTestSettings.AwaitAsync ();
+		Assert.True (NCMBTestSettings.CallbackFlag);
+	}
+
+	[Test]
+	public void ExecuteCallbackWhenExecuteScriptTest_Error ()
+	{
+		NCMBScript script = new NCMBScript ("testScript_Error.js", NCMBScript.MethodType.GET, _endPoint);
+		script.ExecuteAsync (null, null, null, (byte[] result, NCMBException e) => {
+			if (e == null) {
+				Assert.Fail ("Always test case to fail.");
+			} else {
+				Assert.AreEqual ("name must not be null.", e.ErrorMessage);
+				Assert.AreEqual (HttpStatusCode.BadRequest.ToString (), e.ErrorCode);
+			}
+			NCMBTestSettings.CallbackFlag = true;
+		});
+
+		NCMBTestSettings.AwaitAsync ();
+		Assert.True (NCMBTestSettings.CallbackFlag);
+	}
+
+	[Test]
+	public void ExecuteCallbackWhenExecuteScriptTest_Header ()
+	{
+		NCMBScript script = new NCMBScript ("testScript_Header.js", NCMBScript.MethodType.POST, _endPoint);
+		Dictionary<string, object> header = new Dictionary<string, object> (){ { "key", "value" } };
+		script.ExecuteAsync (header, null, null, (byte[] result, NCMBException e) => {
+			if (e == null) {
+				string cmd = System.Text.Encoding.UTF8.GetString (result);
+				cmd = cmd.TrimEnd ('\0');//終端文字の削除
+				Assert.AreEqual ("value", cmd);
+			} else {
+				Assert.Fail (e.ErrorMessage);
+			}
+			NCMBTestSettings.CallbackFlag = true;
+		});
+
+		NCMBTestSettings.AwaitAsync ();
+		Assert.True (NCMBTestSettings.CallbackFlag);
+	}

     [Test]
     public void ExecuteCallbackWhenExecuteScriptObjectTest_GET()
@@ -227,7 +206,6 @@
         NCMBTestSettings.AwaitAsync();
         Assert.True(NCMBTestSettings.CallbackFlag);
     }
-
 }


Remove console context from Items in OnPerformed

--- src/Hangfire.Console/Server/ConsoleServerFilter.cs
+++ src/Hangfire.Console/Server/ConsoleServerFilter.cs
@@ -60,6 +60,9 @@
             {
                 ConsoleContext.FromPerformContext(filterContext)?.Expire(_options.ExpireIn);
             }
+
+            // remove console context to prevent further writes from filters
+            filterContext.Items.Remove("ConsoleContext");
         }
     }
 }


fix monitor api bug

fix monitor api bug

--- src/Hangfire.SQLite/SQLiteJobQueueMonitoringApi.cs
+++ src/Hangfire.SQLite/SQLiteJobQueueMonitoringApi.cs
@@ -106,7 +106,7 @@
     select
         case when FetchedAt is null then 1 else 0 end as Enqueued,
         case when FetchedAt is not null then 1 else 0 end as Fetched
-    from [{_storage.SchemaName}].JobQueue
+    from [{_storage.SchemaName}.JobQueue]
     where Queue = @queue
 ) q";


HiPCMS - 378 Adding Default Role Student initially

Adding Default Role Student for all the users.

--- src/HiP-CmsWebApi/Controllers/AccountController.cs
+++ src/HiP-CmsWebApi/Controllers/AccountController.cs
@@ -45,11 +45,13 @@
         [Route("api/register")]
         public async Task<IdentityResult> Register(RegisterViewModel model, string returnUrl = null)
         {
-            var result =  await _userManager.CreateAsync(new ApplicationUser { UserName = model.Email, Email = model.Email }, model.Password);
+            var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
+            var result =  await _userManager.CreateAsync(user, model.Password);

             if (result.Succeeded)
             {
                 _logger.LogInformation(3, "User created a new account with password.");
+                await _userManager.AddToRoleAsync(user, Constants.Roles.Student);
                 return result;
             }
             return result;


added virtual to properties.

added virtual to properties.

--- Purchasing.Core/Domain/KfsDocument.cs
+++ Purchasing.Core/Domain/KfsDocument.cs
@@ -5,9 +5,9 @@
 {
     public class KfsDocument : DomainObject
     {
-        public string DocNumber { get; set; }
+        public virtual string DocNumber { get; set; }

-        public Order Order { get; set; }
+        public virtual Order Order { get; set; }
     }

     public class KfsDocumentMap : ClassMap<KfsDocument>


Enums can only have 32 types!

Enums can only have 32 types!

--- src/IF.Lastfm.Core/Api/Enums/LastResponseStatus.cs
+++ src/IF.Lastfm.Core/Api/Enums/LastResponseStatus.cs
@@ -7,23 +7,23 @@
         /// <summary>
         /// The request was successful!
         /// </summary>
-        Successful = 40,
+        Successful = 20,

         /// <summary>
         /// The request has been cached, it will be sent later
         /// </summary>
-        Cached = 41,
+        Cached = 21,

         /// <summary>
         /// The request could not be sent, and could not be cached.
         /// Check the Exception property of the response for details.
         /// </summary>
-        CacheFailed = 42,
+        CacheFailed = 22,

         /// <summary>
         /// The request failed, check for network connectivity
         /// </summary>
-        RequestFailed = 43,
+        RequestFailed = 23,

         /// <summary>
         /// The service requested does not exist (2)