From 5289d793f90c99d18ba24529d5b8fb4259a0be2f Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Thu, 8 May 2014 16:26:59 -0700 Subject: [PATCH 001/295] Create LICENSE.txt --- LICENSE.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000000..d85a1524ad --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,12 @@ +Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +these files except in compliance with the License. You may obtain a copy of the +License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed +under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. From 7df56f6d2d9e749a00f6e1bd1ca5519096bd9eef Mon Sep 17 00:00:00 2001 From: Pranav K Date: Sat, 14 Feb 2015 09:50:08 -0800 Subject: [PATCH 002/295] Porting Session from Microsoft.Framework.Cache --- .gitattributes | 50 +++ .gitignore | 26 ++ CONTRIBUTING.md | 4 + Microsoft.AspNet.Session.sln | 45 +++ NuGet.Config | 7 + README.md | 9 + build.cmd | 28 ++ build.sh | 38 +++ global.json | 3 + makefile.shade | 7 + samples/SessionSample/SessionSample.kproj | 18 ++ samples/SessionSample/Startup.cs | 61 ++++ samples/SessionSample/project.json | 16 + .../CachingServicesExtensions.cs | 15 + .../DistributedSession.cs | 293 ++++++++++++++++++ .../DistributedSessionStore.cs | 40 +++ src/Microsoft.AspNet.Session/ISessionStore.cs | 15 + .../Microsoft.AspNet.Session.kproj | 17 + .../NotNullAttribute.cs | 12 + .../SessionDefaults.cs | 12 + .../SessionFactory.cs | 36 +++ .../SessionFeature.cs | 14 + .../SessionMiddleware.cs | 155 +++++++++ .../SessionMiddlewareExtensions.cs | 49 +++ .../SessionOptions.cs | 43 +++ src/Microsoft.AspNet.Session/SipHash.cs | 204 ++++++++++++ src/Microsoft.AspNet.Session/project.json | 21 ++ .../Microsoft.AspNet.Session.Tests.kproj | 17 + .../SessionTests.cs | 266 ++++++++++++++++ .../project.json | 14 + 30 files changed, 1535 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 Microsoft.AspNet.Session.sln create mode 100644 NuGet.Config create mode 100644 README.md create mode 100644 build.cmd create mode 100644 build.sh create mode 100644 global.json create mode 100644 makefile.shade create mode 100644 samples/SessionSample/SessionSample.kproj create mode 100644 samples/SessionSample/Startup.cs create mode 100644 samples/SessionSample/project.json create mode 100644 src/Microsoft.AspNet.Session/CachingServicesExtensions.cs create mode 100644 src/Microsoft.AspNet.Session/DistributedSession.cs create mode 100644 src/Microsoft.AspNet.Session/DistributedSessionStore.cs create mode 100644 src/Microsoft.AspNet.Session/ISessionStore.cs create mode 100644 src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.kproj create mode 100644 src/Microsoft.AspNet.Session/NotNullAttribute.cs create mode 100644 src/Microsoft.AspNet.Session/SessionDefaults.cs create mode 100644 src/Microsoft.AspNet.Session/SessionFactory.cs create mode 100644 src/Microsoft.AspNet.Session/SessionFeature.cs create mode 100644 src/Microsoft.AspNet.Session/SessionMiddleware.cs create mode 100644 src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs create mode 100644 src/Microsoft.AspNet.Session/SessionOptions.cs create mode 100644 src/Microsoft.AspNet.Session/SipHash.cs create mode 100644 src/Microsoft.AspNet.Session/project.json create mode 100644 test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.kproj create mode 100644 test/Microsoft.AspNet.Session.Tests/SessionTests.cs create mode 100644 test/Microsoft.AspNet.Session.Tests/project.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..bdaa5ba982 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,50 @@ +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain + +*.jpg binary +*.png binary +*.gif binary + +*.cs text=auto diff=csharp +*.vb text=auto +*.resx text=auto +*.c text=auto +*.cpp text=auto +*.cxx text=auto +*.h text=auto +*.hxx text=auto +*.py text=auto +*.rb text=auto +*.java text=auto +*.html text=auto +*.htm text=auto +*.css text=auto +*.scss text=auto +*.sass text=auto +*.less text=auto +*.js text=auto +*.lisp text=auto +*.clj text=auto +*.sql text=auto +*.php text=auto +*.lua text=auto +*.m text=auto +*.asm text=auto +*.erl text=auto +*.fs text=auto +*.fsx text=auto +*.hs text=auto + +*.csproj text=auto +*.vbproj text=auto +*.fsproj text=auto +*.dbproj text=auto +*.sln text=auto eol=crlf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..216e8d9c58 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +[Oo]bj/ +[Bb]in/ +TestResults/ +.nuget/ +*.sln.ide/ +_ReSharper.*/ +packages/ +artifacts/ +PublishProfiles/ +*.user +*.suo +*.cache +*.docstates +_ReSharper.* +nuget.exe +*net45.csproj +*net451.csproj +*k10.csproj +*.psess +*.vsp +*.pidb +*.userprefs +*DS_Store +*.ncrunchsolution +*.*sdf +*.ipch \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..eac4268e4c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,4 @@ +Contributing +====== + +Information on contributing to this repo is in the [Contributing Guide](https://github.com/aspnet/Home/blob/master/CONTRIBUTING.md) in the Home repo. diff --git a/Microsoft.AspNet.Session.sln b/Microsoft.AspNet.Session.sln new file mode 100644 index 0000000000..11c3cf5f62 --- /dev/null +++ b/Microsoft.AspNet.Session.sln @@ -0,0 +1,45 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.22604.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A189F10C-3A9C-4F81-83D0-32E5FE50DAD8}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session", "src\Microsoft.AspNet.Session\Microsoft.AspNet.Session.kproj", "{71802736-F640-4733-9671-02D267EDD76A}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session.Tests", "test\Microsoft.AspNet.Session.Tests\Microsoft.AspNet.Session.Tests.kproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SessionSample", "samples\SessionSample\SessionSample.kproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {71802736-F640-4733-9671-02D267EDD76A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {71802736-F640-4733-9671-02D267EDD76A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {71802736-F640-4733-9671-02D267EDD76A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {71802736-F640-4733-9671-02D267EDD76A}.Release|Any CPU.Build.0 = Release|Any CPU + {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Release|Any CPU.Build.0 = Release|Any CPU + {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {71802736-F640-4733-9671-02D267EDD76A} = {A189F10C-3A9C-4F81-83D0-32E5FE50DAD8} + {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639} = {E9D63F97-6078-42AD-BFD3-F956BF921BB5} + {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365} = {94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE} + EndGlobalSection +EndGlobal diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000000..f41e9c631d --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/README.md b/README.md new file mode 100644 index 0000000000..c3a8d80720 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +Caching +================ + +Contains libraries for caching for ASP.NET 5. + +This project is part of ASP.NET 5. You can find samples, documentation and getting started instructions for ASP.NET 5 at the [Home](https://github.com/aspnet/home) repo. + + + diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000000..86ca5bbbf1 --- /dev/null +++ b/build.cmd @@ -0,0 +1,28 @@ +@echo off +cd %~dp0 + +SETLOCAL +SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe + +IF EXIST %CACHED_NUGET% goto copynuget +echo Downloading latest version of NuGet.exe... +IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet +@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'" + +:copynuget +IF EXIST .nuget\nuget.exe goto restore +md .nuget +copy %CACHED_NUGET% .nuget\nuget.exe > nul + +:restore +IF EXIST packages\KoreBuild goto run +.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre +.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion + +IF "%SKIP_KRE_INSTALL%"=="1" goto run +CALL packages\KoreBuild\build\kvm upgrade -runtime CLR -x86 +CALL packages\KoreBuild\build\kvm install default -runtime CoreCLR -x86 + +:run +CALL packages\KoreBuild\build\kvm use default -runtime CLR -x86 +packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* diff --git a/build.sh b/build.sh new file mode 100644 index 0000000000..c7873ef58e --- /dev/null +++ b/build.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +if test `uname` = Darwin; then + cachedir=~/Library/Caches/KBuild +else + if [ -z $XDG_DATA_HOME ]; then + cachedir=$HOME/.local/share + else + cachedir=$XDG_DATA_HOME; + fi +fi +mkdir -p $cachedir + +url=https://www.nuget.org/nuget.exe + +if test ! -f $cachedir/nuget.exe; then + wget -O $cachedir/nuget.exe $url 2>/dev/null || curl -o $cachedir/nuget.exe --location $url /dev/null +fi + +if test ! -e .nuget; then + mkdir .nuget + cp $cachedir/nuget.exe .nuget/nuget.exe +fi + +if test ! -d packages/KoreBuild; then + mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre + mono .nuget/nuget.exe install Sake -version 0.2 -o packages -ExcludeVersion +fi + +if ! type k > /dev/null 2>&1; then + source packages/KoreBuild/build/kvm.sh +fi + +if ! type k > /dev/null 2>&1; then + kvm upgrade +fi + +mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@" diff --git a/global.json b/global.json new file mode 100644 index 0000000000..840c36f6ad --- /dev/null +++ b/global.json @@ -0,0 +1,3 @@ +{ + "sources": ["src"] +} \ No newline at end of file diff --git a/makefile.shade b/makefile.shade new file mode 100644 index 0000000000..562494d144 --- /dev/null +++ b/makefile.shade @@ -0,0 +1,7 @@ + +var VERSION='0.1' +var FULL_VERSION='0.1' +var AUTHORS='Microsoft Open Technologies, Inc.' + +use-standard-lifecycle +k-standard-goals diff --git a/samples/SessionSample/SessionSample.kproj b/samples/SessionSample/SessionSample.kproj new file mode 100644 index 0000000000..941cbc31f0 --- /dev/null +++ b/samples/SessionSample/SessionSample.kproj @@ -0,0 +1,18 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + fe0b9969-3bde-4a7d-be1b-47eae8dbf365 + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ + + + 2.0 + 29562 + + + \ No newline at end of file diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs new file mode 100644 index 0000000000..7c8716fff7 --- /dev/null +++ b/samples/SessionSample/Startup.cs @@ -0,0 +1,61 @@ +using System; +using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Http; +using Microsoft.Framework.DependencyInjection; +using Microsoft.Framework.Logging; +using Microsoft.Framework.Logging.Console; + +namespace SessionSample +{ + public class Startup + { + public Startup(ILoggerFactory loggerFactory) + { + loggerFactory.AddConsole(LogLevel.Verbose); + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddCachingServices(); + services.AddSessionServices(); + } + + public void Configure(IApplicationBuilder app) + { + app.UseSession(o => { + o.IdleTimeout = TimeSpan.FromSeconds(30); }); + // app.UseInMemorySession(); + // app.UseDistributedSession(new RedisCache(new RedisCacheOptions() { Configuration = "localhost" })); + + app.Map("/session", subApp => + { + subApp.Run(async context => + { + int visits = 0; + visits = context.Session.GetInt("visits") ?? 0; + context.Session.SetInt("visits", ++visits); + await context.Response.WriteAsync("Counting: You have visited our page this many times: " + visits); + }); + }); + + app.Run(async context => + { + int visits = 0; + visits = context.Session.GetInt("visits") ?? 0; + await context.Response.WriteAsync(""); + if (visits == 0) + { + await context.Response.WriteAsync("Your session has not been established.
"); + await context.Response.WriteAsync(DateTime.Now + "
"); + await context.Response.WriteAsync("Establish session.
"); + } + else + { + context.Session.SetInt("visits", ++visits); + await context.Response.WriteAsync("Your session was located, you've visited the site this many times: " + visits); + } + await context.Response.WriteAsync(""); + }); + } + } +} diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json new file mode 100644 index 0000000000..4a82a27681 --- /dev/null +++ b/samples/SessionSample/project.json @@ -0,0 +1,16 @@ +{ + "webroot": "wwwroot", + "exclude": "wwwroot/**/*.*", + "dependencies": { + "Microsoft.AspNet.Http.Extensions": "1.0.0-*", + "Microsoft.AspNet.Server.IIS": "1.0.0-*", + "Microsoft.AspNet.Server.WebListener" : "1.0.0-*", + "Microsoft.AspNet.Session": "1.0.0-*", + "Microsoft.Framework.Cache.Redis": "1.0.0-*", + "Microsoft.Framework.Logging.Console": "1.0.0-*" + }, + "commands": { "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, + "frameworks" : { + "aspnet50" : { } + } +} diff --git a/src/Microsoft.AspNet.Session/CachingServicesExtensions.cs b/src/Microsoft.AspNet.Session/CachingServicesExtensions.cs new file mode 100644 index 0000000000..69ef155018 --- /dev/null +++ b/src/Microsoft.AspNet.Session/CachingServicesExtensions.cs @@ -0,0 +1,15 @@ +// 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 Microsoft.AspNet.Session; + +namespace Microsoft.Framework.DependencyInjection +{ + public static class CachingServicesExtensions + { + public static IServiceCollection AddSessionServices(this IServiceCollection collection) + { + return collection.AddTransient(); + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs new file mode 100644 index 0000000000..f413245e14 --- /dev/null +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -0,0 +1,293 @@ +// 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.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Microsoft.AspNet.Http.Interfaces; +using Microsoft.Framework.Cache.Distributed; +using Microsoft.Framework.Logging; + +namespace Microsoft.AspNet.Session +{ + public class DistributedSession : ISession + { + private const byte SerializationRevision = 1; + private const int KeyLengthLimit = ushort.MaxValue; + + private readonly IDistributedCache _cache; + private readonly string _sessionId; + private readonly TimeSpan _idleTimeout; + private readonly Func _tryEstablishSession; + private readonly IDictionary _store; + private readonly ILogger _logger; + private bool _isModified; + private bool _loaded; + private bool _isNewSessionKey; + + public DistributedSession([NotNull] IDistributedCache cache, [NotNull] string sessionId, TimeSpan idleTimeout, + [NotNull] Func tryEstablishSession, [NotNull] ILoggerFactory loggerFactory, bool isNewSessionKey) + { + _cache = cache; + _sessionId = sessionId; + _idleTimeout = idleTimeout; + _tryEstablishSession = tryEstablishSession; + _store = new Dictionary(); + _logger = loggerFactory.Create(); + _isNewSessionKey = isNewSessionKey; + } + + public IEnumerable Keys + { + get + { + Load(); // TODO: Silent failure + return _store.Keys.Select(key => key.KeyString); + } + } + + public bool TryGetValue(string key, out byte[] value) + { + Load(); // TODO: Silent failure + return _store.TryGetValue(new EncodedKey(key), out value); + } + + public void Set(string key, ArraySegment value) + { + var encodedKey = new EncodedKey(key); + if (encodedKey.KeyBytes.Length > KeyLengthLimit) + { + throw new ArgumentOutOfRangeException("key", key, + string.Format("The key cannot be longer than '{0}' when encoded with UTF-8.", KeyLengthLimit)); + } + if (value.Array == null) + { + throw new ArgumentException("The ArraySegment.Array cannot be null.", "value"); + } + + Load(); + if (!_tryEstablishSession()) + { + throw new InvalidOperationException("The session cannot be established after the response has started."); + } + _isModified = true; + byte[] copy = new byte[value.Count]; + Buffer.BlockCopy(value.Array, value.Offset, copy, 0, value.Count); + _store[encodedKey] = copy; + } + + public void Remove(string key) + { + Load(); + _isModified |= _store.Remove(new EncodedKey(key)); + } + + public void Clear() + { + Load(); + _isModified |= _store.Count > 0; + _store.Clear(); + } + + // TODO: This should throw if called directly, but most other places it should fail silently (e.g. TryGetValue should just return null). + public void Load() + { + if (!_loaded) + { + Stream data; + if (_cache.TryGetValue(_sessionId, out data)) + { + Deserialize(data); + } + else if (!_isNewSessionKey) + { + _logger.WriteWarning("Accessing expired session {0}", _sessionId); + } + _loaded = true; + } + } + + public void Commit() + { + if (_isModified) + { + Stream data; + if (_logger.IsEnabled(LogLevel.Information) && !_cache.TryGetValue(_sessionId, out data)) + { + _logger.WriteInformation("Session {0} started", _sessionId); + } + _isModified = false; + _cache.Set(_sessionId, context => { + context.SetSlidingExpiration(_idleTimeout); + Serialize(context.Data); + }); + } + } + + // Format: + // Serialization revision: 1 byte, range 0-255 + // Entry count: 3 bytes, range 0-16,777,215 + // foreach entry: + // key name byte length: 2 bytes, range 0-65,535 + // UTF-8 encoded key name byte[] + // data byte length: 4 bytes, range 0-2,147,483,647 + // data byte[] + private void Serialize(Stream output) + { + output.WriteByte(SerializationRevision); + SerializeNumAs3Bytes(output, _store.Count); + + foreach (var entry in _store) + { + var keyBytes = entry.Key.KeyBytes; + SerializeNumAs2Bytes(output, keyBytes.Length); + output.Write(keyBytes, 0, keyBytes.Length); + SerializeNumAs4Bytes(output, entry.Value.Length); + output.Write(entry.Value, 0, entry.Value.Length); + } + } + + private void Deserialize(Stream content) + { + if (content == null || content.ReadByte() != SerializationRevision) + { + // TODO: Throw? + // Replace the un-readable format. + _isModified = true; + return; + } + + int expectedEntries = DeserializeNumFrom3Bytes(content); + for (int i = 0; i < expectedEntries; i++) + { + int keyLength = DeserializeNumFrom2Bytes(content); + var key = new EncodedKey(content.ReadBytes(keyLength)); + int dataLength = DeserializeNumFrom4Bytes(content); + _store[key] = content.ReadBytes(dataLength); + } + } + + private void SerializeNumAs2Bytes(Stream output, int num) + { + if (num < 0 || ushort.MaxValue < num) + { + throw new ArgumentOutOfRangeException("num", num, "The value cannot be serialized in two bytes."); + } + output.WriteByte((byte)(num >> 8)); + output.WriteByte((byte)(0xFF & num)); + } + + private int DeserializeNumFrom2Bytes(Stream content) + { + return content.ReadByte() << 8 | content.ReadByte(); + } + + private void SerializeNumAs3Bytes(Stream output, int num) + { + if (num < 0 || 0xFFFFFF < num) + { + throw new ArgumentOutOfRangeException("num", num, "The value cannot be serialized in three bytes."); + } + output.WriteByte((byte)(num >> 16)); + output.WriteByte((byte)(0xFF & (num >> 8))); + output.WriteByte((byte)(0xFF & num)); + } + + private int DeserializeNumFrom3Bytes(Stream content) + { + return content.ReadByte() << 16 | content.ReadByte() << 8 | content.ReadByte(); + } + + private void SerializeNumAs4Bytes(Stream output, int num) + { + if (num < 0) + { + throw new ArgumentOutOfRangeException("num", num, "The value cannot be negative."); + } + output.WriteByte((byte)(num >> 24)); + output.WriteByte((byte)(0xFF & (num >> 16))); + output.WriteByte((byte)(0xFF & (num >> 8))); + output.WriteByte((byte)(0xFF & num)); + } + + private int DeserializeNumFrom4Bytes(Stream content) + { + return content.ReadByte() << 24 | content.ReadByte() << 16 | content.ReadByte() << 8 | content.ReadByte(); + } + + // Keys are stored in their utf-8 encoded state. + // This saves us from de-serializing and re-serializing every key on every request. + private class EncodedKey + { + private string _keyString; + private int? _hashCode; + + internal EncodedKey(string key) + { + _keyString = key; + KeyBytes = Encoding.UTF8.GetBytes(key); + } + + public EncodedKey(byte[] key) + { + KeyBytes = key; + } + + internal string KeyString + { + get + { + if (_keyString == null) + { + _keyString = Encoding.UTF8.GetString(KeyBytes, 0, KeyBytes.Length); + } + return _keyString; + } + } + + internal byte[] KeyBytes { get; private set; } + + public override bool Equals(object obj) + { + var otherKey = obj as EncodedKey; + if (otherKey == null) + { + return false; + } + if (KeyBytes.Length != otherKey.KeyBytes.Length) + { + return false; + } + if (_hashCode.HasValue && otherKey._hashCode.HasValue + && _hashCode.Value != otherKey._hashCode.Value) + { + return false; + } + for (int i = 0; i < KeyBytes.Length; i++) + { + if (KeyBytes[i] != otherKey.KeyBytes[i]) + { + return false; + } + } + return true; + } + + public override int GetHashCode() + { + if (!_hashCode.HasValue) + { + _hashCode = SipHash.GetHashCode(KeyBytes); + } + return _hashCode.Value; + } + + public override string ToString() + { + return KeyString; + } + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs new file mode 100644 index 0000000000..91b087a943 --- /dev/null +++ b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs @@ -0,0 +1,40 @@ +// 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 Microsoft.AspNet.Http.Interfaces; +using Microsoft.Framework.Cache.Distributed; +using Microsoft.Framework.Logging; + +namespace Microsoft.AspNet.Session +{ + public class DistributedSessionStore : ISessionStore + { + private readonly IDistributedCache _cache; + private readonly ILoggerFactory _loggerFactory; + + public DistributedSessionStore([NotNull] IDistributedCache cache, [NotNull] ILoggerFactory loggerFactory) + { + _cache = cache; + _loggerFactory = loggerFactory; + } + + public bool IsAvailable + { + get + { + return true; // TODO: + } + } + + public void Connect() + { + _cache.Connect(); + } + + public ISession Create([NotNull] string sessionId, TimeSpan idleTimeout, [NotNull] Func tryEstablishSession, bool isNewSessionKey) + { + return new DistributedSession(_cache, sessionId, idleTimeout, tryEstablishSession, _loggerFactory, isNewSessionKey); + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/ISessionStore.cs b/src/Microsoft.AspNet.Session/ISessionStore.cs new file mode 100644 index 0000000000..81cea1c04a --- /dev/null +++ b/src/Microsoft.AspNet.Session/ISessionStore.cs @@ -0,0 +1,15 @@ +// 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 Microsoft.AspNet.Http.Interfaces; + +namespace Microsoft.AspNet.Session +{ + public interface ISessionStore + { + bool IsAvailable { get; } + void Connect(); + ISession Create(string sessionId, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey); + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.kproj b/src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.kproj new file mode 100644 index 0000000000..11c899ba40 --- /dev/null +++ b/src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.kproj @@ -0,0 +1,17 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 71802736-f640-4733-9671-02d267edd76a + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ + + + 2.0 + + + diff --git a/src/Microsoft.AspNet.Session/NotNullAttribute.cs b/src/Microsoft.AspNet.Session/NotNullAttribute.cs new file mode 100644 index 0000000000..a649da0de4 --- /dev/null +++ b/src/Microsoft.AspNet.Session/NotNullAttribute.cs @@ -0,0 +1,12 @@ +// 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; + +namespace Microsoft.AspNet.Session +{ + [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)] + internal sealed class NotNullAttribute : Attribute + { + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionDefaults.cs b/src/Microsoft.AspNet.Session/SessionDefaults.cs new file mode 100644 index 0000000000..9f06ced3f4 --- /dev/null +++ b/src/Microsoft.AspNet.Session/SessionDefaults.cs @@ -0,0 +1,12 @@ +// 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; + +namespace Microsoft.AspNet.Session +{ + public static class SessionDefaults + { + public static string CookieName = ".AspNet.Session"; + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionFactory.cs b/src/Microsoft.AspNet.Session/SessionFactory.cs new file mode 100644 index 0000000000..3b9e6cc0ac --- /dev/null +++ b/src/Microsoft.AspNet.Session/SessionFactory.cs @@ -0,0 +1,36 @@ +// 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 Microsoft.AspNet.Http.Interfaces; + +namespace Microsoft.AspNet.Session +{ + public class SessionFactory : ISessionFactory + { + private readonly string _sessionKey; + private readonly ISessionStore _store; + private readonly TimeSpan _idleTimeout; + private readonly Func _tryEstablishSession; + private readonly bool _isNewSessionKey; + + public SessionFactory([NotNull] string sessionKey, [NotNull] ISessionStore store, TimeSpan idleTimeout, [NotNull] Func tryEstablishSession, bool isNewSessionKey) + { + _sessionKey = sessionKey; + _store = store; + _idleTimeout = idleTimeout; + _tryEstablishSession = tryEstablishSession; + _isNewSessionKey = isNewSessionKey; + } + + public bool IsAvailable + { + get { return _store.IsAvailable; } + } + + public ISession Create() + { + return _store.Create(_sessionKey, _idleTimeout, _tryEstablishSession, _isNewSessionKey); + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionFeature.cs b/src/Microsoft.AspNet.Session/SessionFeature.cs new file mode 100644 index 0000000000..3b78efb514 --- /dev/null +++ b/src/Microsoft.AspNet.Session/SessionFeature.cs @@ -0,0 +1,14 @@ +// 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 Microsoft.AspNet.Http.Interfaces; + +namespace Microsoft.AspNet.Session +{ + public class SessionFeature : ISessionFeature + { + public ISessionFactory Factory { get; set; } + + public ISession Session { get; set; } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs new file mode 100644 index 0000000000..47ae9793f9 --- /dev/null +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -0,0 +1,155 @@ +// 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.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Threading.Tasks; +using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Interfaces; +using Microsoft.Framework.Logging; +using Microsoft.Framework.OptionsModel; + +namespace Microsoft.AspNet.Session +{ + public class SessionMiddleware + { + private static readonly RandomNumberGenerator CryptoRandom = RandomNumberGenerator.Create(); + private const int SessionKeyLength = 36; // "382c74c3-721d-4f34-80e5-57657b6cbc27" + private static readonly Func ReturnTrue = () => true; + private readonly RequestDelegate _next; + private readonly SessionOptions _options; + private readonly ILogger _logger; + + public SessionMiddleware( + [NotNull] RequestDelegate next, + [NotNull] ILoggerFactory loggerFactory, + [NotNull] IEnumerable sessionStore, + [NotNull] IOptions options, + [NotNull] ConfigureOptions configureOptions) + { + _next = next; + _logger = loggerFactory.Create(); + if (configureOptions != null) + { + _options = options.GetNamedOptions(configureOptions.Name); + configureOptions.Configure(_options); + } + else + { + _options = options.Options; + } + + if (_options.Store == null) + { + _options.Store = sessionStore.FirstOrDefault(); + if (_options.Store == null) + { + throw new ArgumentException("ISessionStore must be specified."); + } + } + + _options.Store.Connect(); + } + + public async Task Invoke(HttpContext context) + { + var isNewSessionKey = false; + Func tryEstablishSession = ReturnTrue; + var sessionKey = context.Request.Cookies.Get(_options.CookieName); + if (string.IsNullOrWhiteSpace(sessionKey) || sessionKey.Length != SessionKeyLength) + { + // No valid cookie, new session. + var guidBytes = new byte[16]; + CryptoRandom.GetBytes(guidBytes); + sessionKey = new Guid(guidBytes).ToString(); + var establisher = new SessionEstablisher(context, sessionKey, _options); + tryEstablishSession = establisher.TryEstablishSession; + isNewSessionKey = true; + } + + var feature = new SessionFeature(); + feature.Factory = new SessionFactory(sessionKey, _options.Store, _options.IdleTimeout, tryEstablishSession, isNewSessionKey); + feature.Session = feature.Factory.Create(); + context.SetFeature(feature); + + try + { + await _next(context); + } + finally + { + context.SetFeature(null); + + if (feature.Session != null) + { + try + { + feature.Session.Commit(); + } + catch (Exception ex) + { + _logger.WriteError("Error closing the session.", ex); + } + } + } + } + + private class SessionEstablisher + { + private readonly HttpContext _context; + private readonly string _sessionKey; + private readonly SessionOptions _options; + private bool _shouldEstablishSession; + + public SessionEstablisher(HttpContext context, string sessionKey, SessionOptions options) + { + _context = context; + _sessionKey = sessionKey; + _options = options; + context.Response.OnSendingHeaders(OnSendingHeadersCallback, state: this); + } + + private static void OnSendingHeadersCallback(object state) + { + var establisher = (SessionEstablisher)state; + if (establisher._shouldEstablishSession) + { + establisher.SetCookie(); + } + } + + private void SetCookie() + { + var cookieOptions = new CookieOptions + { + Domain = _options.CookieDomain, + HttpOnly = _options.CookieHttpOnly, + Path = _options.CookiePath ?? "/", + }; + + _context.Response.Cookies.Append(_options.CookieName, _sessionKey, cookieOptions); + + _context.Response.Headers.Set( + "Cache-Control", + "no-cache"); + + _context.Response.Headers.Set( + "Pragma", + "no-cache"); + + _context.Response.Headers.Set( + "Expires", + "-1"); + } + + // Returns true if the session has already been established, or if it still can be because the response has not been sent. + internal bool TryEstablishSession() + { + return (_shouldEstablishSession |= !_context.Response.HeadersSent); + } + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs new file mode 100644 index 0000000000..beb54727a1 --- /dev/null +++ b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs @@ -0,0 +1,49 @@ +// 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 Microsoft.AspNet.Session; +using Microsoft.Framework.Cache.Distributed; +using Microsoft.Framework.Cache.Memory; +using Microsoft.Framework.DependencyInjection; +using Microsoft.Framework.Logging; +using Microsoft.Framework.OptionsModel; + +namespace Microsoft.AspNet.Builder +{ + public static class SessionMiddlewareExtensions + { + public static IServiceCollection ConfigureSession([NotNull] this IServiceCollection services, [NotNull] Action configure) + { + return services.ConfigureOptions(configure); + } + + public static IApplicationBuilder UseInMemorySession([NotNull] this IApplicationBuilder app, IMemoryCache cache = null, Action configure = null) + { + return app.UseDistributedSession(new LocalCache(cache ?? new MemoryCache(new MemoryCacheOptions())), configure); + } + + public static IApplicationBuilder UseDistributedSession([NotNull] this IApplicationBuilder app, + IDistributedCache cache, Action configure = null) + { + var loggerFactory = app.ApplicationServices.GetRequiredService(); + return app.UseSession(options => + { + options.Store = new DistributedSessionStore(cache, loggerFactory); + if (configure != null) + { + configure(options); + } + }); + } + + public static IApplicationBuilder UseSession([NotNull] this IApplicationBuilder app, Action configure = null) + { + return app.UseMiddleware( + new ConfigureOptions(configure ?? (o => { })) + { + Name = string.Empty + }); + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionOptions.cs b/src/Microsoft.AspNet.Session/SessionOptions.cs new file mode 100644 index 0000000000..30c5948ed7 --- /dev/null +++ b/src/Microsoft.AspNet.Session/SessionOptions.cs @@ -0,0 +1,43 @@ +// 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; + +namespace Microsoft.AspNet.Session +{ + public class SessionOptions + { + /// + /// Determines the cookie name used to persist the session ID. The default value is ".AspNet.Session". + /// + public string CookieName { get; set; } = SessionDefaults.CookieName; + + /// + /// Determines the domain used to create the cookie. Is not provided by default. + /// + public string CookieDomain { get; set; } + + /// + /// Determines the path used to create the cookie. The default value is "/" for highest browser compatibility. + /// + public string CookiePath { get; set; } = "/"; + + /// + /// Determines if the browser should allow the cookie to be accessed by client-side JavaScript. The + /// default is true, which means the cookie will only be passed to HTTP requests and is not made available + /// to script on the page. + /// + public bool CookieHttpOnly { get; set; } = true; + + /// + /// The IdleTimeout indicates how long the session can be idle before its contents are abandoned. Each session access + /// resets the timeout. Note this only applies to the content of the session, not the cookie. + /// + public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromMinutes(20); + + /// + /// Gets or sets the session storage manager. This overrides any session store passed into the middleware constructor. + /// + public ISessionStore Store { get; set; } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SipHash.cs b/src/Microsoft.AspNet.Session/SipHash.cs new file mode 100644 index 0000000000..faadd44185 --- /dev/null +++ b/src/Microsoft.AspNet.Session/SipHash.cs @@ -0,0 +1,204 @@ +// 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; + +namespace Microsoft.AspNet.Session +{ + // A byte[] equality comparer based on the SipHash-2-4 algorithm. Key differences: + // (a) we output 32-bit hashes instead of 64-bit hashes, and + // (b) we don't care about endianness since hashes are used only in hash tables + // and aren't returned to user code. + // + // Derived from the implementation in SignalR and modified to address byte[] instead of string. This derived version is not for cryptographic use, just hash codes. + // https://github.com/aspnet/SignalR-Server/blob/75f74169c81a51780f195d06b798302b2d76dbde/src/Microsoft.AspNet.SignalR.Server/Infrastructure/SipHashBasedStringEqualityComparer.cs + // Derivative work of https://github.com/tanglebones/ch-siphash. + internal static class SipHash + { + internal static int GetHashCode(byte[] bytes) + { + // Assume SipHash-2-4 is a strong PRF, therefore truncation to 32 bits is acceptable. + return (int)SipHash_2_4_UlongCast_ForcedInline(bytes); + } + + private static ulong SipHash_2_4_UlongCast_ForcedInline(byte[] bytes) + { + unsafe + { + ulong v0 = 0x736f6d6570736575; + ulong v1 = 0x646f72616e646f6d; + ulong v2 = 0x6c7967656e657261; + ulong v3 = 0x7465646279746573; + + uint inlen = (uint)bytes.Length; + fixed (byte* finb = bytes) + { + var b = ((ulong)inlen) << 56; + + if (inlen > 0) + { + var inb = finb; + var left = inlen & 7; + var end = inb + inlen - left; + var linb = (ulong*)finb; + var lend = (ulong*)end; + for (; linb < lend; ++linb) + { + v3 ^= *linb; + + v0 += v1; + v1 = (v1 << 13) | (v1 >> (64 - 13)); + v1 ^= v0; + v0 = (v0 << 32) | (v0 >> (64 - 32)); + + v2 += v3; + v3 = (v3 << 16) | (v3 >> (64 - 16)); + v3 ^= v2; + + v0 += v3; + v3 = (v3 << 21) | (v3 >> (64 - 21)); + v3 ^= v0; + + v2 += v1; + v1 = (v1 << 17) | (v1 >> (64 - 17)); + v1 ^= v2; + v2 = (v2 << 32) | (v2 >> (64 - 32)); + v0 += v1; + v1 = (v1 << 13) | (v1 >> (64 - 13)); + v1 ^= v0; + v0 = (v0 << 32) | (v0 >> (64 - 32)); + + v2 += v3; + v3 = (v3 << 16) | (v3 >> (64 - 16)); + v3 ^= v2; + + v0 += v3; + v3 = (v3 << 21) | (v3 >> (64 - 21)); + v3 ^= v0; + + v2 += v1; + v1 = (v1 << 17) | (v1 >> (64 - 17)); + v1 ^= v2; + v2 = (v2 << 32) | (v2 >> (64 - 32)); + + v0 ^= *linb; + } + for (var i = 0; i < left; ++i) + { + b |= ((ulong)end[i]) << (8 * i); + } + } + + v3 ^= b; + v0 += v1; + v1 = (v1 << 13) | (v1 >> (64 - 13)); + v1 ^= v0; + v0 = (v0 << 32) | (v0 >> (64 - 32)); + + v2 += v3; + v3 = (v3 << 16) | (v3 >> (64 - 16)); + v3 ^= v2; + + v0 += v3; + v3 = (v3 << 21) | (v3 >> (64 - 21)); + v3 ^= v0; + + v2 += v1; + v1 = (v1 << 17) | (v1 >> (64 - 17)); + v1 ^= v2; + v2 = (v2 << 32) | (v2 >> (64 - 32)); + v0 += v1; + v1 = (v1 << 13) | (v1 >> (64 - 13)); + v1 ^= v0; + v0 = (v0 << 32) | (v0 >> (64 - 32)); + + v2 += v3; + v3 = (v3 << 16) | (v3 >> (64 - 16)); + v3 ^= v2; + + v0 += v3; + v3 = (v3 << 21) | (v3 >> (64 - 21)); + v3 ^= v0; + + v2 += v1; + v1 = (v1 << 17) | (v1 >> (64 - 17)); + v1 ^= v2; + v2 = (v2 << 32) | (v2 >> (64 - 32)); + v0 ^= b; + v2 ^= 0xff; + + v0 += v1; + v1 = (v1 << 13) | (v1 >> (64 - 13)); + v1 ^= v0; + v0 = (v0 << 32) | (v0 >> (64 - 32)); + + v2 += v3; + v3 = (v3 << 16) | (v3 >> (64 - 16)); + v3 ^= v2; + + v0 += v3; + v3 = (v3 << 21) | (v3 >> (64 - 21)); + v3 ^= v0; + + v2 += v1; + v1 = (v1 << 17) | (v1 >> (64 - 17)); + v1 ^= v2; + v2 = (v2 << 32) | (v2 >> (64 - 32)); + v0 += v1; + v1 = (v1 << 13) | (v1 >> (64 - 13)); + v1 ^= v0; + v0 = (v0 << 32) | (v0 >> (64 - 32)); + + v2 += v3; + v3 = (v3 << 16) | (v3 >> (64 - 16)); + v3 ^= v2; + + v0 += v3; + v3 = (v3 << 21) | (v3 >> (64 - 21)); + v3 ^= v0; + + v2 += v1; + v1 = (v1 << 17) | (v1 >> (64 - 17)); + v1 ^= v2; + v2 = (v2 << 32) | (v2 >> (64 - 32)); + v0 += v1; + v1 = (v1 << 13) | (v1 >> (64 - 13)); + v1 ^= v0; + v0 = (v0 << 32) | (v0 >> (64 - 32)); + + v2 += v3; + v3 = (v3 << 16) | (v3 >> (64 - 16)); + v3 ^= v2; + + v0 += v3; + v3 = (v3 << 21) | (v3 >> (64 - 21)); + v3 ^= v0; + + v2 += v1; + v1 = (v1 << 17) | (v1 >> (64 - 17)); + v1 ^= v2; + v2 = (v2 << 32) | (v2 >> (64 - 32)); + v0 += v1; + v1 = (v1 << 13) | (v1 >> (64 - 13)); + v1 ^= v0; + v0 = (v0 << 32) | (v0 >> (64 - 32)); + + v2 += v3; + v3 = (v3 << 16) | (v3 >> (64 - 16)); + v3 ^= v2; + + v0 += v3; + v3 = (v3 << 21) | (v3 >> (64 - 21)); + v3 ^= v0; + + v2 += v1; + v1 = (v1 << 17) | (v1 >> (64 - 17)); + v1 ^= v2; + v2 = (v2 << 32) | (v2 >> (64 - 32)); + } + + return v0 ^ v1 ^ v2 ^ v3; + } + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json new file mode 100644 index 0000000000..ef37046585 --- /dev/null +++ b/src/Microsoft.AspNet.Session/project.json @@ -0,0 +1,21 @@ +{ + "version": "1.0.0-*", + "description": "ASP.NET 5 session state middleware.", + "dependencies": { + "Microsoft.AspNet.Http.Extensions": "1.0.0-*", + "Microsoft.AspNet.Http.Interfaces": "1.0.0-*", + "Microsoft.Framework.Cache.Distributed": "1.0.0-*", + "Microsoft.Framework.Logging": "1.0.0-*" + }, + "compilationOptions": { + "allowUnsafe": true + }, + "frameworks": { + "aspnet50": { }, + "aspnetcore50": { + "dependencies": { + "System.Security.Cryptography.RandomNumberGenerator": "4.0.0-beta-*" + } + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.kproj b/test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.kproj new file mode 100644 index 0000000000..9c13767321 --- /dev/null +++ b/test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.kproj @@ -0,0 +1,17 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 8c131a0a-bc1a-4cf3-8b77-8813fbfe5639 + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ + + + 2.0 + + + diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs new file mode 100644 index 0000000000..8b2108762c --- /dev/null +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -0,0 +1,266 @@ +// 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.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Http; +using Microsoft.AspNet.TestHost; +using Microsoft.Framework.DependencyInjection; +using Microsoft.Framework.Logging; +using Xunit; + +namespace Microsoft.AspNet.Session +{ + public class SessionTests + { + [Fact] + public async Task ReadingEmptySessionDoesNotCreateCookie() + { + using (var server = TestServer.Create(app => + { + app.UseServices(services => services.AddOptions()); + app.UseInMemorySession(); + app.Run(context => + { + Assert.Null(context.Session.GetString("NotFound")); + return Task.FromResult(0); + }); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync("/"); + response.EnsureSuccessStatusCode(); + IEnumerable values; + Assert.False(response.Headers.TryGetValues("Set-Cookie", out values)); + } + } + + [Fact] + public async Task SettingAValueCausesTheCookieToBeCreated() + { + using (var server = TestServer.Create(app => + { + app.UseServices(services => services.AddOptions()); + app.UseInMemorySession(); + app.Run(context => + { + Assert.Null(context.Session.GetString("Key")); + context.Session.SetString("Key", "Value"); + Assert.Equal("Value", context.Session.GetString("Key")); + return Task.FromResult(0); + }); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync("/"); + response.EnsureSuccessStatusCode(); + IEnumerable values; + Assert.True(response.Headers.TryGetValues("Set-Cookie", out values)); + Assert.Equal(1, values.Count()); + Assert.True(!string.IsNullOrWhiteSpace(values.First())); + } + } + + [Fact] + public async Task SessionCanBeAccessedOnTheNextRequest() + { + using (var server = TestServer.Create(app => + { + app.UseServices(services => services.AddOptions()); + app.UseInMemorySession(); + app.Run(context => + { + int? value = context.Session.GetInt("Key"); + if (context.Request.Path == new PathString("/first")) + { + Assert.False(value.HasValue); + value = 0; + } + Assert.True(value.HasValue); + context.Session.SetInt("Key", value.Value + 1); + return context.Response.WriteAsync(value.Value.ToString()); + }); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync("/first"); + response.EnsureSuccessStatusCode(); + Assert.Equal("0", await response.Content.ReadAsStringAsync()); + + client = server.CreateClient(); + client.DefaultRequestHeaders.Add("Cookie", response.Headers.GetValues("Set-Cookie")); + Assert.Equal("1", await client.GetStringAsync("/")); + Assert.Equal("2", await client.GetStringAsync("/")); + Assert.Equal("3", await client.GetStringAsync("/")); + } + } + + [Fact] + public async Task RemovedItemCannotBeAccessedAgain() + { + using (var server = TestServer.Create(app => + { + app.UseServices(services => services.AddOptions()); + app.UseInMemorySession(); + app.Run(context => + { + int? value = context.Session.GetInt("Key"); + if (context.Request.Path == new PathString("/first")) + { + Assert.False(value.HasValue); + value = 0; + context.Session.SetInt("Key", 1); + } + else if (context.Request.Path == new PathString("/second")) + { + Assert.True(value.HasValue); + Assert.Equal(1, value); + context.Session.Remove("Key"); + } + else if (context.Request.Path == new PathString("/third")) + { + Assert.False(value.HasValue); + value = 2; + } + return context.Response.WriteAsync(value.Value.ToString()); + }); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync("/first"); + response.EnsureSuccessStatusCode(); + Assert.Equal("0", await response.Content.ReadAsStringAsync()); + + client = server.CreateClient(); + client.DefaultRequestHeaders.Add("Cookie", response.Headers.GetValues("Set-Cookie")); + Assert.Equal("1", await client.GetStringAsync("/second")); + Assert.Equal("2", await client.GetStringAsync("/third")); + } + } + + [Fact] + public async Task ClearedItemsCannotBeAccessedAgain() + { + using (var server = TestServer.Create(app => + { + app.UseServices(services => services.AddOptions()); + app.UseInMemorySession(); + app.Run(context => + { + int? value = context.Session.GetInt("Key"); + if (context.Request.Path == new PathString("/first")) + { + Assert.False(value.HasValue); + value = 0; + context.Session.SetInt("Key", 1); + } + else if (context.Request.Path == new PathString("/second")) + { + Assert.True(value.HasValue); + Assert.Equal(1, value); + context.Session.Clear(); + } + else if (context.Request.Path == new PathString("/third")) + { + Assert.False(value.HasValue); + value = 2; + } + return context.Response.WriteAsync(value.Value.ToString()); + }); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync("/first"); + response.EnsureSuccessStatusCode(); + Assert.Equal("0", await response.Content.ReadAsStringAsync()); + + client = server.CreateClient(); + client.DefaultRequestHeaders.Add("Cookie", response.Headers.GetValues("Set-Cookie")); + Assert.Equal("1", await client.GetStringAsync("/second")); + Assert.Equal("2", await client.GetStringAsync("/third")); + } + } + + [Fact] + public async Task SessionStart_LogsInformation() + { + var sink = new TestSink(); + var loggerFactory = new TestLoggerFactory(sink, enabled: true); + using (var server = TestServer.Create(app => + { + app.UseServices(services => + { + services.AddOptions(); + services.AddInstance(typeof(ILoggerFactory), loggerFactory); + }); + app.UseInMemorySession(); + app.Run(context => + { + context.Session.SetString("Key", "Value"); + return Task.FromResult(0); + }); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync("/"); + response.EnsureSuccessStatusCode(); + Assert.Single(sink.Writes); + Assert.True(((ILoggerStructure)sink.Writes[0].State).Format().Contains("started")); + Assert.Equal(LogLevel.Information, sink.Writes[0].LogLevel); + } + } + + [Fact] + public async Task ExpiredSession_LogsWarning() + { + var sink = new TestSink(); + var loggerFactory = new TestLoggerFactory(sink, enabled: true); + using (var server = TestServer.Create(app => + { + app.UseServices(services => + { + services.AddOptions(); + services.AddInstance(typeof(ILoggerFactory), loggerFactory); + }); + app.UseInMemorySession(configure: o => { + o.IdleTimeout = TimeSpan.FromMilliseconds(30); + }); + app.Run(context => + { + int? value = context.Session.GetInt("Key"); + if (context.Request.Path == new PathString("/first")) + { + Assert.False(value.HasValue); + value = 1; + context.Session.SetInt("Key", 1); + } + else if (context.Request.Path == new PathString("/second")) + { + Assert.False(value.HasValue); + value = 2; + } + return context.Response.WriteAsync(value.Value.ToString()); + }); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync("/first"); + response.EnsureSuccessStatusCode(); + + client = server.CreateClient(); + client.DefaultRequestHeaders.Add("Cookie", response.Headers.GetValues("Set-Cookie")); + Thread.Sleep(50); + Assert.Equal("2", await client.GetStringAsync("/second")); + Assert.Equal(2, sink.Writes.Count); + Assert.True(((ILoggerStructure)sink.Writes[0].State).Format().Contains("started")); + Assert.True(((ILoggerStructure)sink.Writes[1].State).Format().Contains("expired")); + Assert.Equal(LogLevel.Information, sink.Writes[0].LogLevel); + Assert.Equal(LogLevel.Warning, sink.Writes[1].LogLevel); + } + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json new file mode 100644 index 0000000000..73b265653c --- /dev/null +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -0,0 +1,14 @@ +{ + "dependencies": { + "Microsoft.AspNet.Session": "1.0.0-*", + "Microsoft.AspNet.RequestContainer": "1.0.0-*", + "Microsoft.AspNet.TestHost": "1.0.0-*", + "xunit.runner.kre": "1.0.0-*" + }, + "commands": { + "test": "xunit.runner.kre" + }, + "frameworks": { + "aspnet50": {} + } +} \ No newline at end of file From 8f1ab39f6c011052fb61d99ee5cb92730b9fa11d Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Tue, 24 Feb 2015 14:30:13 -0800 Subject: [PATCH 003/295] Added Microsoft.AspNet.Testing.Logging to test project. - Reacting to Logging changes and corresponding Testing changes. --- test/Microsoft.AspNet.Session.Tests/SessionTests.cs | 1 + test/Microsoft.AspNet.Session.Tests/project.json | 1 + 2 files changed, 2 insertions(+) diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 8b2108762c..803008ccf6 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.AspNet.TestHost; +using Microsoft.AspNet.Testing.Logging; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; using Xunit; diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json index 73b265653c..07c410374a 100644 --- a/test/Microsoft.AspNet.Session.Tests/project.json +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -3,6 +3,7 @@ "Microsoft.AspNet.Session": "1.0.0-*", "Microsoft.AspNet.RequestContainer": "1.0.0-*", "Microsoft.AspNet.TestHost": "1.0.0-*", + "Microsoft.AspNet.Testing.Logging": "1.0.0-*", "xunit.runner.kre": "1.0.0-*" }, "commands": { From 653cb005cbea03fed40c0be10d894c693426cd17 Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Sat, 28 Feb 2015 10:35:35 -0800 Subject: [PATCH 004/295] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c3a8d80720..a59b2e1fe0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -Caching +Session ================ -Contains libraries for caching for ASP.NET 5. +Contains libraries for session state middleware for ASP.NET 5. This project is part of ASP.NET 5. You can find samples, documentation and getting started instructions for ASP.NET 5 at the [Home](https://github.com/aspnet/home) repo. From 4a373591741717d8edd3c07495f959a3c1d3cb20 Mon Sep 17 00:00:00 2001 From: Brennan Date: Wed, 4 Mar 2015 20:28:47 -0800 Subject: [PATCH 005/295] Logging API changes --- src/Microsoft.AspNet.Session/DistributedSession.cs | 6 +++--- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 4 ++-- test/Microsoft.AspNet.Session.Tests/SessionTests.cs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index f413245e14..b08d09b6f9 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Session _idleTimeout = idleTimeout; _tryEstablishSession = tryEstablishSession; _store = new Dictionary(); - _logger = loggerFactory.Create(); + _logger = loggerFactory.CreateLogger(); _isNewSessionKey = isNewSessionKey; } @@ -103,7 +103,7 @@ namespace Microsoft.AspNet.Session } else if (!_isNewSessionKey) { - _logger.WriteWarning("Accessing expired session {0}", _sessionId); + _logger.LogWarning("Accessing expired session {0}", _sessionId); } _loaded = true; } @@ -116,7 +116,7 @@ namespace Microsoft.AspNet.Session Stream data; if (_logger.IsEnabled(LogLevel.Information) && !_cache.TryGetValue(_sessionId, out data)) { - _logger.WriteInformation("Session {0} started", _sessionId); + _logger.LogInformation("Session {0} started", _sessionId); } _isModified = false; _cache.Set(_sessionId, context => { diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 47ae9793f9..11c250cb7b 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Session [NotNull] ConfigureOptions configureOptions) { _next = next; - _logger = loggerFactory.Create(); + _logger = loggerFactory.CreateLogger(); if (configureOptions != null) { _options = options.GetNamedOptions(configureOptions.Name); @@ -91,7 +91,7 @@ namespace Microsoft.AspNet.Session } catch (Exception ex) { - _logger.WriteError("Error closing the session.", ex); + _logger.LogError("Error closing the session.", ex); } } } diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 803008ccf6..21440052f2 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -210,7 +210,7 @@ namespace Microsoft.AspNet.Session var response = await client.GetAsync("/"); response.EnsureSuccessStatusCode(); Assert.Single(sink.Writes); - Assert.True(((ILoggerStructure)sink.Writes[0].State).Format().Contains("started")); + Assert.True(((ILogValues)sink.Writes[0].State).Format().Contains("started")); Assert.Equal(LogLevel.Information, sink.Writes[0].LogLevel); } } @@ -257,8 +257,8 @@ namespace Microsoft.AspNet.Session Thread.Sleep(50); Assert.Equal("2", await client.GetStringAsync("/second")); Assert.Equal(2, sink.Writes.Count); - Assert.True(((ILoggerStructure)sink.Writes[0].State).Format().Contains("started")); - Assert.True(((ILoggerStructure)sink.Writes[1].State).Format().Contains("expired")); + Assert.True(((ILogValues)sink.Writes[0].State).Format().Contains("started")); + Assert.True(((ILogValues)sink.Writes[1].State).Format().Contains("expired")); Assert.Equal(LogLevel.Information, sink.Writes[0].LogLevel); Assert.Equal(LogLevel.Warning, sink.Writes[1].LogLevel); } From 2141edd46b792bd5cabecc824ea1ede311a30115 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Thu, 5 Mar 2015 03:22:04 -0800 Subject: [PATCH 006/295] Fixed up solution and other things - Reduce dependencies --- .gitignore | 4 +- Microsoft.AspNet.Session.sln | 49 ++++++++++++++++++++++- global.json | 2 +- src/Microsoft.AspNet.Session/project.json | 2 +- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 216e8d9c58..6d4976b407 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ nuget.exe *DS_Store *.ncrunchsolution *.*sdf -*.ipch \ No newline at end of file +*.ipch +.vs/ +project.lock.json diff --git a/Microsoft.AspNet.Session.sln b/Microsoft.AspNet.Session.sln index 11c3cf5f62..fae1527176 100644 --- a/Microsoft.AspNet.Session.sln +++ b/Microsoft.AspNet.Session.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.22604.0 +VisualStudioVersion = 14.0.22625.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" EndProject @@ -15,6 +15,25 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{94E8 EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SessionSample", "samples\SessionSample\SessionSample.kproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6CB0FEE3-129E-488A-801A-6DE479AEC416}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + EndProjectSection +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Logging", "..\Logging\src\Microsoft.Framework.Logging\Microsoft.Framework.Logging.kproj", "{19D1B6C5-8A62-4387-8816-C54874D1DF5F}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Logging.Interfaces", "..\Logging\src\Microsoft.Framework.Logging.Interfaces\Microsoft.Framework.Logging.Interfaces.kproj", "{8221FA95-4B1A-44BF-925F-8AC1A317CC7C}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Logging.Console", "..\Logging\src\Microsoft.Framework.Logging.Console\Microsoft.Framework.Logging.Console.kproj", "{75A4DE6D-BBAA-4D59-829D-94009E759A18}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Hosting.Interfaces", "..\Hosting\src\Microsoft.AspNet.Hosting.Interfaces\Microsoft.AspNet.Hosting.Interfaces.kproj", "{BB780FBB-7842-4759-8DE7-96FA2E5571C1}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.RequestContainer", "..\Hosting\src\Microsoft.AspNet.RequestContainer\Microsoft.AspNet.RequestContainer.kproj", "{374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.TestHost", "..\Hosting\src\Microsoft.AspNet.TestHost\Microsoft.AspNet.TestHost.kproj", "{1A415A3F-1081-45DB-809B-EE19CEA02DC0}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Hosting", "..\Hosting\src\Microsoft.AspNet.Hosting\Microsoft.AspNet.Hosting.kproj", "{3944F036-7E75-47E8-AA52-C4B89A64EC3A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +52,34 @@ Global {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.Build.0 = Debug|Any CPU {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.ActiveCfg = Release|Any CPU {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.Build.0 = Release|Any CPU + {19D1B6C5-8A62-4387-8816-C54874D1DF5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19D1B6C5-8A62-4387-8816-C54874D1DF5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19D1B6C5-8A62-4387-8816-C54874D1DF5F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19D1B6C5-8A62-4387-8816-C54874D1DF5F}.Release|Any CPU.Build.0 = Release|Any CPU + {8221FA95-4B1A-44BF-925F-8AC1A317CC7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8221FA95-4B1A-44BF-925F-8AC1A317CC7C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8221FA95-4B1A-44BF-925F-8AC1A317CC7C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8221FA95-4B1A-44BF-925F-8AC1A317CC7C}.Release|Any CPU.Build.0 = Release|Any CPU + {75A4DE6D-BBAA-4D59-829D-94009E759A18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {75A4DE6D-BBAA-4D59-829D-94009E759A18}.Debug|Any CPU.Build.0 = Debug|Any CPU + {75A4DE6D-BBAA-4D59-829D-94009E759A18}.Release|Any CPU.ActiveCfg = Release|Any CPU + {75A4DE6D-BBAA-4D59-829D-94009E759A18}.Release|Any CPU.Build.0 = Release|Any CPU + {BB780FBB-7842-4759-8DE7-96FA2E5571C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB780FBB-7842-4759-8DE7-96FA2E5571C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB780FBB-7842-4759-8DE7-96FA2E5571C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB780FBB-7842-4759-8DE7-96FA2E5571C1}.Release|Any CPU.Build.0 = Release|Any CPU + {374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Debug|Any CPU.Build.0 = Debug|Any CPU + {374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Release|Any CPU.ActiveCfg = Release|Any CPU + {374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Release|Any CPU.Build.0 = Release|Any CPU + {1A415A3F-1081-45DB-809B-EE19CEA02DC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1A415A3F-1081-45DB-809B-EE19CEA02DC0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1A415A3F-1081-45DB-809B-EE19CEA02DC0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1A415A3F-1081-45DB-809B-EE19CEA02DC0}.Release|Any CPU.Build.0 = Release|Any CPU + {3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/global.json b/global.json index 840c36f6ad..ce063d240d 100644 --- a/global.json +++ b/global.json @@ -1,3 +1,3 @@ { - "sources": ["src"] + "sources": [ "src" ] } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index ef37046585..a25ad4f50c 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -5,7 +5,7 @@ "Microsoft.AspNet.Http.Extensions": "1.0.0-*", "Microsoft.AspNet.Http.Interfaces": "1.0.0-*", "Microsoft.Framework.Cache.Distributed": "1.0.0-*", - "Microsoft.Framework.Logging": "1.0.0-*" + "Microsoft.Framework.Logging.Interfaces": "1.0.0-*" }, "compilationOptions": { "allowUnsafe": true From 8e4ea775ac66c5caa9775cc87ea496e85258994f Mon Sep 17 00:00:00 2001 From: David Fowler Date: Thu, 5 Mar 2015 03:30:09 -0800 Subject: [PATCH 007/295] Fixed the solution file --- Microsoft.AspNet.Session.sln | 92 ------------------------------------ Session.sln | 50 ++++++++++++++++++++ 2 files changed, 50 insertions(+), 92 deletions(-) delete mode 100644 Microsoft.AspNet.Session.sln create mode 100644 Session.sln diff --git a/Microsoft.AspNet.Session.sln b/Microsoft.AspNet.Session.sln deleted file mode 100644 index fae1527176..0000000000 --- a/Microsoft.AspNet.Session.sln +++ /dev/null @@ -1,92 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.22625.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A189F10C-3A9C-4F81-83D0-32E5FE50DAD8}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session", "src\Microsoft.AspNet.Session\Microsoft.AspNet.Session.kproj", "{71802736-F640-4733-9671-02D267EDD76A}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session.Tests", "test\Microsoft.AspNet.Session.Tests\Microsoft.AspNet.Session.Tests.kproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SessionSample", "samples\SessionSample\SessionSample.kproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6CB0FEE3-129E-488A-801A-6DE479AEC416}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - EndProjectSection -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Logging", "..\Logging\src\Microsoft.Framework.Logging\Microsoft.Framework.Logging.kproj", "{19D1B6C5-8A62-4387-8816-C54874D1DF5F}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Logging.Interfaces", "..\Logging\src\Microsoft.Framework.Logging.Interfaces\Microsoft.Framework.Logging.Interfaces.kproj", "{8221FA95-4B1A-44BF-925F-8AC1A317CC7C}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.Logging.Console", "..\Logging\src\Microsoft.Framework.Logging.Console\Microsoft.Framework.Logging.Console.kproj", "{75A4DE6D-BBAA-4D59-829D-94009E759A18}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Hosting.Interfaces", "..\Hosting\src\Microsoft.AspNet.Hosting.Interfaces\Microsoft.AspNet.Hosting.Interfaces.kproj", "{BB780FBB-7842-4759-8DE7-96FA2E5571C1}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.RequestContainer", "..\Hosting\src\Microsoft.AspNet.RequestContainer\Microsoft.AspNet.RequestContainer.kproj", "{374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.TestHost", "..\Hosting\src\Microsoft.AspNet.TestHost\Microsoft.AspNet.TestHost.kproj", "{1A415A3F-1081-45DB-809B-EE19CEA02DC0}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Hosting", "..\Hosting\src\Microsoft.AspNet.Hosting\Microsoft.AspNet.Hosting.kproj", "{3944F036-7E75-47E8-AA52-C4B89A64EC3A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {71802736-F640-4733-9671-02D267EDD76A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {71802736-F640-4733-9671-02D267EDD76A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {71802736-F640-4733-9671-02D267EDD76A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {71802736-F640-4733-9671-02D267EDD76A}.Release|Any CPU.Build.0 = Release|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Release|Any CPU.Build.0 = Release|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.Build.0 = Release|Any CPU - {19D1B6C5-8A62-4387-8816-C54874D1DF5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19D1B6C5-8A62-4387-8816-C54874D1DF5F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19D1B6C5-8A62-4387-8816-C54874D1DF5F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19D1B6C5-8A62-4387-8816-C54874D1DF5F}.Release|Any CPU.Build.0 = Release|Any CPU - {8221FA95-4B1A-44BF-925F-8AC1A317CC7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8221FA95-4B1A-44BF-925F-8AC1A317CC7C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8221FA95-4B1A-44BF-925F-8AC1A317CC7C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8221FA95-4B1A-44BF-925F-8AC1A317CC7C}.Release|Any CPU.Build.0 = Release|Any CPU - {75A4DE6D-BBAA-4D59-829D-94009E759A18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {75A4DE6D-BBAA-4D59-829D-94009E759A18}.Debug|Any CPU.Build.0 = Debug|Any CPU - {75A4DE6D-BBAA-4D59-829D-94009E759A18}.Release|Any CPU.ActiveCfg = Release|Any CPU - {75A4DE6D-BBAA-4D59-829D-94009E759A18}.Release|Any CPU.Build.0 = Release|Any CPU - {BB780FBB-7842-4759-8DE7-96FA2E5571C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BB780FBB-7842-4759-8DE7-96FA2E5571C1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BB780FBB-7842-4759-8DE7-96FA2E5571C1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BB780FBB-7842-4759-8DE7-96FA2E5571C1}.Release|Any CPU.Build.0 = Release|Any CPU - {374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Debug|Any CPU.Build.0 = Debug|Any CPU - {374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Release|Any CPU.ActiveCfg = Release|Any CPU - {374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Release|Any CPU.Build.0 = Release|Any CPU - {1A415A3F-1081-45DB-809B-EE19CEA02DC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1A415A3F-1081-45DB-809B-EE19CEA02DC0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1A415A3F-1081-45DB-809B-EE19CEA02DC0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1A415A3F-1081-45DB-809B-EE19CEA02DC0}.Release|Any CPU.Build.0 = Release|Any CPU - {3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {71802736-F640-4733-9671-02D267EDD76A} = {A189F10C-3A9C-4F81-83D0-32E5FE50DAD8} - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639} = {E9D63F97-6078-42AD-BFD3-F956BF921BB5} - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365} = {94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE} - EndGlobalSection -EndGlobal diff --git a/Session.sln b/Session.sln new file mode 100644 index 0000000000..4443bee334 --- /dev/null +++ b/Session.sln @@ -0,0 +1,50 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.22625.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A189F10C-3A9C-4F81-83D0-32E5FE50DAD8}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session", "src\Microsoft.AspNet.Session\Microsoft.AspNet.Session.kproj", "{71802736-F640-4733-9671-02D267EDD76A}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session.Tests", "test\Microsoft.AspNet.Session.Tests\Microsoft.AspNet.Session.Tests.kproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SessionSample", "samples\SessionSample\SessionSample.kproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6CB0FEE3-129E-488A-801A-6DE479AEC416}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {71802736-F640-4733-9671-02D267EDD76A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {71802736-F640-4733-9671-02D267EDD76A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {71802736-F640-4733-9671-02D267EDD76A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {71802736-F640-4733-9671-02D267EDD76A}.Release|Any CPU.Build.0 = Release|Any CPU + {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Release|Any CPU.Build.0 = Release|Any CPU + {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {71802736-F640-4733-9671-02D267EDD76A} = {A189F10C-3A9C-4F81-83D0-32E5FE50DAD8} + {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639} = {E9D63F97-6078-42AD-BFD3-F956BF921BB5} + {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365} = {94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE} + EndGlobalSection +EndGlobal From 940a5a0c29f4c8fb24f28d15f1290e56265e4150 Mon Sep 17 00:00:00 2001 From: Praburaj Date: Thu, 5 Mar 2015 17:34:20 -0800 Subject: [PATCH 008/295] Rename Microsoft.AspNet.Http.Interfaces => Microsoft.AspNet.Http --- src/Microsoft.AspNet.Session/DistributedSession.cs | 2 +- src/Microsoft.AspNet.Session/DistributedSessionStore.cs | 2 +- src/Microsoft.AspNet.Session/ISessionStore.cs | 2 +- src/Microsoft.AspNet.Session/SessionFactory.cs | 2 +- src/Microsoft.AspNet.Session/SessionFeature.cs | 2 +- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 1 - 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index b08d09b6f9..0a28c18761 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using Microsoft.AspNet.Http.Interfaces; +using Microsoft.AspNet.Http; using Microsoft.Framework.Cache.Distributed; using Microsoft.Framework.Logging; diff --git a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs index 91b087a943..a401070a8c 100644 --- a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http.Interfaces; +using Microsoft.AspNet.Http; using Microsoft.Framework.Cache.Distributed; using Microsoft.Framework.Logging; diff --git a/src/Microsoft.AspNet.Session/ISessionStore.cs b/src/Microsoft.AspNet.Session/ISessionStore.cs index 81cea1c04a..d1f69c3a6d 100644 --- a/src/Microsoft.AspNet.Session/ISessionStore.cs +++ b/src/Microsoft.AspNet.Session/ISessionStore.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http.Interfaces; +using Microsoft.AspNet.Http; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionFactory.cs b/src/Microsoft.AspNet.Session/SessionFactory.cs index 3b9e6cc0ac..99bd37aaac 100644 --- a/src/Microsoft.AspNet.Session/SessionFactory.cs +++ b/src/Microsoft.AspNet.Session/SessionFactory.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http.Interfaces; +using Microsoft.AspNet.Http; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionFeature.cs b/src/Microsoft.AspNet.Session/SessionFeature.cs index 3b78efb514..63e52087ba 100644 --- a/src/Microsoft.AspNet.Session/SessionFeature.cs +++ b/src/Microsoft.AspNet.Session/SessionFeature.cs @@ -1,7 +1,7 @@ // 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 Microsoft.AspNet.Http.Interfaces; +using Microsoft.AspNet.Http; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 11c250cb7b..616f52fe47 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -8,7 +8,6 @@ using System.Security.Cryptography; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; -using Microsoft.AspNet.Http.Interfaces; using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; From b2f66944da8044fe3d40ea297324f002bdc021b1 Mon Sep 17 00:00:00 2001 From: Brennan Date: Fri, 6 Mar 2015 10:28:20 -0800 Subject: [PATCH 009/295] Logging.Testing and Http.Interfaces change --- src/Microsoft.AspNet.Session/DistributedSession.cs | 2 +- src/Microsoft.AspNet.Session/DistributedSessionStore.cs | 2 +- src/Microsoft.AspNet.Session/ISessionStore.cs | 2 +- src/Microsoft.AspNet.Session/SessionFactory.cs | 2 +- src/Microsoft.AspNet.Session/SessionFeature.cs | 2 +- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 1 - test/Microsoft.AspNet.Session.Tests/SessionTests.cs | 2 +- test/Microsoft.AspNet.Session.Tests/project.json | 2 +- 8 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index b08d09b6f9..0a28c18761 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using Microsoft.AspNet.Http.Interfaces; +using Microsoft.AspNet.Http; using Microsoft.Framework.Cache.Distributed; using Microsoft.Framework.Logging; diff --git a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs index 91b087a943..a401070a8c 100644 --- a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http.Interfaces; +using Microsoft.AspNet.Http; using Microsoft.Framework.Cache.Distributed; using Microsoft.Framework.Logging; diff --git a/src/Microsoft.AspNet.Session/ISessionStore.cs b/src/Microsoft.AspNet.Session/ISessionStore.cs index 81cea1c04a..d1f69c3a6d 100644 --- a/src/Microsoft.AspNet.Session/ISessionStore.cs +++ b/src/Microsoft.AspNet.Session/ISessionStore.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http.Interfaces; +using Microsoft.AspNet.Http; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionFactory.cs b/src/Microsoft.AspNet.Session/SessionFactory.cs index 3b9e6cc0ac..99bd37aaac 100644 --- a/src/Microsoft.AspNet.Session/SessionFactory.cs +++ b/src/Microsoft.AspNet.Session/SessionFactory.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http.Interfaces; +using Microsoft.AspNet.Http; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionFeature.cs b/src/Microsoft.AspNet.Session/SessionFeature.cs index 3b78efb514..63e52087ba 100644 --- a/src/Microsoft.AspNet.Session/SessionFeature.cs +++ b/src/Microsoft.AspNet.Session/SessionFeature.cs @@ -1,7 +1,7 @@ // 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 Microsoft.AspNet.Http.Interfaces; +using Microsoft.AspNet.Http; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 11c250cb7b..616f52fe47 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -8,7 +8,6 @@ using System.Security.Cryptography; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; -using Microsoft.AspNet.Http.Interfaces; using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 21440052f2..bb4d9447da 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.AspNet.TestHost; -using Microsoft.AspNet.Testing.Logging; +using Microsoft.Framework.Logging.Testing; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; using Xunit; diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json index 07c410374a..44053dc03b 100644 --- a/test/Microsoft.AspNet.Session.Tests/project.json +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -3,7 +3,7 @@ "Microsoft.AspNet.Session": "1.0.0-*", "Microsoft.AspNet.RequestContainer": "1.0.0-*", "Microsoft.AspNet.TestHost": "1.0.0-*", - "Microsoft.AspNet.Testing.Logging": "1.0.0-*", + "Microsoft.Framework.Logging.Testing": "1.0.0-*", "xunit.runner.kre": "1.0.0-*" }, "commands": { From c2c2c6b55d502ee541fa28a1d367b77fe6ad7bb4 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Sun, 8 Mar 2015 12:56:25 -0700 Subject: [PATCH 010/295] Update aspnet50/aspnetcore50 => dnx451/dnxcore50. --- samples/SessionSample/project.json | 2 +- src/Microsoft.AspNet.Session/project.json | 8 ++++---- test/Microsoft.AspNet.Session.Tests/project.json | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 4a82a27681..bb1d2639df 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -11,6 +11,6 @@ }, "commands": { "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, "frameworks" : { - "aspnet50" : { } + "dnx451" : { } } } diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index a25ad4f50c..660f7a9578 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -1,4 +1,4 @@ -{ +{ "version": "1.0.0-*", "description": "ASP.NET 5 session state middleware.", "dependencies": { @@ -11,11 +11,11 @@ "allowUnsafe": true }, "frameworks": { - "aspnet50": { }, - "aspnetcore50": { + "dnx451": { }, + "dnxcore50": { "dependencies": { "System.Security.Cryptography.RandomNumberGenerator": "4.0.0-beta-*" } } } -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json index 44053dc03b..85aa60f3ea 100644 --- a/test/Microsoft.AspNet.Session.Tests/project.json +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -1,4 +1,4 @@ -{ +{ "dependencies": { "Microsoft.AspNet.Session": "1.0.0-*", "Microsoft.AspNet.RequestContainer": "1.0.0-*", @@ -10,6 +10,6 @@ "test": "xunit.runner.kre" }, "frameworks": { - "aspnet50": {} + "dnx451": {} } -} \ No newline at end of file +} From 9d97c9b78b80cfeaf287a98cd091fbe2dc021018 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Sun, 8 Mar 2015 12:56:25 -0700 Subject: [PATCH 011/295] Update K_BUILD_VERSION/kre/KRE/.k => DNX_BUILD_VERSION/dnx/DNX/.dnx. --- build.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.cmd b/build.cmd index 86ca5bbbf1..49ba0692de 100644 --- a/build.cmd +++ b/build.cmd @@ -1,4 +1,4 @@ -@echo off +@echo off cd %~dp0 SETLOCAL @@ -19,7 +19,7 @@ IF EXIST packages\KoreBuild goto run .nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre .nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion -IF "%SKIP_KRE_INSTALL%"=="1" goto run +IF "%SKIP_DNX_INSTALL%"=="1" goto run CALL packages\KoreBuild\build\kvm upgrade -runtime CLR -x86 CALL packages\KoreBuild\build\kvm install default -runtime CoreCLR -x86 From 685d5f6b05e750a834ecfe7865810d7aeaceb4a9 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Sun, 8 Mar 2015 12:56:26 -0700 Subject: [PATCH 012/295] Update kvm/KVM/Kvm => dnvm/DNVM/Dnvm. --- build.cmd | 6 +++--- build.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.cmd b/build.cmd index 49ba0692de..77be0a6627 100644 --- a/build.cmd +++ b/build.cmd @@ -20,9 +20,9 @@ IF EXIST packages\KoreBuild goto run .nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion IF "%SKIP_DNX_INSTALL%"=="1" goto run -CALL packages\KoreBuild\build\kvm upgrade -runtime CLR -x86 -CALL packages\KoreBuild\build\kvm install default -runtime CoreCLR -x86 +CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -x86 +CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -x86 :run -CALL packages\KoreBuild\build\kvm use default -runtime CLR -x86 +CALL packages\KoreBuild\build\dnvm use default -runtime CLR -x86 packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* diff --git a/build.sh b/build.sh index c7873ef58e..74cb3421e6 100644 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash if test `uname` = Darwin; then cachedir=~/Library/Caches/KBuild @@ -28,11 +28,11 @@ if test ! -d packages/KoreBuild; then fi if ! type k > /dev/null 2>&1; then - source packages/KoreBuild/build/kvm.sh + source packages/KoreBuild/build/dnvm.sh fi if ! type k > /dev/null 2>&1; then - kvm upgrade + dnvm upgrade fi mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@" From 0d32036cdb4be020b221f0d44436d1ecc4d2d4e1 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Sun, 8 Mar 2015 12:56:26 -0700 Subject: [PATCH 013/295] Update build.sh to use dnvm correctly. --- build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 74cb3421e6..a9ce06d087 100644 --- a/build.sh +++ b/build.sh @@ -27,7 +27,7 @@ if test ! -d packages/KoreBuild; then mono .nuget/nuget.exe install Sake -version 0.2 -o packages -ExcludeVersion fi -if ! type k > /dev/null 2>&1; then +if ! type dnvm > /dev/null 2>&1; then source packages/KoreBuild/build/dnvm.sh fi @@ -36,3 +36,4 @@ if ! type k > /dev/null 2>&1; then fi mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@" + From cc836b7c9b6d69f706eea81d197726d52af51743 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Mon, 9 Mar 2015 12:59:12 -0700 Subject: [PATCH 014/295] Remove BOM from project.json, *.cmd, *.sh and *.shade files. --- build.cmd | 2 +- build.sh | 2 +- samples/SessionSample/project.json | 2 +- src/Microsoft.AspNet.Session/project.json | 2 +- test/Microsoft.AspNet.Session.Tests/project.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.cmd b/build.cmd index 77be0a6627..68a732c182 100644 --- a/build.cmd +++ b/build.cmd @@ -1,4 +1,4 @@ -@echo off +@echo off cd %~dp0 SETLOCAL diff --git a/build.sh b/build.sh index a9ce06d087..ec3263114a 100644 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash if test `uname` = Darwin; then cachedir=~/Library/Caches/KBuild diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index bb1d2639df..8e2ef4cb6a 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -1,4 +1,4 @@ -{ +{ "webroot": "wwwroot", "exclude": "wwwroot/**/*.*", "dependencies": { diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 660f7a9578..0b459ad29c 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -1,4 +1,4 @@ -{ +{ "version": "1.0.0-*", "description": "ASP.NET 5 session state middleware.", "dependencies": { diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json index 85aa60f3ea..9b81df188a 100644 --- a/test/Microsoft.AspNet.Session.Tests/project.json +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -1,4 +1,4 @@ -{ +{ "dependencies": { "Microsoft.AspNet.Session": "1.0.0-*", "Microsoft.AspNet.RequestContainer": "1.0.0-*", From 0a05c3b5a0b7f2506c3f00358cfa9d8e196b91bc Mon Sep 17 00:00:00 2001 From: Praburaj Date: Tue, 10 Mar 2015 11:45:21 -0700 Subject: [PATCH 015/295] Renaming Nuget.org feed key name to Nuget. fixes https://github.com/aspnet/Universe/issues/174 --- NuGet.Config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index f41e9c631d..da57d47267 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -2,6 +2,6 @@ - + - + \ No newline at end of file From a6105d4206e004b0325c57bb21c4ac83e28fbbcf Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Wed, 11 Mar 2015 14:05:07 -0700 Subject: [PATCH 016/295] Update .kproj => .xproj. --- Session.sln | 6 +++--- .../{SessionSample.kproj => SessionSample.xproj} | 0 ....AspNet.Session.kproj => Microsoft.AspNet.Session.xproj} | 0 ...ion.Tests.kproj => Microsoft.AspNet.Session.Tests.xproj} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename samples/SessionSample/{SessionSample.kproj => SessionSample.xproj} (100%) rename src/Microsoft.AspNet.Session/{Microsoft.AspNet.Session.kproj => Microsoft.AspNet.Session.xproj} (100%) rename test/Microsoft.AspNet.Session.Tests/{Microsoft.AspNet.Session.Tests.kproj => Microsoft.AspNet.Session.Tests.xproj} (100%) diff --git a/Session.sln b/Session.sln index 4443bee334..c1c9671948 100644 --- a/Session.sln +++ b/Session.sln @@ -7,13 +7,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A189F10C-3A9C-4F81-83D0-32E5FE50DAD8}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session", "src\Microsoft.AspNet.Session\Microsoft.AspNet.Session.kproj", "{71802736-F640-4733-9671-02D267EDD76A}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session", "src\Microsoft.AspNet.Session\Microsoft.AspNet.Session.xproj", "{71802736-F640-4733-9671-02D267EDD76A}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session.Tests", "test\Microsoft.AspNet.Session.Tests\Microsoft.AspNet.Session.Tests.kproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session.Tests", "test\Microsoft.AspNet.Session.Tests\Microsoft.AspNet.Session.Tests.xproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SessionSample", "samples\SessionSample\SessionSample.kproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SessionSample", "samples\SessionSample\SessionSample.xproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6CB0FEE3-129E-488A-801A-6DE479AEC416}" ProjectSection(SolutionItems) = preProject diff --git a/samples/SessionSample/SessionSample.kproj b/samples/SessionSample/SessionSample.xproj similarity index 100% rename from samples/SessionSample/SessionSample.kproj rename to samples/SessionSample/SessionSample.xproj diff --git a/src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.kproj b/src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.xproj similarity index 100% rename from src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.kproj rename to src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.xproj diff --git a/test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.kproj b/test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.xproj similarity index 100% rename from test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.kproj rename to test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.xproj From a3772cf6d5b54df56bb718d9c5328e16173851ec Mon Sep 17 00:00:00 2001 From: Praburaj Date: Wed, 11 Mar 2015 17:32:09 -0700 Subject: [PATCH 017/295] React to Caching package rename Dependent on https://github.com/aspnet/Caching/pull/49/files --- samples/SessionSample/project.json | 2 +- src/Microsoft.AspNet.Session/DistributedSession.cs | 2 +- src/Microsoft.AspNet.Session/DistributedSessionStore.cs | 2 +- src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs | 4 ++-- src/Microsoft.AspNet.Session/project.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 8e2ef4cb6a..627614ff39 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -6,7 +6,7 @@ "Microsoft.AspNet.Server.IIS": "1.0.0-*", "Microsoft.AspNet.Server.WebListener" : "1.0.0-*", "Microsoft.AspNet.Session": "1.0.0-*", - "Microsoft.Framework.Cache.Redis": "1.0.0-*", + "Microsoft.Framework.Caching.Redis": "1.0.0-*", "Microsoft.Framework.Logging.Console": "1.0.0-*" }, "commands": { "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index 0a28c18761..3f90a832e1 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -7,7 +7,7 @@ using System.IO; using System.Linq; using System.Text; using Microsoft.AspNet.Http; -using Microsoft.Framework.Cache.Distributed; +using Microsoft.Framework.Caching.Distributed; using Microsoft.Framework.Logging; namespace Microsoft.AspNet.Session diff --git a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs index a401070a8c..78d1a3e530 100644 --- a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs @@ -3,7 +3,7 @@ using System; using Microsoft.AspNet.Http; -using Microsoft.Framework.Cache.Distributed; +using Microsoft.Framework.Caching.Distributed; using Microsoft.Framework.Logging; namespace Microsoft.AspNet.Session diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs index beb54727a1..0b28bdb9e5 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs @@ -3,8 +3,8 @@ using System; using Microsoft.AspNet.Session; -using Microsoft.Framework.Cache.Distributed; -using Microsoft.Framework.Cache.Memory; +using Microsoft.Framework.Caching.Distributed; +using Microsoft.Framework.Caching.Memory; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 0b459ad29c..1160ee8438 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -4,7 +4,7 @@ "dependencies": { "Microsoft.AspNet.Http.Extensions": "1.0.0-*", "Microsoft.AspNet.Http.Interfaces": "1.0.0-*", - "Microsoft.Framework.Cache.Distributed": "1.0.0-*", + "Microsoft.Framework.Caching.Distributed": "1.0.0-*", "Microsoft.Framework.Logging.Interfaces": "1.0.0-*" }, "compilationOptions": { From 48f2d14413fbe70ada369134b3057df3dca0b089 Mon Sep 17 00:00:00 2001 From: Praburaj Date: Thu, 12 Mar 2015 16:57:32 -0700 Subject: [PATCH 018/295] React to Caching extension rename --- samples/SessionSample/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 7c8716fff7..5410f886c7 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -16,7 +16,7 @@ namespace SessionSample public void ConfigureServices(IServiceCollection services) { - services.AddCachingServices(); + services.AddCaching(); services.AddSessionServices(); } From 20bcd6346e958ed6f7dbe0761cee35955b69103b Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 12 Mar 2015 17:26:17 -0700 Subject: [PATCH 019/295] Update xunit.runner.kre => xunit.runner.aspnet. --- test/Microsoft.AspNet.Session.Tests/project.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json index 9b81df188a..2636aa9fc3 100644 --- a/test/Microsoft.AspNet.Session.Tests/project.json +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -4,10 +4,10 @@ "Microsoft.AspNet.RequestContainer": "1.0.0-*", "Microsoft.AspNet.TestHost": "1.0.0-*", "Microsoft.Framework.Logging.Testing": "1.0.0-*", - "xunit.runner.kre": "1.0.0-*" + "xunit.runner.aspnet": "2.0.0-aspnet-*" }, "commands": { - "test": "xunit.runner.kre" + "test": "xunit.runner.aspnet" }, "frameworks": { "dnx451": {} From 177d1ffb64485268b708b1eb73aef2b555414a07 Mon Sep 17 00:00:00 2001 From: hishamco Date: Mon, 9 Mar 2015 21:14:43 +0300 Subject: [PATCH 020/295] Adds CookiePath to SessionDefaults Adds CookiePath to SessionDefaults Revert "Adds CookiePath to SessionDefaults" This reverts commit d025a89cbb555b5b92cb5de2dc848da036021301. Remove extra tab Revert "Remove extra tab" This reverts commit 80b1e4976a902a5e507702b1e46e57dec0c72da4. Change tab to spaces Adds CookiePath to SessionDefaults --- src/Microsoft.AspNet.Session/SessionDefaults.cs | 1 + src/Microsoft.AspNet.Session/SessionMiddleware.cs | 2 +- src/Microsoft.AspNet.Session/SessionOptions.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionDefaults.cs b/src/Microsoft.AspNet.Session/SessionDefaults.cs index 9f06ced3f4..7fb15b355f 100644 --- a/src/Microsoft.AspNet.Session/SessionDefaults.cs +++ b/src/Microsoft.AspNet.Session/SessionDefaults.cs @@ -8,5 +8,6 @@ namespace Microsoft.AspNet.Session public static class SessionDefaults { public static string CookieName = ".AspNet.Session"; + public static string CookiePath = "/"; } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 47ae9793f9..aa688113c5 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -127,7 +127,7 @@ namespace Microsoft.AspNet.Session { Domain = _options.CookieDomain, HttpOnly = _options.CookieHttpOnly, - Path = _options.CookiePath ?? "/", + Path = _options.CookiePath ?? SessionDefaults.CookiePath, }; _context.Response.Cookies.Append(_options.CookieName, _sessionKey, cookieOptions); diff --git a/src/Microsoft.AspNet.Session/SessionOptions.cs b/src/Microsoft.AspNet.Session/SessionOptions.cs index 30c5948ed7..345df18d39 100644 --- a/src/Microsoft.AspNet.Session/SessionOptions.cs +++ b/src/Microsoft.AspNet.Session/SessionOptions.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Session /// /// Determines the path used to create the cookie. The default value is "/" for highest browser compatibility. /// - public string CookiePath { get; set; } = "/"; + public string CookiePath { get; set; } = SessionDefaults.CookiePath; /// /// Determines if the browser should allow the cookie to be accessed by client-side JavaScript. The From 6c57ca7c1ed61a34c14003d3382049243e9f9d95 Mon Sep 17 00:00:00 2001 From: Praburaj Date: Thu, 12 Mar 2015 13:21:02 -0700 Subject: [PATCH 021/295] Move IServiceCollection extensions into Microsoft.Framework.DependencyInjection namespace Fixes: https://github.com/aspnet/Session/issues/10 https://github.com/aspnet/Session/issues/8 1. Renaming the class name containing the extension 2. Consolidating the AddSession() and ConfigureSession overloads with same pattern we follow in other repos 3. Rename AddSessionServices() => AddSession() like all other repos --- samples/SessionSample/Startup.cs | 5 ++-- .../CachingServicesExtensions.cs | 15 ---------- .../SessionMiddlewareExtensions.cs | 5 ---- .../SessionServiceCollectionExtensions.cs | 28 +++++++++++++++++++ 4 files changed, 30 insertions(+), 23 deletions(-) delete mode 100644 src/Microsoft.AspNet.Session/CachingServicesExtensions.cs create mode 100644 src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 5410f886c7..17f68de5ce 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -3,7 +3,6 @@ using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; -using Microsoft.Framework.Logging.Console; namespace SessionSample { @@ -17,7 +16,7 @@ namespace SessionSample public void ConfigureServices(IServiceCollection services) { services.AddCaching(); - services.AddSessionServices(); + services.AddSession(); } public void Configure(IApplicationBuilder app) @@ -58,4 +57,4 @@ namespace SessionSample }); } } -} +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/CachingServicesExtensions.cs b/src/Microsoft.AspNet.Session/CachingServicesExtensions.cs deleted file mode 100644 index 69ef155018..0000000000 --- a/src/Microsoft.AspNet.Session/CachingServicesExtensions.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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 Microsoft.AspNet.Session; - -namespace Microsoft.Framework.DependencyInjection -{ - public static class CachingServicesExtensions - { - public static IServiceCollection AddSessionServices(this IServiceCollection collection) - { - return collection.AddTransient(); - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs index 0b28bdb9e5..83585bcb45 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs @@ -13,11 +13,6 @@ namespace Microsoft.AspNet.Builder { public static class SessionMiddlewareExtensions { - public static IServiceCollection ConfigureSession([NotNull] this IServiceCollection services, [NotNull] Action configure) - { - return services.ConfigureOptions(configure); - } - public static IApplicationBuilder UseInMemorySession([NotNull] this IApplicationBuilder app, IMemoryCache cache = null, Action configure = null) { return app.UseDistributedSession(new LocalCache(cache ?? new MemoryCache(new MemoryCacheOptions())), configure); diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs new file mode 100644 index 0000000000..5c9d9bd9ae --- /dev/null +++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs @@ -0,0 +1,28 @@ +// 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 Microsoft.AspNet.Session; + +namespace Microsoft.Framework.DependencyInjection +{ + public static class SessionServiceCollectionExtensions + { + public static IServiceCollection AddSession([NotNull] this IServiceCollection services) + { + return services.AddSession(configure: null); + } + + public static IServiceCollection AddSession([NotNull] this IServiceCollection services, Action configure) + { + services.AddTransient(); + + if (configure != null) + { + services.Configure(configure); + } + + return services; + } + } +} \ No newline at end of file From 4373b6bf62744241210b7500c30c4d6545438596 Mon Sep 17 00:00:00 2001 From: Praburaj Date: Sat, 14 Mar 2015 07:30:29 -0700 Subject: [PATCH 022/295] Using [NotNull] from the common repo package --- src/Microsoft.AspNet.Session/DistributedSession.cs | 1 + .../DistributedSessionStore.cs | 1 + src/Microsoft.AspNet.Session/NotNullAttribute.cs | 12 ------------ src/Microsoft.AspNet.Session/SessionFactory.cs | 1 + src/Microsoft.AspNet.Session/SessionMiddleware.cs | 1 + .../SessionMiddlewareExtensions.cs | 1 + .../SessionServiceCollectionExtensions.cs | 1 + src/Microsoft.AspNet.Session/project.json | 3 ++- 8 files changed, 8 insertions(+), 13 deletions(-) delete mode 100644 src/Microsoft.AspNet.Session/NotNullAttribute.cs diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index 3f90a832e1..bc7393a9ca 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Text; using Microsoft.AspNet.Http; using Microsoft.Framework.Caching.Distributed; +using Microsoft.Framework.Internal; using Microsoft.Framework.Logging; namespace Microsoft.AspNet.Session diff --git a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs index 78d1a3e530..8e0efd6a71 100644 --- a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs @@ -4,6 +4,7 @@ using System; using Microsoft.AspNet.Http; using Microsoft.Framework.Caching.Distributed; +using Microsoft.Framework.Internal; using Microsoft.Framework.Logging; namespace Microsoft.AspNet.Session diff --git a/src/Microsoft.AspNet.Session/NotNullAttribute.cs b/src/Microsoft.AspNet.Session/NotNullAttribute.cs deleted file mode 100644 index a649da0de4..0000000000 --- a/src/Microsoft.AspNet.Session/NotNullAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -// 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; - -namespace Microsoft.AspNet.Session -{ - [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)] - internal sealed class NotNullAttribute : Attribute - { - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionFactory.cs b/src/Microsoft.AspNet.Session/SessionFactory.cs index 99bd37aaac..345e88f287 100644 --- a/src/Microsoft.AspNet.Session/SessionFactory.cs +++ b/src/Microsoft.AspNet.Session/SessionFactory.cs @@ -3,6 +3,7 @@ using System; using Microsoft.AspNet.Http; +using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 45a422e10e..b5db2ab79e 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -8,6 +8,7 @@ using System.Security.Cryptography; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; +using Microsoft.Framework.Internal; using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs index 83585bcb45..561947872f 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs @@ -6,6 +6,7 @@ using Microsoft.AspNet.Session; using Microsoft.Framework.Caching.Distributed; using Microsoft.Framework.Caching.Memory; using Microsoft.Framework.DependencyInjection; +using Microsoft.Framework.Internal; using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs index 5c9d9bd9ae..fe985f6023 100644 --- a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs @@ -3,6 +3,7 @@ using System; using Microsoft.AspNet.Session; +using Microsoft.Framework.Internal; namespace Microsoft.Framework.DependencyInjection { diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 1160ee8438..7c4a467910 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -5,7 +5,8 @@ "Microsoft.AspNet.Http.Extensions": "1.0.0-*", "Microsoft.AspNet.Http.Interfaces": "1.0.0-*", "Microsoft.Framework.Caching.Distributed": "1.0.0-*", - "Microsoft.Framework.Logging.Interfaces": "1.0.0-*" + "Microsoft.Framework.Logging.Interfaces": "1.0.0-*", + "Microsoft.Framework.NotNullAttribute.Internal": { "type": "build", "version": "1.0.0-*" } }, "compilationOptions": { "allowUnsafe": true From e68de43bce316b39a3f956cc86bba1c5d93db236 Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Thu, 19 Mar 2015 21:37:35 +0300 Subject: [PATCH 023/295] Using 'nameof' operator instead of magic strings --- src/Microsoft.AspNet.Session/DistributedSession.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index bc7393a9ca..d77a97a657 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -60,12 +60,12 @@ namespace Microsoft.AspNet.Session var encodedKey = new EncodedKey(key); if (encodedKey.KeyBytes.Length > KeyLengthLimit) { - throw new ArgumentOutOfRangeException("key", key, + throw new ArgumentOutOfRangeException(nameof(key), string.Format("The key cannot be longer than '{0}' when encoded with UTF-8.", KeyLengthLimit)); } if (value.Array == null) { - throw new ArgumentException("The ArraySegment.Array cannot be null.", "value"); + throw new ArgumentException("The ArraySegment.Array cannot be null.", nameof(value)); } Load(); @@ -174,7 +174,7 @@ namespace Microsoft.AspNet.Session { if (num < 0 || ushort.MaxValue < num) { - throw new ArgumentOutOfRangeException("num", num, "The value cannot be serialized in two bytes."); + throw new ArgumentOutOfRangeException(nameof(num), "The value cannot be serialized in two bytes."); } output.WriteByte((byte)(num >> 8)); output.WriteByte((byte)(0xFF & num)); @@ -189,7 +189,7 @@ namespace Microsoft.AspNet.Session { if (num < 0 || 0xFFFFFF < num) { - throw new ArgumentOutOfRangeException("num", num, "The value cannot be serialized in three bytes."); + throw new ArgumentOutOfRangeException(nameof(num), "The value cannot be serialized in three bytes."); } output.WriteByte((byte)(num >> 16)); output.WriteByte((byte)(0xFF & (num >> 8))); @@ -205,7 +205,7 @@ namespace Microsoft.AspNet.Session { if (num < 0) { - throw new ArgumentOutOfRangeException("num", num, "The value cannot be negative."); + throw new ArgumentOutOfRangeException(nameof(num), "The value cannot be negative."); } output.WriteByte((byte)(num >> 24)); output.WriteByte((byte)(0xFF & (num >> 16))); From fa95120ddea5157c9897c0a715c6359a974ddfcc Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 19 Mar 2015 11:38:20 -0700 Subject: [PATCH 024/295] React to hosting --- .../SessionTests.cs | 40 +++++++++---------- .../project.json | 1 - 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index bb4d9447da..7aa2822c89 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -23,14 +23,14 @@ namespace Microsoft.AspNet.Session { using (var server = TestServer.Create(app => { - app.UseServices(services => services.AddOptions()); app.UseInMemorySession(); app.Run(context => { Assert.Null(context.Session.GetString("NotFound")); return Task.FromResult(0); }); - })) + }, + services => services.AddOptions())) { var client = server.CreateClient(); var response = await client.GetAsync("/"); @@ -45,7 +45,6 @@ namespace Microsoft.AspNet.Session { using (var server = TestServer.Create(app => { - app.UseServices(services => services.AddOptions()); app.UseInMemorySession(); app.Run(context => { @@ -54,7 +53,8 @@ namespace Microsoft.AspNet.Session Assert.Equal("Value", context.Session.GetString("Key")); return Task.FromResult(0); }); - })) + }, + services => services.AddOptions())) { var client = server.CreateClient(); var response = await client.GetAsync("/"); @@ -71,7 +71,6 @@ namespace Microsoft.AspNet.Session { using (var server = TestServer.Create(app => { - app.UseServices(services => services.AddOptions()); app.UseInMemorySession(); app.Run(context => { @@ -85,7 +84,8 @@ namespace Microsoft.AspNet.Session context.Session.SetInt("Key", value.Value + 1); return context.Response.WriteAsync(value.Value.ToString()); }); - })) + }, + services => services.AddOptions())) { var client = server.CreateClient(); var response = await client.GetAsync("/first"); @@ -105,7 +105,6 @@ namespace Microsoft.AspNet.Session { using (var server = TestServer.Create(app => { - app.UseServices(services => services.AddOptions()); app.UseInMemorySession(); app.Run(context => { @@ -129,7 +128,8 @@ namespace Microsoft.AspNet.Session } return context.Response.WriteAsync(value.Value.ToString()); }); - })) + }, + services => services.AddOptions())) { var client = server.CreateClient(); var response = await client.GetAsync("/first"); @@ -148,7 +148,6 @@ namespace Microsoft.AspNet.Session { using (var server = TestServer.Create(app => { - app.UseServices(services => services.AddOptions()); app.UseInMemorySession(); app.Run(context => { @@ -172,7 +171,8 @@ namespace Microsoft.AspNet.Session } return context.Response.WriteAsync(value.Value.ToString()); }); - })) + }, + services => services.AddOptions())) { var client = server.CreateClient(); var response = await client.GetAsync("/first"); @@ -193,17 +193,17 @@ namespace Microsoft.AspNet.Session var loggerFactory = new TestLoggerFactory(sink, enabled: true); using (var server = TestServer.Create(app => { - app.UseServices(services => - { - services.AddOptions(); - services.AddInstance(typeof(ILoggerFactory), loggerFactory); - }); app.UseInMemorySession(); app.Run(context => { context.Session.SetString("Key", "Value"); return Task.FromResult(0); }); + }, + services => + { + services.AddOptions(); + services.AddInstance(typeof(ILoggerFactory), loggerFactory); })) { var client = server.CreateClient(); @@ -222,11 +222,6 @@ namespace Microsoft.AspNet.Session var loggerFactory = new TestLoggerFactory(sink, enabled: true); using (var server = TestServer.Create(app => { - app.UseServices(services => - { - services.AddOptions(); - services.AddInstance(typeof(ILoggerFactory), loggerFactory); - }); app.UseInMemorySession(configure: o => { o.IdleTimeout = TimeSpan.FromMilliseconds(30); }); @@ -246,6 +241,11 @@ namespace Microsoft.AspNet.Session } return context.Response.WriteAsync(value.Value.ToString()); }); + }, + services => + { + services.AddOptions(); + services.AddInstance(typeof(ILoggerFactory), loggerFactory); })) { var client = server.CreateClient(); diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json index 2636aa9fc3..cd31e837c8 100644 --- a/test/Microsoft.AspNet.Session.Tests/project.json +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -1,7 +1,6 @@ { "dependencies": { "Microsoft.AspNet.Session": "1.0.0-*", - "Microsoft.AspNet.RequestContainer": "1.0.0-*", "Microsoft.AspNet.TestHost": "1.0.0-*", "Microsoft.Framework.Logging.Testing": "1.0.0-*", "xunit.runner.aspnet": "2.0.0-aspnet-*" From 2a95b7736e241bfc0769fed5cd16ef3dfea90831 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Tue, 24 Mar 2015 21:40:12 -0700 Subject: [PATCH 025/295] Remove k command and use dnx instead --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index ec3263114a..d81164353c 100644 --- a/build.sh +++ b/build.sh @@ -31,7 +31,7 @@ if ! type dnvm > /dev/null 2>&1; then source packages/KoreBuild/build/dnvm.sh fi -if ! type k > /dev/null 2>&1; then +if ! type dnx > /dev/null 2>&1; then dnvm upgrade fi From 98202236c5149442634a10510bd53c69ed1bb9fb Mon Sep 17 00:00:00 2001 From: hishamco Date: Wed, 25 Mar 2015 10:37:04 +0300 Subject: [PATCH 026/295] Update 'dnvmx -x86' switch --- build.cmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.cmd b/build.cmd index 68a732c182..41025afb26 100644 --- a/build.cmd +++ b/build.cmd @@ -20,9 +20,9 @@ IF EXIST packages\KoreBuild goto run .nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion IF "%SKIP_DNX_INSTALL%"=="1" goto run -CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -x86 -CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -x86 +CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86 +CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86 :run -CALL packages\KoreBuild\build\dnvm use default -runtime CLR -x86 +CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86 packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* From cb6600abaf561c9e61706268d54cf03e82f2deb9 Mon Sep 17 00:00:00 2001 From: suhasj Date: Wed, 25 Mar 2015 11:50:32 -0700 Subject: [PATCH 027/295] Updating release NuGet.config --- NuGet.Config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index da57d47267..1978dc065a 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -1,7 +1,7 @@  - + - \ No newline at end of file + From c0bacd63bd1a2189de6854e80226edf68270ca54 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Wed, 1 Apr 2015 15:55:35 -0700 Subject: [PATCH 028/295] Add travis and appveyor CI support. --- .travis.yml | 3 +++ appveyor.yml | 5 +++++ build.sh | 0 3 files changed, 8 insertions(+) create mode 100644 .travis.yml create mode 100644 appveyor.yml mode change 100644 => 100755 build.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..0f4cb93e59 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: csharp +script: + - ./build.sh verify \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..88cb9ef145 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,5 @@ +build_script: + - build.cmd verify +clone_depth: 1 +test: off +deploy: off \ No newline at end of file diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 From b5907076b74a5c5221373a1926dd9940400ca2f3 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Wed, 1 Apr 2015 17:08:00 -0700 Subject: [PATCH 029/295] Turn off sudo for .travis.yml. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 0f4cb93e59..5939a529e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ language: csharp +sudo: false script: - ./build.sh verify \ No newline at end of file From 09748a044aab4e64daa5e03c055af1d46f952bec Mon Sep 17 00:00:00 2001 From: Troy Dai Date: Thu, 2 Apr 2015 09:20:33 -0700 Subject: [PATCH 030/295] Update global.json, sources=>projects --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index ce063d240d..d9b4ed63ae 100644 --- a/global.json +++ b/global.json @@ -1,3 +1,3 @@ { - "sources": [ "src" ] -} \ No newline at end of file + "projects": [ "src" ] +} From b7186c4bf7cc6d08d2f98cdc27f4ce52c33f4d04 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Thu, 2 Apr 2015 13:49:29 -0700 Subject: [PATCH 031/295] Update .xproj files for Microsoft.Web.AspNet.* -> Microsoft.DNX.* rename --- samples/SessionSample/SessionSample.xproj | 4 ++-- .../Microsoft.AspNet.Session.xproj | 8 ++++---- .../Microsoft.AspNet.Session.Tests.xproj | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/SessionSample/SessionSample.xproj b/samples/SessionSample/SessionSample.xproj index 941cbc31f0..d092ddc3e1 100644 --- a/samples/SessionSample/SessionSample.xproj +++ b/samples/SessionSample/SessionSample.xproj @@ -4,7 +4,7 @@ 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - + fe0b9969-3bde-4a7d-be1b-47eae8dbf365 ..\..\artifacts\obj\$(MSBuildProjectName) @@ -14,5 +14,5 @@ 2.0 29562 - + \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.xproj b/src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.xproj index 11c899ba40..bfd4661379 100644 --- a/src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.xproj +++ b/src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.xproj @@ -1,10 +1,10 @@ - + 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - + 71802736-f640-4733-9671-02d267edd76a ..\..\artifacts\obj\$(MSBuildProjectName) @@ -13,5 +13,5 @@ 2.0 - - + + \ No newline at end of file diff --git a/test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.xproj b/test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.xproj index 9c13767321..6171b1b973 100644 --- a/test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.xproj +++ b/test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.xproj @@ -1,10 +1,10 @@ - + 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - + 8c131a0a-bc1a-4cf3-8b77-8813fbfe5639 ..\..\artifacts\obj\$(MSBuildProjectName) @@ -13,5 +13,5 @@ 2.0 - - + + \ No newline at end of file From 4e1e03db108074b1d77a3d46d64ece76c5cbd197 Mon Sep 17 00:00:00 2001 From: Praburaj Date: Fri, 3 Apr 2015 09:29:48 -0700 Subject: [PATCH 032/295] Fixing tests to run successfully on mono Removing the leading '/' on httpClient.GetAsync(). --- .../Microsoft.AspNet.Session.Tests/SessionTests.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 7aa2822c89..18b257e087 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Session services => services.AddOptions())) { var client = server.CreateClient(); - var response = await client.GetAsync("/"); + var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); IEnumerable values; Assert.False(response.Headers.TryGetValues("Set-Cookie", out values)); @@ -57,7 +57,7 @@ namespace Microsoft.AspNet.Session services => services.AddOptions())) { var client = server.CreateClient(); - var response = await client.GetAsync("/"); + var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); IEnumerable values; Assert.True(response.Headers.TryGetValues("Set-Cookie", out values)); @@ -88,7 +88,7 @@ namespace Microsoft.AspNet.Session services => services.AddOptions())) { var client = server.CreateClient(); - var response = await client.GetAsync("/first"); + var response = await client.GetAsync("first"); response.EnsureSuccessStatusCode(); Assert.Equal("0", await response.Content.ReadAsStringAsync()); @@ -132,7 +132,7 @@ namespace Microsoft.AspNet.Session services => services.AddOptions())) { var client = server.CreateClient(); - var response = await client.GetAsync("/first"); + var response = await client.GetAsync("first"); response.EnsureSuccessStatusCode(); Assert.Equal("0", await response.Content.ReadAsStringAsync()); @@ -175,7 +175,7 @@ namespace Microsoft.AspNet.Session services => services.AddOptions())) { var client = server.CreateClient(); - var response = await client.GetAsync("/first"); + var response = await client.GetAsync("first"); response.EnsureSuccessStatusCode(); Assert.Equal("0", await response.Content.ReadAsStringAsync()); @@ -207,7 +207,7 @@ namespace Microsoft.AspNet.Session })) { var client = server.CreateClient(); - var response = await client.GetAsync("/"); + var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); Assert.Single(sink.Writes); Assert.True(((ILogValues)sink.Writes[0].State).Format().Contains("started")); @@ -249,7 +249,7 @@ namespace Microsoft.AspNet.Session })) { var client = server.CreateClient(); - var response = await client.GetAsync("/first"); + var response = await client.GetAsync("first"); response.EnsureSuccessStatusCode(); client = server.CreateClient(); From cfd01e2eb55616f5dd9e314871043df782c21d5e Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Fri, 3 Apr 2015 17:25:24 -0700 Subject: [PATCH 033/295] Fix AppVeyor git line ending config --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 88cb9ef145..3fab83e134 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,5 @@ +init: + - git config --global core.autocrlf true build_script: - build.cmd verify clone_depth: 1 From a1a9f7294c57d78b95f93a835b5fb6c57ea2d1d9 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Sat, 4 Apr 2015 02:01:19 -0700 Subject: [PATCH 034/295] Reacting to ILogger api changes --- test/Microsoft.AspNet.Session.Tests/SessionTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 18b257e087..55db8ed511 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -210,7 +210,7 @@ namespace Microsoft.AspNet.Session var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); Assert.Single(sink.Writes); - Assert.True(((ILogValues)sink.Writes[0].State).Format().Contains("started")); + Assert.Contains("started", sink.Writes[0].State.ToString()); Assert.Equal(LogLevel.Information, sink.Writes[0].LogLevel); } } @@ -257,8 +257,8 @@ namespace Microsoft.AspNet.Session Thread.Sleep(50); Assert.Equal("2", await client.GetStringAsync("/second")); Assert.Equal(2, sink.Writes.Count); - Assert.True(((ILogValues)sink.Writes[0].State).Format().Contains("started")); - Assert.True(((ILogValues)sink.Writes[1].State).Format().Contains("expired")); + Assert.Contains("started", sink.Writes[0].State.ToString()); + Assert.Contains("expired", sink.Writes[1].State.ToString()); Assert.Equal(LogLevel.Information, sink.Writes[0].LogLevel); Assert.Equal(LogLevel.Warning, sink.Writes[1].LogLevel); } From db9ee60647f08ddb7b2a83bd1f7c52e5c34cb0aa Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Tue, 7 Apr 2015 14:51:14 -0700 Subject: [PATCH 035/295] Add serviceable attribute to projects. aspnet/DNX#1600 --- src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs diff --git a/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs b/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..f5c6f4a83a --- /dev/null +++ b/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +// 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.Reflection; + +[assembly: AssemblyMetadata("Serviceable", "True")] \ No newline at end of file From c6fde6bfa849fce750b509432206e72ad44c4f85 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Tue, 7 Apr 2015 16:16:48 -0700 Subject: [PATCH 036/295] Update .travis.yml and appveyor.yml to build quietly. --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5939a529e5..947bf868ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: csharp sudo: false script: - - ./build.sh verify \ No newline at end of file + - ./build.sh --quiet verify \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 3fab83e134..636a7618d3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ init: - git config --global core.autocrlf true build_script: - - build.cmd verify + - build.cmd --quiet verify clone_depth: 1 test: off deploy: off \ No newline at end of file From 10f1b9c0380c3065ee897b752625c46462ea6333 Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Wed, 15 Apr 2015 11:04:46 -0700 Subject: [PATCH 037/295] Fix cookie handling in tests. --- .../SessionTests.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 55db8ed511..2316ff2ea9 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -9,9 +9,10 @@ using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.AspNet.TestHost; -using Microsoft.Framework.Logging.Testing; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; +using Microsoft.Framework.Logging.Testing; +using Microsoft.Net.Http.Headers; using Xunit; namespace Microsoft.AspNet.Session @@ -93,7 +94,8 @@ namespace Microsoft.AspNet.Session Assert.Equal("0", await response.Content.ReadAsStringAsync()); client = server.CreateClient(); - client.DefaultRequestHeaders.Add("Cookie", response.Headers.GetValues("Set-Cookie")); + var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First(); + client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); Assert.Equal("1", await client.GetStringAsync("/")); Assert.Equal("2", await client.GetStringAsync("/")); Assert.Equal("3", await client.GetStringAsync("/")); @@ -137,7 +139,8 @@ namespace Microsoft.AspNet.Session Assert.Equal("0", await response.Content.ReadAsStringAsync()); client = server.CreateClient(); - client.DefaultRequestHeaders.Add("Cookie", response.Headers.GetValues("Set-Cookie")); + var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First(); + client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); Assert.Equal("1", await client.GetStringAsync("/second")); Assert.Equal("2", await client.GetStringAsync("/third")); } @@ -180,7 +183,8 @@ namespace Microsoft.AspNet.Session Assert.Equal("0", await response.Content.ReadAsStringAsync()); client = server.CreateClient(); - client.DefaultRequestHeaders.Add("Cookie", response.Headers.GetValues("Set-Cookie")); + var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First(); + client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); Assert.Equal("1", await client.GetStringAsync("/second")); Assert.Equal("2", await client.GetStringAsync("/third")); } @@ -253,7 +257,8 @@ namespace Microsoft.AspNet.Session response.EnsureSuccessStatusCode(); client = server.CreateClient(); - client.DefaultRequestHeaders.Add("Cookie", response.Headers.GetValues("Set-Cookie")); + var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First(); + client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); Thread.Sleep(50); Assert.Equal("2", await client.GetStringAsync("/second")); Assert.Equal(2, sink.Writes.Count); From d37f9dded2ed78a1fc51897ff3d56f172348a19c Mon Sep 17 00:00:00 2001 From: Justin Van Patten Date: Thu, 16 Apr 2015 18:30:25 -0700 Subject: [PATCH 038/295] React to SessionCollectionExtensions renames React to aspnet/HttpAbstractions#280 --- samples/SessionSample/Startup.cs | 8 ++++---- .../SessionTests.cs | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 17f68de5ce..72132b69bd 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -31,8 +31,8 @@ namespace SessionSample subApp.Run(async context => { int visits = 0; - visits = context.Session.GetInt("visits") ?? 0; - context.Session.SetInt("visits", ++visits); + visits = context.Session.GetInt32("visits") ?? 0; + context.Session.SetInt32("visits", ++visits); await context.Response.WriteAsync("Counting: You have visited our page this many times: " + visits); }); }); @@ -40,7 +40,7 @@ namespace SessionSample app.Run(async context => { int visits = 0; - visits = context.Session.GetInt("visits") ?? 0; + visits = context.Session.GetInt32("visits") ?? 0; await context.Response.WriteAsync(""); if (visits == 0) { @@ -50,7 +50,7 @@ namespace SessionSample } else { - context.Session.SetInt("visits", ++visits); + context.Session.SetInt32("visits", ++visits); await context.Response.WriteAsync("Your session was located, you've visited the site this many times: " + visits); } await context.Response.WriteAsync(""); diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 2316ff2ea9..be296185d9 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -75,14 +75,14 @@ namespace Microsoft.AspNet.Session app.UseInMemorySession(); app.Run(context => { - int? value = context.Session.GetInt("Key"); + int? value = context.Session.GetInt32("Key"); if (context.Request.Path == new PathString("/first")) { Assert.False(value.HasValue); value = 0; } Assert.True(value.HasValue); - context.Session.SetInt("Key", value.Value + 1); + context.Session.SetInt32("Key", value.Value + 1); return context.Response.WriteAsync(value.Value.ToString()); }); }, @@ -110,12 +110,12 @@ namespace Microsoft.AspNet.Session app.UseInMemorySession(); app.Run(context => { - int? value = context.Session.GetInt("Key"); + int? value = context.Session.GetInt32("Key"); if (context.Request.Path == new PathString("/first")) { Assert.False(value.HasValue); value = 0; - context.Session.SetInt("Key", 1); + context.Session.SetInt32("Key", 1); } else if (context.Request.Path == new PathString("/second")) { @@ -154,12 +154,12 @@ namespace Microsoft.AspNet.Session app.UseInMemorySession(); app.Run(context => { - int? value = context.Session.GetInt("Key"); + int? value = context.Session.GetInt32("Key"); if (context.Request.Path == new PathString("/first")) { Assert.False(value.HasValue); value = 0; - context.Session.SetInt("Key", 1); + context.Session.SetInt32("Key", 1); } else if (context.Request.Path == new PathString("/second")) { @@ -231,12 +231,12 @@ namespace Microsoft.AspNet.Session }); app.Run(context => { - int? value = context.Session.GetInt("Key"); + int? value = context.Session.GetInt32("Key"); if (context.Request.Path == new PathString("/first")) { Assert.False(value.HasValue); value = 1; - context.Session.SetInt("Key", 1); + context.Session.SetInt32("Key", 1); } else if (context.Request.Path == new PathString("/second")) { From a7ea311e8eff8da595d098aa53a6987c1e15cb30 Mon Sep 17 00:00:00 2001 From: Chris R Date: Wed, 29 Apr 2015 15:49:52 -0700 Subject: [PATCH 039/295] Remove redundant Http.Interfaces dependency. --- src/Microsoft.AspNet.Session/project.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 7c4a467910..714d5c0f2e 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -3,7 +3,6 @@ "description": "ASP.NET 5 session state middleware.", "dependencies": { "Microsoft.AspNet.Http.Extensions": "1.0.0-*", - "Microsoft.AspNet.Http.Interfaces": "1.0.0-*", "Microsoft.Framework.Caching.Distributed": "1.0.0-*", "Microsoft.Framework.Logging.Interfaces": "1.0.0-*", "Microsoft.Framework.NotNullAttribute.Internal": { "type": "build", "version": "1.0.0-*" } From b80f9ff6207366cddb4d1cba4c1a8c1dc5de2c50 Mon Sep 17 00:00:00 2001 From: Brennan Date: Thu, 30 Apr 2015 11:08:56 -0700 Subject: [PATCH 040/295] React to Logging interface package rename --- src/Microsoft.AspNet.Session/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 714d5c0f2e..e62bd1d1ba 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -4,7 +4,7 @@ "dependencies": { "Microsoft.AspNet.Http.Extensions": "1.0.0-*", "Microsoft.Framework.Caching.Distributed": "1.0.0-*", - "Microsoft.Framework.Logging.Interfaces": "1.0.0-*", + "Microsoft.Framework.Logging.Abstractions": "1.0.0-*", "Microsoft.Framework.NotNullAttribute.Internal": { "type": "build", "version": "1.0.0-*" } }, "compilationOptions": { From b7a38ce39a40e89d2aa08de884875c5a3c36feee Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Fri, 1 May 2015 14:00:47 -0700 Subject: [PATCH 041/295] Update LICENSE.txt and license header on files. --- LICENSE.txt | 2 +- src/Microsoft.AspNet.Session/DistributedSession.cs | 2 +- src/Microsoft.AspNet.Session/DistributedSessionStore.cs | 2 +- src/Microsoft.AspNet.Session/ISessionStore.cs | 2 +- src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs | 2 +- src/Microsoft.AspNet.Session/SessionDefaults.cs | 2 +- src/Microsoft.AspNet.Session/SessionFactory.cs | 2 +- src/Microsoft.AspNet.Session/SessionFeature.cs | 2 +- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 2 +- src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs | 2 +- src/Microsoft.AspNet.Session/SessionOptions.cs | 2 +- .../SessionServiceCollectionExtensions.cs | 2 +- src/Microsoft.AspNet.Session/SipHash.cs | 2 +- test/Microsoft.AspNet.Session.Tests/SessionTests.cs | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index d85a1524ad..0bdc1962b6 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +Copyright (c) .NET Foundation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index d77a97a657..123e1b4e66 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs index 8e0efd6a71..d3f3b84462 100644 --- a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Microsoft.AspNet.Session/ISessionStore.cs b/src/Microsoft.AspNet.Session/ISessionStore.cs index d1f69c3a6d..817cbbaf5b 100644 --- a/src/Microsoft.AspNet.Session/ISessionStore.cs +++ b/src/Microsoft.AspNet.Session/ISessionStore.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs b/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs index f5c6f4a83a..025a94598c 100644 --- a/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Reflection; diff --git a/src/Microsoft.AspNet.Session/SessionDefaults.cs b/src/Microsoft.AspNet.Session/SessionDefaults.cs index 7fb15b355f..016eb77128 100644 --- a/src/Microsoft.AspNet.Session/SessionDefaults.cs +++ b/src/Microsoft.AspNet.Session/SessionDefaults.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Microsoft.AspNet.Session/SessionFactory.cs b/src/Microsoft.AspNet.Session/SessionFactory.cs index 345e88f287..7e727611b2 100644 --- a/src/Microsoft.AspNet.Session/SessionFactory.cs +++ b/src/Microsoft.AspNet.Session/SessionFactory.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Microsoft.AspNet.Session/SessionFeature.cs b/src/Microsoft.AspNet.Session/SessionFeature.cs index 63e52087ba..fe35d697d5 100644 --- a/src/Microsoft.AspNet.Session/SessionFeature.cs +++ b/src/Microsoft.AspNet.Session/SessionFeature.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Http; diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index b5db2ab79e..bab4c092ce 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs index 561947872f..655f0f4b40 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Microsoft.AspNet.Session/SessionOptions.cs b/src/Microsoft.AspNet.Session/SessionOptions.cs index 345df18d39..023b5d8e71 100644 --- a/src/Microsoft.AspNet.Session/SessionOptions.cs +++ b/src/Microsoft.AspNet.Session/SessionOptions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs index fe985f6023..833d72470e 100644 --- a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Microsoft.AspNet.Session/SipHash.cs b/src/Microsoft.AspNet.Session/SipHash.cs index faadd44185..219194f6ab 100644 --- a/src/Microsoft.AspNet.Session/SipHash.cs +++ b/src/Microsoft.AspNet.Session/SipHash.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index be296185d9..542ac0afd8 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; From 7d52b3f76eb5434e2081951cf44eab078e3dfc51 Mon Sep 17 00:00:00 2001 From: Chris R Date: Thu, 7 May 2015 14:14:03 -0700 Subject: [PATCH 042/295] React to Http namespace changes. --- src/Microsoft.AspNet.Session/DistributedSession.cs | 1 + src/Microsoft.AspNet.Session/DistributedSessionStore.cs | 2 +- src/Microsoft.AspNet.Session/ISessionStore.cs | 2 +- src/Microsoft.AspNet.Session/SessionFactory.cs | 2 +- src/Microsoft.AspNet.Session/SessionFeature.cs | 2 +- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 1 + 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index 123e1b4e66..0b0cf9462b 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -7,6 +7,7 @@ using System.IO; using System.Linq; using System.Text; using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; using Microsoft.Framework.Caching.Distributed; using Microsoft.Framework.Internal; using Microsoft.Framework.Logging; diff --git a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs index d3f3b84462..4391214c54 100644 --- a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; using Microsoft.Framework.Caching.Distributed; using Microsoft.Framework.Internal; using Microsoft.Framework.Logging; diff --git a/src/Microsoft.AspNet.Session/ISessionStore.cs b/src/Microsoft.AspNet.Session/ISessionStore.cs index 817cbbaf5b..14d22d9af7 100644 --- a/src/Microsoft.AspNet.Session/ISessionStore.cs +++ b/src/Microsoft.AspNet.Session/ISessionStore.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionFactory.cs b/src/Microsoft.AspNet.Session/SessionFactory.cs index 7e727611b2..b643f7bac9 100644 --- a/src/Microsoft.AspNet.Session/SessionFactory.cs +++ b/src/Microsoft.AspNet.Session/SessionFactory.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Session diff --git a/src/Microsoft.AspNet.Session/SessionFeature.cs b/src/Microsoft.AspNet.Session/SessionFeature.cs index fe35d697d5..9b8afa2e27 100644 --- a/src/Microsoft.AspNet.Session/SessionFeature.cs +++ b/src/Microsoft.AspNet.Session/SessionFeature.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index bab4c092ce..8a1756604d 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -8,6 +8,7 @@ using System.Security.Cryptography; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; using Microsoft.Framework.Internal; using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; From a7b261e596ebc2ed98d55dbad9ead039dcf939e2 Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Tue, 12 May 2015 11:47:30 -0700 Subject: [PATCH 043/295] Update Home master -> Home dev --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eac4268e4c..64ff041d5c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ Contributing ====== -Information on contributing to this repo is in the [Contributing Guide](https://github.com/aspnet/Home/blob/master/CONTRIBUTING.md) in the Home repo. +Information on contributing to this repo is in the [Contributing Guide](https://github.com/aspnet/Home/blob/dev/CONTRIBUTING.md) in the Home repo. From e86f571011559b89cac90d5c9663d1d1b1d5fbe4 Mon Sep 17 00:00:00 2001 From: Troy Dai Date: Wed, 20 May 2015 12:38:31 -0700 Subject: [PATCH 044/295] Update dependency, react to Microsoft.Framework.NotNullAttribute.Sources --- src/Microsoft.AspNet.Session/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index e62bd1d1ba..2eb6c5f09a 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -5,7 +5,7 @@ "Microsoft.AspNet.Http.Extensions": "1.0.0-*", "Microsoft.Framework.Caching.Distributed": "1.0.0-*", "Microsoft.Framework.Logging.Abstractions": "1.0.0-*", - "Microsoft.Framework.NotNullAttribute.Internal": { "type": "build", "version": "1.0.0-*" } + "Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" } }, "compilationOptions": { "allowUnsafe": true From 7ed6802bba5bea786574016e543f434c4b6d71f9 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Mon, 18 May 2015 09:51:43 -0700 Subject: [PATCH 045/295] Reacting to Caching api review changes --- .../DistributedSession.cs | 41 ++++++++++++++----- src/Microsoft.AspNet.Session/project.json | 2 +- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index 0b0cf9462b..20a9514005 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -98,10 +98,10 @@ namespace Microsoft.AspNet.Session { if (!_loaded) { - Stream data; - if (_cache.TryGetValue(_sessionId, out data)) + var data = _cache.Get(_sessionId); + if (data != null) { - Deserialize(data); + Deserialize(new MemoryStream(data)); } else if (!_isNewSessionKey) { @@ -115,16 +115,19 @@ namespace Microsoft.AspNet.Session { if (_isModified) { - Stream data; - if (_logger.IsEnabled(LogLevel.Information) && !_cache.TryGetValue(_sessionId, out data)) + var data = _cache.Get(_sessionId); + if (_logger.IsEnabled(LogLevel.Information) && data == null) { _logger.LogInformation("Session {0} started", _sessionId); } _isModified = false; - _cache.Set(_sessionId, context => { - context.SetSlidingExpiration(_idleTimeout); - Serialize(context.Data); - }); + + var stream = new MemoryStream(); + Serialize(stream); + _cache.Set( + _sessionId, + stream.ToArray(), + new DistributedCacheEntryOptions().SetSlidingExpiration(_idleTimeout)); } } @@ -165,9 +168,9 @@ namespace Microsoft.AspNet.Session for (int i = 0; i < expectedEntries; i++) { int keyLength = DeserializeNumFrom2Bytes(content); - var key = new EncodedKey(content.ReadBytes(keyLength)); + var key = new EncodedKey(ReadBytes(content, keyLength)); int dataLength = DeserializeNumFrom4Bytes(content); - _store[key] = content.ReadBytes(dataLength); + _store[key] = ReadBytes(content, dataLength); } } @@ -219,6 +222,22 @@ namespace Microsoft.AspNet.Session return content.ReadByte() << 24 | content.ReadByte() << 16 | content.ReadByte() << 8 | content.ReadByte(); } + private byte[] ReadBytes(Stream stream, int count) + { + var output = new byte[count]; + int total = 0; + while (total < count) + { + var read = stream.Read(output, total, count - total); + if (read == 0) + { + throw new EndOfStreamException(); + } + total += read; + } + return output; + } + // Keys are stored in their utf-8 encoded state. // This saves us from de-serializing and re-serializing every key on every request. private class EncodedKey diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 2eb6c5f09a..105688d976 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -3,7 +3,7 @@ "description": "ASP.NET 5 session state middleware.", "dependencies": { "Microsoft.AspNet.Http.Extensions": "1.0.0-*", - "Microsoft.Framework.Caching.Distributed": "1.0.0-*", + "Microsoft.Framework.Caching.Memory": "1.0.0-*", "Microsoft.Framework.Logging.Abstractions": "1.0.0-*", "Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" } }, From 48cdaebd71334aaa83f14362c0f0d9de69d8cd41 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 27 May 2015 16:33:25 -0700 Subject: [PATCH 046/295] Updating to release NuGet.config --- NuGet.Config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index da57d47267..0e74a4912d 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -1,7 +1,8 @@  - + + - \ No newline at end of file + From dab08ba7e90027a3bf1ef69f740427e93a310f09 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Wed, 27 May 2015 15:12:43 -0700 Subject: [PATCH 047/295] Session api review changes --- samples/SessionSample/Startup.cs | 22 ++++++-- samples/SessionSample/project.json | 4 +- .../DistributedSession.cs | 33 ++++++----- .../SessionFactory.cs | 37 ------------- .../SessionFeature.cs | 2 - .../SessionMiddleware.cs | 34 +++--------- .../SessionMiddlewareExtensions.cs | 33 +---------- .../SessionOptions.cs | 5 -- .../SessionServiceCollectionExtensions.cs | 17 +++--- src/Microsoft.AspNet.Session/project.json | 7 ++- .../SessionTests.cs | 55 +++++++++++++------ .../project.json | 25 +++++---- 12 files changed, 111 insertions(+), 163 deletions(-) delete mode 100644 src/Microsoft.AspNet.Session/SessionFactory.cs diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 72132b69bd..0eaa898719 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -1,6 +1,10 @@ -using System; +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; +using Microsoft.Framework.Caching.Redis; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; @@ -15,16 +19,24 @@ namespace SessionSample public void ConfigureServices(IServiceCollection services) { + // Adds a default in-memory implementation of IDistributedCache services.AddCaching(); + + // Uncomment the following line to use the Redis implementation of IDistributedCache. + // This will override any previously registered IDistributedCache service. + //services.AddTransient(); + services.AddSession(); + + services.ConfigureSession(o => + { + o.IdleTimeout = TimeSpan.FromSeconds(30); + }); } public void Configure(IApplicationBuilder app) { - app.UseSession(o => { - o.IdleTimeout = TimeSpan.FromSeconds(30); }); - // app.UseInMemorySession(); - // app.UseDistributedSession(new RedisCache(new RedisCacheOptions() { Configuration = "localhost" })); + app.UseSession(); app.Map("/session", subApp => { diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 627614ff39..cf9b17c4b3 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -2,10 +2,10 @@ "webroot": "wwwroot", "exclude": "wwwroot/**/*.*", "dependencies": { - "Microsoft.AspNet.Http.Extensions": "1.0.0-*", "Microsoft.AspNet.Server.IIS": "1.0.0-*", - "Microsoft.AspNet.Server.WebListener" : "1.0.0-*", + "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.Session": "1.0.0-*", + "Microsoft.Framework.Caching.Memory": "1.0.0-*", "Microsoft.Framework.Caching.Redis": "1.0.0-*", "Microsoft.Framework.Logging.Console": "1.0.0-*" }, diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index 20a9514005..36ecb7d49a 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using Microsoft.AspNet.Http; +using System.Threading.Tasks; using Microsoft.AspNet.Http.Features; using Microsoft.Framework.Caching.Distributed; using Microsoft.Framework.Internal; @@ -56,7 +56,7 @@ namespace Microsoft.AspNet.Session return _store.TryGetValue(new EncodedKey(key), out value); } - public void Set(string key, ArraySegment value) + public void Set(string key, [NotNull] byte[] value) { var encodedKey = new EncodedKey(key); if (encodedKey.KeyBytes.Length > KeyLengthLimit) @@ -64,10 +64,6 @@ namespace Microsoft.AspNet.Session throw new ArgumentOutOfRangeException(nameof(key), string.Format("The key cannot be longer than '{0}' when encoded with UTF-8.", KeyLengthLimit)); } - if (value.Array == null) - { - throw new ArgumentException("The ArraySegment.Array cannot be null.", nameof(value)); - } Load(); if (!_tryEstablishSession()) @@ -75,8 +71,8 @@ namespace Microsoft.AspNet.Session throw new InvalidOperationException("The session cannot be established after the response has started."); } _isModified = true; - byte[] copy = new byte[value.Count]; - Buffer.BlockCopy(value.Array, value.Offset, copy, 0, value.Count); + byte[] copy = new byte[value.Length]; + Buffer.BlockCopy(src: value, srcOffset: 0, dst: copy, dstOffset: 0, count: value.Length); _store[encodedKey] = copy; } @@ -93,12 +89,21 @@ namespace Microsoft.AspNet.Session _store.Clear(); } - // TODO: This should throw if called directly, but most other places it should fail silently (e.g. TryGetValue should just return null). - public void Load() + private void Load() { if (!_loaded) { - var data = _cache.Get(_sessionId); + LoadAsync().GetAwaiter().GetResult(); + } + } + + // TODO: This should throw if called directly, but most other places it should fail silently + // (e.g. TryGetValue should just return null). + public async Task LoadAsync() + { + if (!_loaded) + { + var data = await _cache.GetAsync(_sessionId); if (data != null) { Deserialize(new MemoryStream(data)); @@ -111,11 +116,11 @@ namespace Microsoft.AspNet.Session } } - public void Commit() + public async Task CommitAsync() { if (_isModified) { - var data = _cache.Get(_sessionId); + var data = await _cache.GetAsync(_sessionId); if (_logger.IsEnabled(LogLevel.Information) && data == null) { _logger.LogInformation("Session {0} started", _sessionId); @@ -124,7 +129,7 @@ namespace Microsoft.AspNet.Session var stream = new MemoryStream(); Serialize(stream); - _cache.Set( + await _cache.SetAsync( _sessionId, stream.ToArray(), new DistributedCacheEntryOptions().SetSlidingExpiration(_idleTimeout)); diff --git a/src/Microsoft.AspNet.Session/SessionFactory.cs b/src/Microsoft.AspNet.Session/SessionFactory.cs deleted file mode 100644 index b643f7bac9..0000000000 --- a/src/Microsoft.AspNet.Session/SessionFactory.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNet.Http.Features; -using Microsoft.Framework.Internal; - -namespace Microsoft.AspNet.Session -{ - public class SessionFactory : ISessionFactory - { - private readonly string _sessionKey; - private readonly ISessionStore _store; - private readonly TimeSpan _idleTimeout; - private readonly Func _tryEstablishSession; - private readonly bool _isNewSessionKey; - - public SessionFactory([NotNull] string sessionKey, [NotNull] ISessionStore store, TimeSpan idleTimeout, [NotNull] Func tryEstablishSession, bool isNewSessionKey) - { - _sessionKey = sessionKey; - _store = store; - _idleTimeout = idleTimeout; - _tryEstablishSession = tryEstablishSession; - _isNewSessionKey = isNewSessionKey; - } - - public bool IsAvailable - { - get { return _store.IsAvailable; } - } - - public ISession Create() - { - return _store.Create(_sessionKey, _idleTimeout, _tryEstablishSession, _isNewSessionKey); - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionFeature.cs b/src/Microsoft.AspNet.Session/SessionFeature.cs index 9b8afa2e27..6fba066552 100644 --- a/src/Microsoft.AspNet.Session/SessionFeature.cs +++ b/src/Microsoft.AspNet.Session/SessionFeature.cs @@ -7,8 +7,6 @@ namespace Microsoft.AspNet.Session { public class SessionFeature : ISessionFeature { - public ISessionFactory Factory { get; set; } - public ISession Session { get; set; } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 8a1756604d..3496de13b3 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -23,36 +23,19 @@ namespace Microsoft.AspNet.Session private readonly RequestDelegate _next; private readonly SessionOptions _options; private readonly ILogger _logger; + private readonly ISessionStore _sessionStore; public SessionMiddleware( [NotNull] RequestDelegate next, [NotNull] ILoggerFactory loggerFactory, - [NotNull] IEnumerable sessionStore, - [NotNull] IOptions options, - [NotNull] ConfigureOptions configureOptions) + [NotNull] ISessionStore sessionStore, + [NotNull] IOptions options) { _next = next; _logger = loggerFactory.CreateLogger(); - if (configureOptions != null) - { - _options = options.GetNamedOptions(configureOptions.Name); - configureOptions.Configure(_options); - } - else - { - _options = options.Options; - } - - if (_options.Store == null) - { - _options.Store = sessionStore.FirstOrDefault(); - if (_options.Store == null) - { - throw new ArgumentException("ISessionStore must be specified."); - } - } - - _options.Store.Connect(); + _options = options.Options; + _sessionStore = sessionStore; + _sessionStore.Connect(); } public async Task Invoke(HttpContext context) @@ -72,8 +55,7 @@ namespace Microsoft.AspNet.Session } var feature = new SessionFeature(); - feature.Factory = new SessionFactory(sessionKey, _options.Store, _options.IdleTimeout, tryEstablishSession, isNewSessionKey); - feature.Session = feature.Factory.Create(); + feature.Session = _sessionStore.Create(sessionKey, _options.IdleTimeout, tryEstablishSession, isNewSessionKey); context.SetFeature(feature); try @@ -88,7 +70,7 @@ namespace Microsoft.AspNet.Session { try { - feature.Session.Commit(); + await feature.Session.CommitAsync(); } catch (Exception ex) { diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs index 655f0f4b40..89273bc2fc 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs @@ -1,45 +1,16 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using Microsoft.AspNet.Session; -using Microsoft.Framework.Caching.Distributed; -using Microsoft.Framework.Caching.Memory; -using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; -using Microsoft.Framework.OptionsModel; namespace Microsoft.AspNet.Builder { public static class SessionMiddlewareExtensions { - public static IApplicationBuilder UseInMemorySession([NotNull] this IApplicationBuilder app, IMemoryCache cache = null, Action configure = null) + public static IApplicationBuilder UseSession([NotNull] this IApplicationBuilder app) { - return app.UseDistributedSession(new LocalCache(cache ?? new MemoryCache(new MemoryCacheOptions())), configure); - } - - public static IApplicationBuilder UseDistributedSession([NotNull] this IApplicationBuilder app, - IDistributedCache cache, Action configure = null) - { - var loggerFactory = app.ApplicationServices.GetRequiredService(); - return app.UseSession(options => - { - options.Store = new DistributedSessionStore(cache, loggerFactory); - if (configure != null) - { - configure(options); - } - }); - } - - public static IApplicationBuilder UseSession([NotNull] this IApplicationBuilder app, Action configure = null) - { - return app.UseMiddleware( - new ConfigureOptions(configure ?? (o => { })) - { - Name = string.Empty - }); + return app.UseMiddleware(); } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionOptions.cs b/src/Microsoft.AspNet.Session/SessionOptions.cs index 023b5d8e71..f309fb0401 100644 --- a/src/Microsoft.AspNet.Session/SessionOptions.cs +++ b/src/Microsoft.AspNet.Session/SessionOptions.cs @@ -34,10 +34,5 @@ namespace Microsoft.AspNet.Session /// resets the timeout. Note this only applies to the content of the session, not the cookie. /// public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromMinutes(20); - - /// - /// Gets or sets the session storage manager. This overrides any session store passed into the middleware constructor. - /// - public ISessionStore Store { get; set; } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs index 833d72470e..2fd488820d 100644 --- a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs @@ -11,19 +11,16 @@ namespace Microsoft.Framework.DependencyInjection { public static IServiceCollection AddSession([NotNull] this IServiceCollection services) { - return services.AddSession(configure: null); + services.AddOptions(); + services.AddTransient(); + return services; } - public static IServiceCollection AddSession([NotNull] this IServiceCollection services, Action configure) + public static void ConfigureSession( + [NotNull] this IServiceCollection services, + [NotNull] Action configure) { - services.AddTransient(); - - if (configure != null) - { - services.Configure(configure); - } - - return services; + services.Configure(configure); } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 105688d976..ae15b0040f 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -2,10 +2,11 @@ "version": "1.0.0-*", "description": "ASP.NET 5 session state middleware.", "dependencies": { - "Microsoft.AspNet.Http.Extensions": "1.0.0-*", - "Microsoft.Framework.Caching.Memory": "1.0.0-*", + "Microsoft.AspNet.Http.Abstractions": "1.0.0-*", + "Microsoft.Framework.Caching.Abstractions": "1.0.0-*", "Microsoft.Framework.Logging.Abstractions": "1.0.0-*", - "Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" } + "Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }, + "Microsoft.Framework.OptionsModel": "1.0.0-*" }, "compilationOptions": { "allowUnsafe": true diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 542ac0afd8..58e42c592a 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -8,6 +8,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; +using Microsoft.AspNet.Session; using Microsoft.AspNet.TestHost; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; @@ -24,14 +25,19 @@ namespace Microsoft.AspNet.Session { using (var server = TestServer.Create(app => { - app.UseInMemorySession(); + app.UseSession(); + app.Run(context => { Assert.Null(context.Session.GetString("NotFound")); return Task.FromResult(0); }); }, - services => services.AddOptions())) + services => + { + services.AddCaching(); + services.AddSession(); + })) { var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); @@ -46,7 +52,7 @@ namespace Microsoft.AspNet.Session { using (var server = TestServer.Create(app => { - app.UseInMemorySession(); + app.UseSession(); app.Run(context => { Assert.Null(context.Session.GetString("Key")); @@ -55,7 +61,11 @@ namespace Microsoft.AspNet.Session return Task.FromResult(0); }); }, - services => services.AddOptions())) + services => + { + services.AddCaching(); + services.AddSession(); + })) { var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); @@ -72,7 +82,7 @@ namespace Microsoft.AspNet.Session { using (var server = TestServer.Create(app => { - app.UseInMemorySession(); + app.UseSession(); app.Run(context => { int? value = context.Session.GetInt32("Key"); @@ -86,7 +96,11 @@ namespace Microsoft.AspNet.Session return context.Response.WriteAsync(value.Value.ToString()); }); }, - services => services.AddOptions())) + services => + { + services.AddCaching(); + services.AddSession(); + })) { var client = server.CreateClient(); var response = await client.GetAsync("first"); @@ -107,7 +121,7 @@ namespace Microsoft.AspNet.Session { using (var server = TestServer.Create(app => { - app.UseInMemorySession(); + app.UseSession(); app.Run(context => { int? value = context.Session.GetInt32("Key"); @@ -131,7 +145,11 @@ namespace Microsoft.AspNet.Session return context.Response.WriteAsync(value.Value.ToString()); }); }, - services => services.AddOptions())) + services => + { + services.AddCaching(); + services.AddSession(); + })) { var client = server.CreateClient(); var response = await client.GetAsync("first"); @@ -151,7 +169,7 @@ namespace Microsoft.AspNet.Session { using (var server = TestServer.Create(app => { - app.UseInMemorySession(); + app.UseSession(); app.Run(context => { int? value = context.Session.GetInt32("Key"); @@ -175,7 +193,11 @@ namespace Microsoft.AspNet.Session return context.Response.WriteAsync(value.Value.ToString()); }); }, - services => services.AddOptions())) + services => + { + services.AddCaching(); + services.AddSession(); + })) { var client = server.CreateClient(); var response = await client.GetAsync("first"); @@ -197,7 +219,7 @@ namespace Microsoft.AspNet.Session var loggerFactory = new TestLoggerFactory(sink, enabled: true); using (var server = TestServer.Create(app => { - app.UseInMemorySession(); + app.UseSession(); app.Run(context => { context.Session.SetString("Key", "Value"); @@ -206,8 +228,9 @@ namespace Microsoft.AspNet.Session }, services => { - services.AddOptions(); services.AddInstance(typeof(ILoggerFactory), loggerFactory); + services.AddCaching(); + services.AddSession(); })) { var client = server.CreateClient(); @@ -226,9 +249,7 @@ namespace Microsoft.AspNet.Session var loggerFactory = new TestLoggerFactory(sink, enabled: true); using (var server = TestServer.Create(app => { - app.UseInMemorySession(configure: o => { - o.IdleTimeout = TimeSpan.FromMilliseconds(30); - }); + app.UseSession(); app.Run(context => { int? value = context.Session.GetInt32("Key"); @@ -248,8 +269,10 @@ namespace Microsoft.AspNet.Session }, services => { - services.AddOptions(); services.AddInstance(typeof(ILoggerFactory), loggerFactory); + services.AddCaching(); + services.AddSession(); + services.ConfigureSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30)); })) { var client = server.CreateClient(); diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json index cd31e837c8..658662375c 100644 --- a/test/Microsoft.AspNet.Session.Tests/project.json +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -1,14 +1,15 @@ { - "dependencies": { - "Microsoft.AspNet.Session": "1.0.0-*", - "Microsoft.AspNet.TestHost": "1.0.0-*", - "Microsoft.Framework.Logging.Testing": "1.0.0-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" - }, - "commands": { - "test": "xunit.runner.aspnet" - }, - "frameworks": { - "dnx451": {} - } + "dependencies": { + "Microsoft.AspNet.Session": "1.0.0-*", + "Microsoft.AspNet.TestHost": "1.0.0-*", + "Microsoft.Framework.Caching.Memory": "1.0.0-*", + "Microsoft.Framework.Logging.Testing": "1.0.0-*", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + }, + "commands": { + "test": "xunit.runner.aspnet" + }, + "frameworks": { + "dnx451": { } + } } From e9d406e2f71a2720c0d990a2cb809e156a465ca2 Mon Sep 17 00:00:00 2001 From: Chris R Date: Fri, 12 Jun 2015 15:58:15 -0700 Subject: [PATCH 048/295] React to OnSendingHeaders rename. --- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 3496de13b3..57c1d8f5b9 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -92,10 +92,10 @@ namespace Microsoft.AspNet.Session _context = context; _sessionKey = sessionKey; _options = options; - context.Response.OnSendingHeaders(OnSendingHeadersCallback, state: this); + context.Response.OnResponseStarting(OnResponseStartingCallback, state: this); } - private static void OnSendingHeadersCallback(object state) + private static void OnResponseStartingCallback(object state) { var establisher = (SessionEstablisher)state; if (establisher._shouldEstablishSession) @@ -131,7 +131,7 @@ namespace Microsoft.AspNet.Session // Returns true if the session has already been established, or if it still can be because the response has not been sent. internal bool TryEstablishSession() { - return (_shouldEstablishSession |= !_context.Response.HeadersSent); + return (_shouldEstablishSession |= !_context.Response.HasStarted); } } } From 2e86becbbee6d6c80fa60a83aec200b5293f0a8b Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Sun, 21 Jun 2015 00:40:22 +0300 Subject: [PATCH 049/295] Add AppVeyor, Travis build status --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a59b2e1fe0..dd3834dc91 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ Session ================ +AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/m1l7adh2cwv488dt/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/Session/branch/dev) + +Travis: [![Travis](https://travis-ci.org/aspnet/Session.svg?branch=dev)](https://travis-ci.org/aspnet/Session) + Contains libraries for session state middleware for ASP.NET 5. This project is part of ASP.NET 5. You can find samples, documentation and getting started instructions for ASP.NET 5 at the [Home](https://github.com/aspnet/home) repo. From 61d7a830db8cc0cb749c799f752487e87f6815b2 Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Mon, 22 Jun 2015 21:33:00 +0300 Subject: [PATCH 050/295] Fix AppVeyor token --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd3834dc91..3d30bf1251 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Session ================ -AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/m1l7adh2cwv488dt/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/Session/branch/dev) +AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/yyivj6uwu3uj2x40/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/Session/branch/dev) Travis: [![Travis](https://travis-ci.org/aspnet/Session.svg?branch=dev)](https://travis-ci.org/aspnet/Session) From c858e3bfcd268807a1b73afaf4d78162bb0d461b Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Tue, 23 Jun 2015 11:06:44 -0700 Subject: [PATCH 051/295] Change hardcoded `bash` shebang to `env` - aspnet/Home#695 - support various `bash` installation locations - in particular, enable building on FreeBSD --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index d81164353c..3ef874f9bd 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if test `uname` = Darwin; then cachedir=~/Library/Caches/KBuild From 9ce60218c1e9ccc8f138241740396746c46a3221 Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Mon, 22 Jun 2015 20:39:50 +0300 Subject: [PATCH 052/295] Make 'SessionDefaults' fields as Constants --- src/Microsoft.AspNet.Session/SessionDefaults.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionDefaults.cs b/src/Microsoft.AspNet.Session/SessionDefaults.cs index 016eb77128..a498ca8e6e 100644 --- a/src/Microsoft.AspNet.Session/SessionDefaults.cs +++ b/src/Microsoft.AspNet.Session/SessionDefaults.cs @@ -7,7 +7,7 @@ namespace Microsoft.AspNet.Session { public static class SessionDefaults { - public static string CookieName = ".AspNet.Session"; - public static string CookiePath = "/"; + public static readonly string CookieName = ".AspNet.Session"; + public static readonly string CookiePath = "/"; } } \ No newline at end of file From bbc7393d221ab2c37ea1fbdc1100d99b8f8f2e72 Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Thu, 25 Jun 2015 05:43:06 +0300 Subject: [PATCH 053/295] Fix docs in 'SessionOptions' --- src/Microsoft.AspNet.Session/SessionOptions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionOptions.cs b/src/Microsoft.AspNet.Session/SessionOptions.cs index f309fb0401..a1043ff530 100644 --- a/src/Microsoft.AspNet.Session/SessionOptions.cs +++ b/src/Microsoft.AspNet.Session/SessionOptions.cs @@ -8,7 +8,8 @@ namespace Microsoft.AspNet.Session public class SessionOptions { /// - /// Determines the cookie name used to persist the session ID. The default value is ".AspNet.Session". + /// Determines the cookie name used to persist the session ID. + /// Defaults to . /// public string CookieName { get; set; } = SessionDefaults.CookieName; @@ -18,7 +19,8 @@ namespace Microsoft.AspNet.Session public string CookieDomain { get; set; } /// - /// Determines the path used to create the cookie. The default value is "/" for highest browser compatibility. + /// Determines the path used to create the cookie. + /// Defaults to . /// public string CookiePath { get; set; } = SessionDefaults.CookiePath; From 32ecf485b9cd6bf1f24b98eb15e3b959f3d80ca1 Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Thu, 25 Jun 2015 20:21:58 +0300 Subject: [PATCH 054/295] Add 'SessionDefaults' docs & react to PR #36 changes Grammatical fixes --- src/Microsoft.AspNet.Session/SessionDefaults.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Microsoft.AspNet.Session/SessionDefaults.cs b/src/Microsoft.AspNet.Session/SessionDefaults.cs index a498ca8e6e..0fc76225ee 100644 --- a/src/Microsoft.AspNet.Session/SessionDefaults.cs +++ b/src/Microsoft.AspNet.Session/SessionDefaults.cs @@ -5,9 +5,19 @@ using System; namespace Microsoft.AspNet.Session { + /// + /// Represents defaults for the Session. + /// public static class SessionDefaults { + /// + /// Represent the default cookie name, which is ".AspNet.Session". + /// public static readonly string CookieName = ".AspNet.Session"; + + /// + /// Represents the default path used to create the cookie, which is "/". + /// public static readonly string CookiePath = "/"; } } \ No newline at end of file From 086b53d21d609d05587f1c29e804ec2911715636 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 25 Jun 2015 17:05:57 -0700 Subject: [PATCH 055/295] React to OnStarting rename --- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 57c1d8f5b9..2735aa0126 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -92,16 +92,17 @@ namespace Microsoft.AspNet.Session _context = context; _sessionKey = sessionKey; _options = options; - context.Response.OnResponseStarting(OnResponseStartingCallback, state: this); + context.Response.OnStarting(OnStartingCallback, state: this); } - private static void OnResponseStartingCallback(object state) + private static Task OnStartingCallback(object state) { var establisher = (SessionEstablisher)state; if (establisher._shouldEstablishSession) { establisher.SetCookie(); } + return Task.FromResult(0); } private void SetCookie() From e6afe46edca09b23320957ed6224ce00a3e081b8 Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Fri, 26 Jun 2015 04:05:55 +0300 Subject: [PATCH 056/295] SessionServiceCollection docs --- .../SessionServiceCollectionExtensions.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs index 2fd488820d..6e9e57d274 100644 --- a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs @@ -7,8 +7,16 @@ using Microsoft.Framework.Internal; namespace Microsoft.Framework.DependencyInjection { + /// + /// Extension methods for adding session servics to the DI container. + /// public static class SessionServiceCollectionExtensions { + /// + /// Adds services required for application session. + /// + /// The to add the services to. + /// The . public static IServiceCollection AddSession([NotNull] this IServiceCollection services) { services.AddOptions(); @@ -16,6 +24,11 @@ namespace Microsoft.Framework.DependencyInjection return services; } + /// + /// Configures the session. + /// + /// The to configure the services. + /// The session options to configure the middleware with. public static void ConfigureSession( [NotNull] this IServiceCollection services, [NotNull] Action configure) From 93490c4750d309d3a07371feade904cdc6b4c7d2 Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Fri, 26 Jun 2015 04:06:03 +0300 Subject: [PATCH 057/295] SessionMiddleware docs Fix docs for SessionMiddleware Fix typos Fix docs --- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 15 +++++++++++++++ .../SessionMiddlewareExtensions.cs | 8 ++++++++ .../SessionServiceCollectionExtensions.cs | 4 ++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 57c1d8f5b9..da20fb3cbb 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -15,6 +15,9 @@ using Microsoft.Framework.OptionsModel; namespace Microsoft.AspNet.Session { + /// + /// Enables the session state for the application. + /// public class SessionMiddleware { private static readonly RandomNumberGenerator CryptoRandom = RandomNumberGenerator.Create(); @@ -25,6 +28,13 @@ namespace Microsoft.AspNet.Session private readonly ILogger _logger; private readonly ISessionStore _sessionStore; + /// + /// Creates a new . + /// + /// The representing the next middleware in the pipeline. + /// The representing the factory that used to create logger instances. + /// The representing the session store. + /// The session configuration options. public SessionMiddleware( [NotNull] RequestDelegate next, [NotNull] ILoggerFactory loggerFactory, @@ -38,6 +48,11 @@ namespace Microsoft.AspNet.Session _sessionStore.Connect(); } + /// + /// Invokes the logic of the middleware. + /// + /// The . + /// A that completes when the middleware has completed processing. public async Task Invoke(HttpContext context) { var isNewSessionKey = false; diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs index 89273bc2fc..d4a2e322f9 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs @@ -6,8 +6,16 @@ using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Builder { + /// + /// Extension methods for adding the to an application. + /// public static class SessionMiddlewareExtensions { + /// + /// Adds the to automatically enable session state for the application. + /// + /// The . + /// The . public static IApplicationBuilder UseSession([NotNull] this IApplicationBuilder app) { return app.UseMiddleware(); diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs index 6e9e57d274..04f73dbd41 100644 --- a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs @@ -8,12 +8,12 @@ using Microsoft.Framework.Internal; namespace Microsoft.Framework.DependencyInjection { /// - /// Extension methods for adding session servics to the DI container. + /// Extension methods for adding session services to the DI container. /// public static class SessionServiceCollectionExtensions { /// - /// Adds services required for application session. + /// Adds services required for application session state. /// /// The to add the services to. /// The . From 081eb5e2557881af6e59e74acabbdf36214997ff Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Tue, 30 Jun 2015 09:04:54 +0300 Subject: [PATCH 058/295] Add missing doc for 'SessionOptions' --- src/Microsoft.AspNet.Session/SessionOptions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Microsoft.AspNet.Session/SessionOptions.cs b/src/Microsoft.AspNet.Session/SessionOptions.cs index a1043ff530..edc83b2f93 100644 --- a/src/Microsoft.AspNet.Session/SessionOptions.cs +++ b/src/Microsoft.AspNet.Session/SessionOptions.cs @@ -5,6 +5,9 @@ using System; namespace Microsoft.AspNet.Session { + /// + /// Represents the session state options for the application. + /// public class SessionOptions { /// From d88071e39d30b832259a7b064105110925095fbd Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Tue, 30 Jun 2015 09:52:25 +0300 Subject: [PATCH 059/295] Remove unnecessary 'using' --- src/Microsoft.AspNet.Session/SessionDefaults.cs | 2 -- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 2 -- src/Microsoft.AspNet.Session/SipHash.cs | 2 -- 3 files changed, 6 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionDefaults.cs b/src/Microsoft.AspNet.Session/SessionDefaults.cs index 0fc76225ee..1fb6859cab 100644 --- a/src/Microsoft.AspNet.Session/SessionDefaults.cs +++ b/src/Microsoft.AspNet.Session/SessionDefaults.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; - namespace Microsoft.AspNet.Session { /// diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index dffbe01b76..9dee803d72 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -2,8 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; -using System.Linq; using System.Security.Cryptography; using System.Threading.Tasks; using Microsoft.AspNet.Builder; diff --git a/src/Microsoft.AspNet.Session/SipHash.cs b/src/Microsoft.AspNet.Session/SipHash.cs index 219194f6ab..18afddf1e9 100644 --- a/src/Microsoft.AspNet.Session/SipHash.cs +++ b/src/Microsoft.AspNet.Session/SipHash.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; - namespace Microsoft.AspNet.Session { // A byte[] equality comparer based on the SipHash-2-4 algorithm. Key differences: From 5531b21d947d70a43e621835e6052d74c6294553 Mon Sep 17 00:00:00 2001 From: Victor Hurdugaci Date: Wed, 1 Jul 2015 20:26:10 -0700 Subject: [PATCH 060/295] Add repository information to project files --- src/Microsoft.AspNet.Session/project.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index ae15b0040f..00d1332f01 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -1,6 +1,10 @@ { "version": "1.0.0-*", "description": "ASP.NET 5 session state middleware.", + "repository": { + "type": "git", + "url": "git://github.com/aspnet/session" + }, "dependencies": { "Microsoft.AspNet.Http.Abstractions": "1.0.0-*", "Microsoft.Framework.Caching.Abstractions": "1.0.0-*", From d9b136e20d9709fd2f801ce57aee75bbaa0d3236 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Thu, 2 Jul 2015 09:44:07 -0700 Subject: [PATCH 061/295] 'Refresh' the session even when its not accessed in current request #41 --- .../DistributedSession.cs | 4 + .../SessionTests.cs | 75 ++++++++++++++++++- 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index 36ecb7d49a..b8cd99cfb3 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -134,6 +134,10 @@ namespace Microsoft.AspNet.Session stream.ToArray(), new DistributedCacheEntryOptions().SetSlidingExpiration(_idleTimeout)); } + else + { + await _cache.RefreshAsync(_sessionId); + } } // Format: diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 58e42c592a..0f8db4bb4d 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -8,9 +8,10 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; -using Microsoft.AspNet.Session; using Microsoft.AspNet.TestHost; +using Microsoft.Framework.Caching.Memory; using Microsoft.Framework.DependencyInjection; +using Microsoft.Framework.Internal; using Microsoft.Framework.Logging; using Microsoft.Framework.Logging.Testing; using Microsoft.Net.Http.Headers; @@ -291,5 +292,77 @@ namespace Microsoft.AspNet.Session Assert.Equal(LogLevel.Warning, sink.Writes[1].LogLevel); } } + + [Fact] + public async Task RefreshesSession_WhenSessionData_IsNotModified() + { + var clock = new TestClock(); + using (var server = TestServer.Create(app => + { + app.UseSession(); + app.Run(context => + { + string responseData = string.Empty; + if (context.Request.Path == new PathString("/AddDataToSession")) + { + context.Session.SetInt32("Key", 10); + responseData = "added data to session"; + } + else if (context.Request.Path == new PathString("/AccessSessionData")) + { + var value = context.Session.GetInt32("Key"); + responseData = (value == null) ? "No value found in session." : value.ToString(); + } + else if (context.Request.Path == new PathString("/DoNotAccessSessionData")) + { + responseData = "did not access session data"; + } + + return context.Response.WriteAsync(responseData); + }); + }, + services => + { + services.AddInstance(typeof(ILoggerFactory), new NullLoggerFactory()); + services.AddCaching(); + services.AddSession(); + services.ConfigureSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20)); + services.Configure(o => o.Clock = clock); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync("AddDataToSession"); + response.EnsureSuccessStatusCode(); + + client = server.CreateClient(); + var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First(); + client.DefaultRequestHeaders.Add( + "Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); + + for (var i = 0; i < 5; i++) + { + clock.Add(TimeSpan.FromMinutes(10)); + await client.GetStringAsync("/DoNotAccessSessionData"); + } + + var data = await client.GetStringAsync("/AccessSessionData"); + Assert.Equal("10", data); + } + } + + private class TestClock : ISystemClock + { + public TestClock() + { + UtcNow = new DateTimeOffset(2013, 1, 1, 1, 0, 0, TimeSpan.Zero); + } + + public DateTimeOffset UtcNow { get; private set; } + + public void Add(TimeSpan timespan) + { + UtcNow = UtcNow.Add(timespan); + } + } } } \ No newline at end of file From 76028af354e09682a0cd47462194dc8e9c022e31 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Tue, 7 Jul 2015 13:53:45 -0700 Subject: [PATCH 062/295] Added wwwroot folder --- samples/SessionSample/wwwroot/Readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 samples/SessionSample/wwwroot/Readme.md diff --git a/samples/SessionSample/wwwroot/Readme.md b/samples/SessionSample/wwwroot/Readme.md new file mode 100644 index 0000000000..e65d8d9d2c --- /dev/null +++ b/samples/SessionSample/wwwroot/Readme.md @@ -0,0 +1 @@ +Sample demonstrating ASP.NET 5 Session middleware. \ No newline at end of file From 28dfa0f0c42a926b9666d29d3bb2110b9ff30738 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Wed, 10 Jun 2015 15:59:48 -0700 Subject: [PATCH 063/295] Added SQL Server Cache to the sample. --- samples/SessionSample/Startup.cs | 12 +++++++++++- samples/SessionSample/project.json | 16 ++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 0eaa898719..38ff8d73f6 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -4,6 +4,7 @@ using System; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; +using Microsoft.Framework.Caching.Distributed; using Microsoft.Framework.Caching.Redis; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; @@ -26,11 +27,20 @@ namespace SessionSample // This will override any previously registered IDistributedCache service. //services.AddTransient(); + // Uncomment the following line to use the Microsoft SQL Server implementation of IDistributedCache. + // Note that this would require setting up the session state database. + // This will override any previously registered IDistributedCache service. + //services.AddSqlServerCache(o => + //{ + // o.ConnectionString = "Server=.;Database=ASPNET5SessionState;Trusted_Connection=True;"; + // o.TableName = "Sessions"; + //}); + services.AddSession(); services.ConfigureSession(o => { - o.IdleTimeout = TimeSpan.FromSeconds(30); + o.IdleTimeout = TimeSpan.FromSeconds(10); }); } diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index cf9b17c4b3..4c090e0f1e 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -1,16 +1,20 @@ { - "webroot": "wwwroot", - "exclude": "wwwroot/**/*.*", + "commands": { + "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", + "install-sqlservercache": "Microsoft.Framework.Caching.SqlServer" + }, "dependencies": { "Microsoft.AspNet.Server.IIS": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.Session": "1.0.0-*", "Microsoft.Framework.Caching.Memory": "1.0.0-*", "Microsoft.Framework.Caching.Redis": "1.0.0-*", + "Microsoft.Framework.Caching.SqlServer": "1.0.0-*", "Microsoft.Framework.Logging.Console": "1.0.0-*" }, - "commands": { "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, - "frameworks" : { - "dnx451" : { } - } + "exclude": "wwwroot/**/*.*", + "frameworks": { + "dnx451": { } + }, + "webroot": "wwwroot" } From 64fa05dbaf569f0867ea8a2fbc3a79b9e2d8b916 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 16 Jul 2015 09:02:12 -0700 Subject: [PATCH 064/295] Updating to release NuGet.config --- NuGet.Config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index da57d47267..0e74a4912d 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -1,7 +1,8 @@  - + + - \ No newline at end of file + From 0d78bdbef253272368bc7625cb9ebbe3e525752a Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Fri, 17 Jul 2015 10:29:03 -0700 Subject: [PATCH 065/295] Fixed sample and instructions --- samples/SessionSample/Startup.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 38ff8d73f6..785005de35 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -20,21 +20,21 @@ namespace SessionSample public void ConfigureServices(IServiceCollection services) { - // Adds a default in-memory implementation of IDistributedCache - services.AddCaching(); + // Uncomment the following line to use the Microsoft SQL Server implementation of IDistributedCache. + // Note that this would require setting up the session state database. + //services.AddSqlServerCache(o => + //{ + // o.ConnectionString = "Server=.;Database=ASPNET5SessionState;Trusted_Connection=True;"; + // o.SchemaName = "dbo"; + // o.TableName = "Sessions"; + //}); // Uncomment the following line to use the Redis implementation of IDistributedCache. // This will override any previously registered IDistributedCache service. //services.AddTransient(); - // Uncomment the following line to use the Microsoft SQL Server implementation of IDistributedCache. - // Note that this would require setting up the session state database. - // This will override any previously registered IDistributedCache service. - //services.AddSqlServerCache(o => - //{ - // o.ConnectionString = "Server=.;Database=ASPNET5SessionState;Trusted_Connection=True;"; - // o.TableName = "Sessions"; - //}); + // Adds a default in-memory implementation of IDistributedCache + services.AddCaching(); services.AddSession(); From 20bd4c799e827e893052eb9198da7ec7fabcdd02 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Wed, 8 Jul 2015 09:58:38 -0700 Subject: [PATCH 066/295] Added unit tests --- .../SessionTests.cs | 178 ++++++++++++++++++ 1 file changed, 178 insertions(+) diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 0f8db4bb4d..7e24138513 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -4,11 +4,14 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.TestHost; +using Microsoft.Framework.Caching.Distributed; using Microsoft.Framework.Caching.Memory; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; @@ -350,6 +353,128 @@ namespace Microsoft.AspNet.Session } } + [Fact] + public async Task SessionFeature_IsUnregistered_WhenResponseGoingOut() + { + using (var server = TestServer.Create(app => + { + app.Use(async (httpContext, next) => + { + await next(); + + Assert.Null(httpContext.GetFeature()); + }); + + app.UseSession(); + + app.Run(context => + { + context.Session.SetString("key", "value"); + return Task.FromResult(0); + }); + }, + services => + { + services.AddCaching(); + services.AddSession(); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + response.EnsureSuccessStatusCode(); + } + } + + [Fact] + public async Task SessionFeature_IsUnregistered_WhenResponseGoingOut_AndAnUnhandledExcetionIsThrown() + { + using (var server = TestServer.Create(app => + { + app.Use(async (httpContext, next) => + { + var exceptionThrown = false; + try + { + await next(); + } + catch + { + exceptionThrown = true; + } + + Assert.True(exceptionThrown); + Assert.Null(httpContext.GetFeature()); + }); + + app.UseSession(); + + app.Run(context => + { + throw new InvalidOperationException("An error occurred."); + }); + }, + services => + { + services.AddCaching(); + services.AddSession(); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + } + } + + [Fact] + public async Task SessionMiddleware_DoesNotStart_IfUnderlyingStoreIsUnavailable() + { + // Arrange, Act & Assert + var exception = await Assert.ThrowsAsync(async () => + { + using (var server = TestServer.Create(app => + { + app.UseSession(); + }, + services => + { + services.AddSingleton(); + services.AddSession(); + })) + { + var client = server.CreateClient(); + await client.GetAsync(string.Empty); + } + }); + + Assert.Equal("Error connecting database.", exception.Message); + } + + [Fact] + public async Task SessionKeys_AreCaseSensitive() + { + using (var server = TestServer.Create(app => + { + app.UseSession(); + app.Run(context => + { + context.Session.SetString("KEY", "VALUE"); + context.Session.SetString("key", "value"); + Assert.Equal("VALUE", context.Session.GetString("KEY")); + Assert.Equal("value", context.Session.GetString("key")); + return Task.FromResult(0); + }); + }, + services => + { + services.AddCaching(); + services.AddSession(); + })) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + response.EnsureSuccessStatusCode(); + } + } + private class TestClock : ISystemClock { public TestClock() @@ -364,5 +489,58 @@ namespace Microsoft.AspNet.Session UtcNow = UtcNow.Add(timespan); } } + + private class TestDistributedCache : IDistributedCache + { + public void Connect() + { + throw new InvalidOperationException("Error connecting database."); + } + + public Task ConnectAsync() + { + throw new InvalidOperationException("Error connecting database."); + } + + public byte[] Get(string key) + { + throw new NotImplementedException(); + } + + public Task GetAsync(string key) + { + throw new NotImplementedException(); + } + + public void Refresh(string key) + { + throw new NotImplementedException(); + } + + public Task RefreshAsync(string key) + { + throw new NotImplementedException(); + } + + public void Remove(string key) + { + throw new NotImplementedException(); + } + + public Task RemoveAsync(string key) + { + throw new NotImplementedException(); + } + + public void Set(string key, byte[] value, DistributedCacheEntryOptions options) + { + throw new NotImplementedException(); + } + + public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options) + { + throw new NotImplementedException(); + } + } } } \ No newline at end of file From 9c099bc057fadbbae9be8cb1c9985cf6537266f5 Mon Sep 17 00:00:00 2001 From: Hisham Abdullah Bin Ateya Date: Sat, 18 Jul 2015 00:52:39 +0300 Subject: [PATCH 067/295] Remove unused dnx command --- samples/SessionSample/project.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 4c090e0f1e..b85cd3f507 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -1,7 +1,6 @@ { "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "install-sqlservercache": "Microsoft.Framework.Caching.SqlServer" + "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, "dependencies": { "Microsoft.AspNet.Server.IIS": "1.0.0-*", From 80150ec3a6d5d9fbb96277514ecf91edae393e0d Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Mon, 3 Aug 2015 16:41:13 -0700 Subject: [PATCH 068/295] Changed SessionSample's registratio of RedisCache service from Transient to Singleton --- samples/SessionSample/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 785005de35..79d0d54eda 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -31,7 +31,7 @@ namespace SessionSample // Uncomment the following line to use the Redis implementation of IDistributedCache. // This will override any previously registered IDistributedCache service. - //services.AddTransient(); + //services.AddSingleton(); // Adds a default in-memory implementation of IDistributedCache services.AddCaching(); From f0d989782f4c33a8b110c2603ec5fb03eae5bc07 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Wed, 12 Aug 2015 05:41:58 -0700 Subject: [PATCH 069/295] Enable pinning build script --- build.cmd | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/build.cmd b/build.cmd index 41025afb26..ccf195aee8 100644 --- a/build.cmd +++ b/build.cmd @@ -3,6 +3,8 @@ cd %~dp0 SETLOCAL SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe +SET BUILDCMD_KOREBUILD_VERSION="" +SET BUILDCMD_DNX_VERSION="" IF EXIST %CACHED_NUGET% goto copynuget echo Downloading latest version of NuGet.exe... @@ -16,13 +18,21 @@ copy %CACHED_NUGET% .nuget\nuget.exe > nul :restore IF EXIST packages\KoreBuild goto run -.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre +IF %BUILDCMD_KOREBUILD_VERSION%=="" ( + .nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre +) ELSE ( + .nuget\NuGet.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre +) .nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion IF "%SKIP_DNX_INSTALL%"=="1" goto run -CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86 +IF %BUILDCMD_DNX_VERSION%=="" ( + CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86 +) ELSE ( + CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CLR -arch x86 -a default +) CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86 :run CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86 -packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* +packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* \ No newline at end of file From fc7224a63989d6cb32239c2478b5ee6ed4a16f96 Mon Sep 17 00:00:00 2001 From: Chris R Date: Thu, 13 Aug 2015 09:50:17 -0700 Subject: [PATCH 070/295] #54 React to CoreCLR Cryptography package changes. --- src/Microsoft.AspNet.Session/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 00d1332f01..41b911dc92 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -19,7 +19,7 @@ "dnx451": { }, "dnxcore50": { "dependencies": { - "System.Security.Cryptography.RandomNumberGenerator": "4.0.0-beta-*" + "System.Security.Cryptography.Algorithms": "4.0.0-beta-*" } } } From e0d60f754915831e940e0bd8c445c4472f601943 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 17 Aug 2015 14:49:30 -0700 Subject: [PATCH 071/295] Updating to release NuGet.config. --- NuGet.Config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index da57d47267..3b8d545754 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -1,7 +1,7 @@ - + - + \ No newline at end of file From b57640612a82af01c712738f0ac47d836ceec4d2 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 18 Aug 2015 14:00:27 -0700 Subject: [PATCH 072/295] Updating to aspnetliterelease. --- NuGet.Config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.Config b/NuGet.Config index 3b8d545754..e2378fe359 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -1,7 +1,7 @@ - + \ No newline at end of file From 523d28e6b6bdb1202c73182f97790ab88a957474 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 18 Aug 2015 14:00:27 -0700 Subject: [PATCH 073/295] Updating to aspnetlitedev. --- NuGet.Config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index da57d47267..6685c5330a 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -1,7 +1,7 @@ - + - + \ No newline at end of file From 529be5cf965c49a4c0a6b0f84c88c858ad41e921 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Wed, 19 Aug 2015 14:55:16 -0700 Subject: [PATCH 074/295] Update NuGet feed from v2 => v3. --- NuGet.Config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.Config b/NuGet.Config index 6685c5330a..10cec18a32 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -2,6 +2,6 @@ - + \ No newline at end of file From 871def4dc15ba2a9a0c0217040183efe9cc73fb4 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 20 Aug 2015 15:38:40 -0700 Subject: [PATCH 075/295] Update 'build.cmd' to pull Sake from v2 NuGet feed. --- build.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cmd b/build.cmd index ccf195aee8..b54d91cf74 100644 --- a/build.cmd +++ b/build.cmd @@ -23,7 +23,7 @@ IF %BUILDCMD_KOREBUILD_VERSION%=="" ( ) ELSE ( .nuget\NuGet.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre ) -.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion +.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages IF "%SKIP_DNX_INSTALL%"=="1" goto run IF %BUILDCMD_DNX_VERSION%=="" ( From 724027ac0231bacbcae24c908a75ee11aae3449a Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 20 Aug 2015 20:47:44 -0700 Subject: [PATCH 076/295] Update 'build.sh' to pull Sake from v2 NuGet feed. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 3ef874f9bd..68c3e8cb52 100755 --- a/build.sh +++ b/build.sh @@ -24,7 +24,7 @@ fi if test ! -d packages/KoreBuild; then mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre - mono .nuget/nuget.exe install Sake -version 0.2 -o packages -ExcludeVersion + mono .nuget/nuget.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages fi if ! type dnvm > /dev/null 2>&1; then From c8f918681a9224b56c975fdbb97451d7aced6f7d Mon Sep 17 00:00:00 2001 From: Chris R Date: Thu, 20 Aug 2015 13:54:07 -0700 Subject: [PATCH 077/295] React to string[] -> StringValue changes. --- .../SessionMiddleware.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 9dee803d72..4eeb183bd2 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -55,7 +55,7 @@ namespace Microsoft.AspNet.Session { var isNewSessionKey = false; Func tryEstablishSession = ReturnTrue; - var sessionKey = context.Request.Cookies.Get(_options.CookieName); + string sessionKey = context.Request.Cookies[_options.CookieName]; if (string.IsNullOrWhiteSpace(sessionKey) || sessionKey.Length != SessionKeyLength) { // No valid cookie, new session. @@ -129,17 +129,9 @@ namespace Microsoft.AspNet.Session _context.Response.Cookies.Append(_options.CookieName, _sessionKey, cookieOptions); - _context.Response.Headers.Set( - "Cache-Control", - "no-cache"); - - _context.Response.Headers.Set( - "Pragma", - "no-cache"); - - _context.Response.Headers.Set( - "Expires", - "-1"); + _context.Response.Headers["Cache-Control"] = "no-cache"; + _context.Response.Headers["Pragma"] = "no-cache"; + _context.Response.Headers["Expires"] = "-1"; } // Returns true if the session has already been established, or if it still can be because the response has not been sent. From 06392be333666aefb730cd790201e52c343509c5 Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 31 Aug 2015 09:35:08 -0700 Subject: [PATCH 078/295] Use new HttpContext.Features API. --- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 4 ++-- test/Microsoft.AspNet.Session.Tests/SessionTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 4eeb183bd2..84844648a1 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -69,7 +69,7 @@ namespace Microsoft.AspNet.Session var feature = new SessionFeature(); feature.Session = _sessionStore.Create(sessionKey, _options.IdleTimeout, tryEstablishSession, isNewSessionKey); - context.SetFeature(feature); + context.Features.Set(feature); try { @@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Session } finally { - context.SetFeature(null); + context.Features.Set(null); if (feature.Session != null) { diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 7e24138513..1b2550e0e3 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -362,7 +362,7 @@ namespace Microsoft.AspNet.Session { await next(); - Assert.Null(httpContext.GetFeature()); + Assert.Null(httpContext.Features.Get()); }); app.UseSession(); @@ -403,7 +403,7 @@ namespace Microsoft.AspNet.Session } Assert.True(exceptionThrown); - Assert.Null(httpContext.GetFeature()); + Assert.Null(httpContext.Features.Get()); }); app.UseSession(); From a6169c628ff474794ad106a2e9b405bad6f64626 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Wed, 2 Sep 2015 14:22:36 -0700 Subject: [PATCH 079/295] React to options --- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 84844648a1..5215ffa830 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -41,7 +41,7 @@ namespace Microsoft.AspNet.Session { _next = next; _logger = loggerFactory.CreateLogger(); - _options = options.Options; + _options = options.Value; _sessionStore = sessionStore; _sessionStore.Connect(); } From dfaf6bb2ffc64b0edbac84e08b2aead0d6a2a7a2 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 10 Sep 2015 18:34:29 -0700 Subject: [PATCH 080/295] Adding NeutralResourcesLanguageAttribute --- src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs b/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs index 025a94598c..b2437d9ad6 100644 --- a/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs @@ -2,5 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Reflection; +using System.Resources; -[assembly: AssemblyMetadata("Serviceable", "True")] \ No newline at end of file +[assembly: AssemblyMetadata("Serviceable", "True")] +[assembly: NeutralResourcesLanguage("en-us")] \ No newline at end of file From 2bd83e15894ddfaff1f96a4e04488cba2424e690 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Fri, 11 Sep 2015 14:16:13 -0700 Subject: [PATCH 081/295] ConfigureSession => AddSession overload --- samples/SessionSample/Startup.cs | 4 +--- .../SessionServiceCollectionExtensions.cs | 10 +++++----- test/Microsoft.AspNet.Session.Tests/SessionTests.cs | 6 ++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 79d0d54eda..2a7bbfdc1e 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -36,9 +36,7 @@ namespace SessionSample // Adds a default in-memory implementation of IDistributedCache services.AddCaching(); - services.AddSession(); - - services.ConfigureSession(o => + services.AddSession(o => { o.IdleTimeout = TimeSpan.FromSeconds(10); }); diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs index 04f73dbd41..af253aaaac 100644 --- a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs @@ -25,15 +25,15 @@ namespace Microsoft.Framework.DependencyInjection } /// - /// Configures the session. + /// Adds services required for application session state. /// - /// The to configure the services. + /// The to add the services to. /// The session options to configure the middleware with. - public static void ConfigureSession( - [NotNull] this IServiceCollection services, - [NotNull] Action configure) + /// The . + public static IServiceCollection AddSession([NotNull] this IServiceCollection services, Action configure) { services.Configure(configure); + return services.AddSession(); } } } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 1b2550e0e3..af91a911ca 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -275,8 +275,7 @@ namespace Microsoft.AspNet.Session { services.AddInstance(typeof(ILoggerFactory), loggerFactory); services.AddCaching(); - services.AddSession(); - services.ConfigureSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30)); + services.AddSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30)); })) { var client = server.CreateClient(); @@ -328,8 +327,7 @@ namespace Microsoft.AspNet.Session { services.AddInstance(typeof(ILoggerFactory), new NullLoggerFactory()); services.AddCaching(); - services.AddSession(); - services.ConfigureSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20)); + services.AddSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20)); services.Configure(o => o.Clock = clock); })) { From c2a267b2dfd4852da09db25d4489962bc4da3464 Mon Sep 17 00:00:00 2001 From: Hisham Bin Ateya Date: Sun, 13 Sep 2015 02:10:04 +0300 Subject: [PATCH 082/295] Remove unnecessary 'Cache' usings --- samples/SessionSample/Startup.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 2a7bbfdc1e..6a60ec435e 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -4,8 +4,6 @@ using System; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; -using Microsoft.Framework.Caching.Distributed; -using Microsoft.Framework.Caching.Redis; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; From d7cba38dc8d60bf163903ba106d686b4db1ef066 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 17 Sep 2015 18:33:46 -0700 Subject: [PATCH 083/295] Update nuget.exe and corresponding feeds to v3. --- NuGet.Config => NuGet.config | 2 +- build.cmd | 11 ++++++----- build.sh | 12 +++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) rename NuGet.Config => NuGet.config (83%) diff --git a/NuGet.Config b/NuGet.config similarity index 83% rename from NuGet.Config rename to NuGet.config index 10cec18a32..1707938c61 100644 --- a/NuGet.Config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/build.cmd b/build.cmd index b54d91cf74..177997c42e 100644 --- a/build.cmd +++ b/build.cmd @@ -2,14 +2,15 @@ cd %~dp0 SETLOCAL -SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe +SET NUGET_VERSION=latest +SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe SET BUILDCMD_KOREBUILD_VERSION="" SET BUILDCMD_DNX_VERSION="" IF EXIST %CACHED_NUGET% goto copynuget echo Downloading latest version of NuGet.exe... IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet -@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'" +@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'" :copynuget IF EXIST .nuget\nuget.exe goto restore @@ -19,11 +20,11 @@ copy %CACHED_NUGET% .nuget\nuget.exe > nul :restore IF EXIST packages\KoreBuild goto run IF %BUILDCMD_KOREBUILD_VERSION%=="" ( - .nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre + .nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre ) ELSE ( - .nuget\NuGet.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre + .nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre ) -.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages +.nuget\nuget.exe install Sake -ExcludeVersion -Out packages IF "%SKIP_DNX_INSTALL%"=="1" goto run IF %BUILDCMD_DNX_VERSION%=="" ( diff --git a/build.sh b/build.sh index 68c3e8cb52..0c66139817 100755 --- a/build.sh +++ b/build.sh @@ -10,21 +10,23 @@ else fi fi mkdir -p $cachedir +nugetVersion=latest +cachePath=$cachedir/nuget.$nugetVersion.exe -url=https://www.nuget.org/nuget.exe +url=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe -if test ! -f $cachedir/nuget.exe; then - wget -O $cachedir/nuget.exe $url 2>/dev/null || curl -o $cachedir/nuget.exe --location $url /dev/null +if test ! -f $cachePath; then + wget -O $cachePath $url 2>/dev/null || curl -o $cachePath --location $url /dev/null fi if test ! -e .nuget; then mkdir .nuget - cp $cachedir/nuget.exe .nuget/nuget.exe + cp $cachePath .nuget/nuget.exe fi if test ! -d packages/KoreBuild; then mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre - mono .nuget/nuget.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages + mono .nuget/nuget.exe install Sake -ExcludeVersion -Out packages fi if ! type dnvm > /dev/null 2>&1; then From 20563b514f32049f8716b5041a258e92de48b8bb Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Wed, 23 Sep 2015 14:41:54 -0700 Subject: [PATCH 084/295] Enabling NuGetPackageVerifier --- NuGetPackageVerifier.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 NuGetPackageVerifier.json diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json new file mode 100644 index 0000000000..a925467083 --- /dev/null +++ b/NuGetPackageVerifier.json @@ -0,0 +1,25 @@ +{ + "adx": { // Packages written by the ADX team and that ship on NuGet.org + "rules": [ + "AssemblyHasDocumentFileRule", + "AssemblyHasVersionAttributesRule", + "AssemblyHasServicingAttributeRule", + "AssemblyHasNeutralResourcesLanguageAttributeRule", + "SatellitePackageRule", + "StrictSemanticVersionValidationRule" + ], + "packages": { + "Microsoft.AspNet.Session": { } + } + }, + "Default": { // Rules to run for packages not listed in any other set. + "rules": [ + "AssemblyHasDocumentFileRule", + "AssemblyHasVersionAttributesRule", + "AssemblyHasServicingAttributeRule", + "AssemblyHasNeutralResourcesLanguageAttributeRule", + "SatellitePackageRule", + "StrictSemanticVersionValidationRule" + ] + } +} \ No newline at end of file From ef48e4e29848335aef1cc8f011d7101a4f8e38f9 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 28 Sep 2015 23:16:17 -0700 Subject: [PATCH 085/295] Updating to release NuGet.config. --- NuGet.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index 1707938c61..9db87a421e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + \ No newline at end of file From 3503af2854ca25386779f2d29a5e1407a3141d40 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 1 Oct 2015 11:59:00 -0700 Subject: [PATCH 086/295] Update 'build.cmd' alias parameter to use full name. --- build.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cmd b/build.cmd index 177997c42e..70d974a61f 100644 --- a/build.cmd +++ b/build.cmd @@ -30,7 +30,7 @@ IF "%SKIP_DNX_INSTALL%"=="1" goto run IF %BUILDCMD_DNX_VERSION%=="" ( CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86 ) ELSE ( - CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CLR -arch x86 -a default + CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CLR -arch x86 -alias default ) CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86 From 786b1a466b726a9770280942dfbc15ca3d0b8501 Mon Sep 17 00:00:00 2001 From: Hisham Bin Ateya Date: Thu, 1 Oct 2015 10:00:45 +0300 Subject: [PATCH 087/295] Add exceptions messages to Resource file --- .../DistributedSession.cs | 10 +- .../Properties/Resources.Designer.cs | 110 ++++++++++++++ src/Microsoft.AspNet.Session/Resources.resx | 135 ++++++++++++++++++ 3 files changed, 250 insertions(+), 5 deletions(-) create mode 100644 src/Microsoft.AspNet.Session/Properties/Resources.Designer.cs create mode 100644 src/Microsoft.AspNet.Session/Resources.resx diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index b8cd99cfb3..dc78bb49a7 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -62,13 +62,13 @@ namespace Microsoft.AspNet.Session if (encodedKey.KeyBytes.Length > KeyLengthLimit) { throw new ArgumentOutOfRangeException(nameof(key), - string.Format("The key cannot be longer than '{0}' when encoded with UTF-8.", KeyLengthLimit)); + Resources.FormatException_KeyLengthIsExceeded(KeyLengthLimit)); } Load(); if (!_tryEstablishSession()) { - throw new InvalidOperationException("The session cannot be established after the response has started."); + throw new InvalidOperationException(Resources.Exception_InvalidSessionEstablishment); } _isModified = true; byte[] copy = new byte[value.Length]; @@ -187,7 +187,7 @@ namespace Microsoft.AspNet.Session { if (num < 0 || ushort.MaxValue < num) { - throw new ArgumentOutOfRangeException(nameof(num), "The value cannot be serialized in two bytes."); + throw new ArgumentOutOfRangeException(nameof(num), Resources.Exception_InvalidToSerializeIn2Bytes); } output.WriteByte((byte)(num >> 8)); output.WriteByte((byte)(0xFF & num)); @@ -202,7 +202,7 @@ namespace Microsoft.AspNet.Session { if (num < 0 || 0xFFFFFF < num) { - throw new ArgumentOutOfRangeException(nameof(num), "The value cannot be serialized in three bytes."); + throw new ArgumentOutOfRangeException(nameof(num), Resources.Exception_InvalidToSerializeIn3Bytes); } output.WriteByte((byte)(num >> 16)); output.WriteByte((byte)(0xFF & (num >> 8))); @@ -218,7 +218,7 @@ namespace Microsoft.AspNet.Session { if (num < 0) { - throw new ArgumentOutOfRangeException(nameof(num), "The value cannot be negative."); + throw new ArgumentOutOfRangeException(nameof(num), Resources.Exception_NumberShouldNotBeNegative); } output.WriteByte((byte)(num >> 24)); output.WriteByte((byte)(0xFF & (num >> 16))); diff --git a/src/Microsoft.AspNet.Session/Properties/Resources.Designer.cs b/src/Microsoft.AspNet.Session/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..e92a12995b --- /dev/null +++ b/src/Microsoft.AspNet.Session/Properties/Resources.Designer.cs @@ -0,0 +1,110 @@ +// +namespace Microsoft.AspNet.Session +{ + using System.Globalization; + using System.Reflection; + using System.Resources; + + internal static class Resources + { + private static readonly ResourceManager _resourceManager + = new ResourceManager("Microsoft.AspNet.Session.Resources", typeof(Resources).GetTypeInfo().Assembly); + + /// + /// The key cannot be longer than '{0}' when encoded with UTF-8. + /// + internal static string Exception_KeyLengthIsExceeded + { + get { return GetString("Exception_KeyLengthIsExceeded"); } + } + + /// + /// The key cannot be longer than '{0}' when encoded with UTF-8. + /// + internal static string FormatException_KeyLengthIsExceeded(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Exception_KeyLengthIsExceeded"), p0); + } + + /// + /// The session cannot be established after the response has started. + /// + internal static string Exception_InvalidSessionEstablishment + { + get { return GetString("Exception_InvalidSessionEstablishment"); } + } + + /// + /// The session cannot be established after the response has started. + /// + internal static string FormatException_InvalidSessionEstablishment() + { + return GetString("Exception_InvalidSessionEstablishment"); + } + + /// + /// The value cannot be serialized in two bytes. + /// + internal static string Exception_InvalidToSerializeIn2Bytes + { + get { return GetString("Exception_InvalidToSerializeIn2Bytes"); } + } + + /// + /// The value cannot be serialized in two bytes. + /// + internal static string FormatException_InvalidToSerializeIn2Bytes() + { + return GetString("Exception_InvalidToSerializeIn2Bytes"); + } + + /// + /// The value cannot be serialized in three bytes. + /// + internal static string Exception_InvalidToSerializeIn3Bytes + { + get { return GetString("Exception_InvalidToSerializeIn3Bytes"); } + } + + /// + /// The value cannot be serialized in three bytes. + /// + internal static string FormatException_InvalidToSerializeIn3Bytes() + { + return GetString("Exception_InvalidToSerializeIn3Bytes"); + } + + /// + /// The value cannot be negative. + /// + internal static string Exception_NumberShouldNotBeNegative + { + get { return GetString("Exception_NumberShouldNotBeNegative"); } + } + + /// + /// The value cannot be negative. + /// + internal static string FormatException_NumberShouldNotBeNegative() + { + return GetString("Exception_NumberShouldNotBeNegative"); + } + + private static string GetString(string name, params string[] formatterNames) + { + var value = _resourceManager.GetString(name); + + System.Diagnostics.Debug.Assert(value != null); + + if (formatterNames != null) + { + for (var i = 0; i < formatterNames.Length; i++) + { + value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); + } + } + + return value; + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/Resources.resx b/src/Microsoft.AspNet.Session/Resources.resx new file mode 100644 index 0000000000..8212053460 --- /dev/null +++ b/src/Microsoft.AspNet.Session/Resources.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The key cannot be longer than '{0}' when encoded with UTF-8. + + + The session cannot be established after the response has started. + + + The value cannot be serialized in two bytes. + + + The value cannot be serialized in three bytes. + + + The value cannot be negative. + + \ No newline at end of file From b36d5663b2893560e10ef8f1ee574c2cfe3d8bb1 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Sat, 3 Oct 2015 15:44:49 -0700 Subject: [PATCH 088/295] Renaming Microsoft.Framework.* -> Microsoft.Extensions.* --- samples/SessionSample/Startup.cs | 6 +++--- samples/SessionSample/project.json | 8 ++++---- src/Microsoft.AspNet.Session/DistributedSession.cs | 6 +++--- .../DistributedSessionStore.cs | 6 +++--- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 6 +++--- .../SessionMiddlewareExtensions.cs | 2 +- .../SessionServiceCollectionExtensions.cs | 4 ++-- src/Microsoft.AspNet.Session/project.json | 8 ++++---- test/Microsoft.AspNet.Session.Tests/SessionTests.cs | 12 ++++++------ test/Microsoft.AspNet.Session.Tests/project.json | 4 ++-- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 6a60ec435e..1445e050de 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -1,11 +1,11 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; -using Microsoft.Framework.DependencyInjection; -using Microsoft.Framework.Logging; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; namespace SessionSample { diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index b85cd3f507..5b354a5d16 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -6,10 +6,10 @@ "Microsoft.AspNet.Server.IIS": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.Session": "1.0.0-*", - "Microsoft.Framework.Caching.Memory": "1.0.0-*", - "Microsoft.Framework.Caching.Redis": "1.0.0-*", - "Microsoft.Framework.Caching.SqlServer": "1.0.0-*", - "Microsoft.Framework.Logging.Console": "1.0.0-*" + "Microsoft.Extensions.Caching.Memory": "1.0.0-*", + "Microsoft.Extensions.Caching.Redis": "1.0.0-*", + "Microsoft.Extensions.Caching.SqlServer": "1.0.0-*", + "Microsoft.Extensions.Logging.Console": "1.0.0-*" }, "exclude": "wwwroot/**/*.*", "frameworks": { diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index dc78bb49a7..2f5b5e6774 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -8,9 +8,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.AspNet.Http.Features; -using Microsoft.Framework.Caching.Distributed; -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; +using Microsoft.Extensions.Caching.Distributed; +using Microsoft.Extensions.Internal; +using Microsoft.Extensions.Logging; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs index 4391214c54..f6a0866de9 100644 --- a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs @@ -3,9 +3,9 @@ using System; using Microsoft.AspNet.Http.Features; -using Microsoft.Framework.Caching.Distributed; -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; +using Microsoft.Extensions.Caching.Distributed; +using Microsoft.Extensions.Internal; +using Microsoft.Extensions.Logging; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 5215ffa830..65294a2841 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -7,9 +7,9 @@ using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; -using Microsoft.Framework.OptionsModel; +using Microsoft.Extensions.Internal; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.OptionsModel; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs index d4a2e322f9..d6f16d0dc7 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Session; -using Microsoft.Framework.Internal; +using Microsoft.Extensions.Internal; namespace Microsoft.AspNet.Builder { diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs index af253aaaac..31bd37ca8d 100644 --- a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs @@ -3,9 +3,9 @@ using System; using Microsoft.AspNet.Session; -using Microsoft.Framework.Internal; +using Microsoft.Extensions.Internal; -namespace Microsoft.Framework.DependencyInjection +namespace Microsoft.Extensions.DependencyInjection { /// /// Extension methods for adding session services to the DI container. diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 41b911dc92..cdd5db0e77 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -7,10 +7,10 @@ }, "dependencies": { "Microsoft.AspNet.Http.Abstractions": "1.0.0-*", - "Microsoft.Framework.Caching.Abstractions": "1.0.0-*", - "Microsoft.Framework.Logging.Abstractions": "1.0.0-*", - "Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }, - "Microsoft.Framework.OptionsModel": "1.0.0-*" + "Microsoft.Extensions.Caching.Abstractions": "1.0.0-*", + "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", + "Microsoft.Extensions.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }, + "Microsoft.Extensions.OptionsModel": "1.0.0-*" }, "compilationOptions": { "allowUnsafe": true diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index af91a911ca..209d716ff1 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -11,12 +11,12 @@ using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.TestHost; -using Microsoft.Framework.Caching.Distributed; -using Microsoft.Framework.Caching.Memory; -using Microsoft.Framework.DependencyInjection; -using Microsoft.Framework.Internal; -using Microsoft.Framework.Logging; -using Microsoft.Framework.Logging.Testing; +using Microsoft.Extensions.Caching.Distributed; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Internal; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Testing; using Microsoft.Net.Http.Headers; using Xunit; diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json index 658662375c..d13f6c1a7c 100644 --- a/test/Microsoft.AspNet.Session.Tests/project.json +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -2,8 +2,8 @@ "dependencies": { "Microsoft.AspNet.Session": "1.0.0-*", "Microsoft.AspNet.TestHost": "1.0.0-*", - "Microsoft.Framework.Caching.Memory": "1.0.0-*", - "Microsoft.Framework.Logging.Testing": "1.0.0-*", + "Microsoft.Extensions.Caching.Memory": "1.0.0-*", + "Microsoft.Extensions.Logging.Testing": "1.0.0-*", "xunit.runner.aspnet": "2.0.0-aspnet-*" }, "commands": { From a6ac3f58f5618d2ee41b7198df9501e07140005a Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 6 Oct 2015 17:25:14 -0700 Subject: [PATCH 089/295] Replace NotNullAttribute with thrown exceptions --- .../DistributedSession.cs | 37 +++++++++++++++++-- .../DistributedSessionStore.cs | 25 +++++++++++-- .../Properties/Resources.Designer.cs | 34 ++++++++++++----- src/Microsoft.AspNet.Session/Resources.resx | 3 ++ .../SessionMiddleware.cs | 29 ++++++++++++--- .../SessionMiddlewareExtensions.cs | 9 ++++- .../SessionServiceCollectionExtensions.cs | 15 ++++++-- src/Microsoft.AspNet.Session/project.json | 4 +- 8 files changed, 128 insertions(+), 28 deletions(-) diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index 2f5b5e6774..134dfcbe47 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -9,7 +9,6 @@ using System.Text; using System.Threading.Tasks; using Microsoft.AspNet.Http.Features; using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; namespace Microsoft.AspNet.Session @@ -29,9 +28,34 @@ namespace Microsoft.AspNet.Session private bool _loaded; private bool _isNewSessionKey; - public DistributedSession([NotNull] IDistributedCache cache, [NotNull] string sessionId, TimeSpan idleTimeout, - [NotNull] Func tryEstablishSession, [NotNull] ILoggerFactory loggerFactory, bool isNewSessionKey) + public DistributedSession( + IDistributedCache cache, + string sessionId, + TimeSpan idleTimeout, + Func tryEstablishSession, + ILoggerFactory loggerFactory, + bool isNewSessionKey) { + if (cache == null) + { + throw new ArgumentNullException(nameof(cache)); + } + + if (string.IsNullOrEmpty(sessionId)) + { + throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(sessionId)); + } + + if (tryEstablishSession == null) + { + throw new ArgumentNullException(nameof(tryEstablishSession)); + } + + if (loggerFactory == null) + { + throw new ArgumentNullException(nameof(loggerFactory)); + } + _cache = cache; _sessionId = sessionId; _idleTimeout = idleTimeout; @@ -56,8 +80,13 @@ namespace Microsoft.AspNet.Session return _store.TryGetValue(new EncodedKey(key), out value); } - public void Set(string key, [NotNull] byte[] value) + public void Set(string key, byte[] value) { + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } + var encodedKey = new EncodedKey(key); if (encodedKey.KeyBytes.Length > KeyLengthLimit) { diff --git a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs index f6a0866de9..27b3b88372 100644 --- a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNet.Session/DistributedSessionStore.cs @@ -4,7 +4,6 @@ using System; using Microsoft.AspNet.Http.Features; using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; namespace Microsoft.AspNet.Session @@ -14,8 +13,18 @@ namespace Microsoft.AspNet.Session private readonly IDistributedCache _cache; private readonly ILoggerFactory _loggerFactory; - public DistributedSessionStore([NotNull] IDistributedCache cache, [NotNull] ILoggerFactory loggerFactory) + public DistributedSessionStore(IDistributedCache cache, ILoggerFactory loggerFactory) { + if (cache == null) + { + throw new ArgumentNullException(nameof(cache)); + } + + if (loggerFactory == null) + { + throw new ArgumentNullException(nameof(loggerFactory)); + } + _cache = cache; _loggerFactory = loggerFactory; } @@ -33,8 +42,18 @@ namespace Microsoft.AspNet.Session _cache.Connect(); } - public ISession Create([NotNull] string sessionId, TimeSpan idleTimeout, [NotNull] Func tryEstablishSession, bool isNewSessionKey) + public ISession Create(string sessionId, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey) { + if (string.IsNullOrEmpty(sessionId)) + { + throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(sessionId)); + } + + if (tryEstablishSession == null) + { + throw new ArgumentNullException(nameof(tryEstablishSession)); + } + return new DistributedSession(_cache, sessionId, idleTimeout, tryEstablishSession, _loggerFactory, isNewSessionKey); } } diff --git a/src/Microsoft.AspNet.Session/Properties/Resources.Designer.cs b/src/Microsoft.AspNet.Session/Properties/Resources.Designer.cs index e92a12995b..4ee53d8b6c 100644 --- a/src/Microsoft.AspNet.Session/Properties/Resources.Designer.cs +++ b/src/Microsoft.AspNet.Session/Properties/Resources.Designer.cs @@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Session { get { return GetString("Exception_KeyLengthIsExceeded"); } } - + /// /// The key cannot be longer than '{0}' when encoded with UTF-8. /// @@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Session { get { return GetString("Exception_InvalidSessionEstablishment"); } } - + /// /// The session cannot be established after the response has started. /// @@ -49,7 +49,7 @@ namespace Microsoft.AspNet.Session { get { return GetString("Exception_InvalidToSerializeIn2Bytes"); } } - + /// /// The value cannot be serialized in two bytes. /// @@ -57,7 +57,7 @@ namespace Microsoft.AspNet.Session { return GetString("Exception_InvalidToSerializeIn2Bytes"); } - + /// /// The value cannot be serialized in three bytes. /// @@ -65,7 +65,7 @@ namespace Microsoft.AspNet.Session { get { return GetString("Exception_InvalidToSerializeIn3Bytes"); } } - + /// /// The value cannot be serialized in three bytes. /// @@ -73,7 +73,7 @@ namespace Microsoft.AspNet.Session { return GetString("Exception_InvalidToSerializeIn3Bytes"); } - + /// /// The value cannot be negative. /// @@ -81,7 +81,7 @@ namespace Microsoft.AspNet.Session { get { return GetString("Exception_NumberShouldNotBeNegative"); } } - + /// /// The value cannot be negative. /// @@ -89,7 +89,23 @@ namespace Microsoft.AspNet.Session { return GetString("Exception_NumberShouldNotBeNegative"); } - + + /// + /// Argument cannot be null or empty string. + /// + internal static string ArgumentCannotBeNullOrEmpty + { + get { return GetString("ArgumentCannotBeNullOrEmpty"); } + } + + /// + /// Argument cannot be null or empty string. + /// + internal static string FormatArgumentCannotBeNullOrEmpty() + { + return GetString("ArgumentCannotBeNullOrEmpty"); + } + private static string GetString(string name, params string[] formatterNames) { var value = _resourceManager.GetString(name); @@ -107,4 +123,4 @@ namespace Microsoft.AspNet.Session return value; } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNet.Session/Resources.resx b/src/Microsoft.AspNet.Session/Resources.resx index 8212053460..5bb1c8e0bb 100644 --- a/src/Microsoft.AspNet.Session/Resources.resx +++ b/src/Microsoft.AspNet.Session/Resources.resx @@ -132,4 +132,7 @@ The value cannot be negative. + + Argument cannot be null or empty string. + \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 65294a2841..1abdcf4db4 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; -using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; using Microsoft.Extensions.OptionsModel; @@ -34,11 +33,31 @@ namespace Microsoft.AspNet.Session /// The representing the session store. /// The session configuration options. public SessionMiddleware( - [NotNull] RequestDelegate next, - [NotNull] ILoggerFactory loggerFactory, - [NotNull] ISessionStore sessionStore, - [NotNull] IOptions options) + RequestDelegate next, + ILoggerFactory loggerFactory, + ISessionStore sessionStore, + IOptions options) { + if (next == null) + { + throw new ArgumentNullException(nameof(next)); + } + + if (loggerFactory == null) + { + throw new ArgumentNullException(nameof(loggerFactory)); + } + + if (sessionStore == null) + { + throw new ArgumentNullException(nameof(sessionStore)); + } + + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + _next = next; _logger = loggerFactory.CreateLogger(); _options = options.Value; diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs index d6f16d0dc7..96feb96721 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs @@ -1,8 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using Microsoft.AspNet.Session; -using Microsoft.Extensions.Internal; namespace Microsoft.AspNet.Builder { @@ -16,8 +16,13 @@ namespace Microsoft.AspNet.Builder /// /// The . /// The . - public static IApplicationBuilder UseSession([NotNull] this IApplicationBuilder app) + public static IApplicationBuilder UseSession(this IApplicationBuilder app) { + if (app == null) + { + throw new ArgumentNullException(nameof(app)); + } + return app.UseMiddleware(); } } diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs index 31bd37ca8d..4f20017203 100644 --- a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs @@ -3,7 +3,6 @@ using System; using Microsoft.AspNet.Session; -using Microsoft.Extensions.Internal; namespace Microsoft.Extensions.DependencyInjection { @@ -17,8 +16,13 @@ namespace Microsoft.Extensions.DependencyInjection /// /// The to add the services to. /// The . - public static IServiceCollection AddSession([NotNull] this IServiceCollection services) + public static IServiceCollection AddSession(this IServiceCollection services) { + if (services == null) + { + throw new ArgumentNullException(nameof(services)); + } + services.AddOptions(); services.AddTransient(); return services; @@ -30,8 +34,13 @@ namespace Microsoft.Extensions.DependencyInjection /// The to add the services to. /// The session options to configure the middleware with. /// The . - public static IServiceCollection AddSession([NotNull] this IServiceCollection services, Action configure) + public static IServiceCollection AddSession(this IServiceCollection services, Action configure) { + if (services == null) + { + throw new ArgumentNullException(nameof(services)); + } + services.Configure(configure); return services.AddSession(); } diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index cdd5db0e77..9058ae48f1 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -9,11 +9,11 @@ "Microsoft.AspNet.Http.Abstractions": "1.0.0-*", "Microsoft.Extensions.Caching.Abstractions": "1.0.0-*", "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", - "Microsoft.Extensions.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }, "Microsoft.Extensions.OptionsModel": "1.0.0-*" }, "compilationOptions": { - "allowUnsafe": true + "allowUnsafe": true, + "warningsAsErrors": true }, "frameworks": { "dnx451": { }, From a3e3412695581836bd2bd97224ed83ddefbc1103 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Thu, 8 Oct 2015 19:01:07 -0700 Subject: [PATCH 090/295] React to aspnet/Universe#290 fix --- build.cmd | 25 +++++++++++++------------ build.sh | 12 +++++++----- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/build.cmd b/build.cmd index 70d974a61f..84dc87e480 100644 --- a/build.cmd +++ b/build.cmd @@ -18,22 +18,23 @@ md .nuget copy %CACHED_NUGET% .nuget\nuget.exe > nul :restore -IF EXIST packages\KoreBuild goto run +IF EXIST packages\Sake goto getdnx IF %BUILDCMD_KOREBUILD_VERSION%=="" ( - .nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre + .nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre ) ELSE ( - .nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre + .nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre ) -.nuget\nuget.exe install Sake -ExcludeVersion -Out packages +.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages -IF "%SKIP_DNX_INSTALL%"=="1" goto run -IF %BUILDCMD_DNX_VERSION%=="" ( - CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86 +:getdnx +IF "%SKIP_DNX_INSTALL%"=="" ( + IF "%BUILDCMD_DNX_VERSION%"=="" ( + BUILDCMD_DNX_VERSION=latest + ) + CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86 -alias default + CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x86 -alias default ) ELSE ( - CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CLR -arch x86 -alias default + CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86 ) -CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86 -:run -CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86 -packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* \ No newline at end of file +packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* diff --git a/build.sh b/build.sh index 0c66139817..da4e3fcd1c 100755 --- a/build.sh +++ b/build.sh @@ -24,18 +24,20 @@ if test ! -e .nuget; then cp $cachePath .nuget/nuget.exe fi -if test ! -d packages/KoreBuild; then +if test ! -d packages/Sake; then mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre - mono .nuget/nuget.exe install Sake -ExcludeVersion -Out packages + mono .nuget/nuget.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages fi if ! type dnvm > /dev/null 2>&1; then source packages/KoreBuild/build/dnvm.sh fi -if ! type dnx > /dev/null 2>&1; then - dnvm upgrade +if ! type dnx > /dev/null 2>&1 || [ -z "$SKIP_DNX_INSTALL" ]; then + dnvm install latest -runtime coreclr -alias default + dnvm install default -runtime mono -alias default +else + dnvm use default -runtime mono fi mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@" - From f9155d17aa7255519962899b0b974c0a793736c2 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Mon, 12 Oct 2015 13:02:48 -0700 Subject: [PATCH 091/295] Fix local build break --- build.cmd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.cmd b/build.cmd index 84dc87e480..553e3929a0 100644 --- a/build.cmd +++ b/build.cmd @@ -4,8 +4,8 @@ cd %~dp0 SETLOCAL SET NUGET_VERSION=latest SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe -SET BUILDCMD_KOREBUILD_VERSION="" -SET BUILDCMD_DNX_VERSION="" +SET BUILDCMD_KOREBUILD_VERSION= +SET BUILDCMD_DNX_VERSION= IF EXIST %CACHED_NUGET% goto copynuget echo Downloading latest version of NuGet.exe... @@ -19,7 +19,7 @@ copy %CACHED_NUGET% .nuget\nuget.exe > nul :restore IF EXIST packages\Sake goto getdnx -IF %BUILDCMD_KOREBUILD_VERSION%=="" ( +IF "%BUILDCMD_KOREBUILD_VERSION%"=="" ( .nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre ) ELSE ( .nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre @@ -27,10 +27,10 @@ IF %BUILDCMD_KOREBUILD_VERSION%=="" ( .nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages :getdnx +IF "%BUILDCMD_DNX_VERSION%"=="" ( + SET BUILDCMD_DNX_VERSION=latest +) IF "%SKIP_DNX_INSTALL%"=="" ( - IF "%BUILDCMD_DNX_VERSION%"=="" ( - BUILDCMD_DNX_VERSION=latest - ) CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86 -alias default CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x86 -alias default ) ELSE ( From 551d559adac6263362adb8781199eb4d55a3edba Mon Sep 17 00:00:00 2001 From: Cesar Blum Silveira Date: Fri, 16 Oct 2015 11:35:58 -0700 Subject: [PATCH 092/295] Enable Microsoft.AspNet.Session.Tests on CoreCLR. --- test/Microsoft.AspNet.Session.Tests/project.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json index d13f6c1a7c..1c42d8113f 100644 --- a/test/Microsoft.AspNet.Session.Tests/project.json +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -10,6 +10,7 @@ "test": "xunit.runner.aspnet" }, "frameworks": { - "dnx451": { } + "dnx451": { }, + "dnxcore50": { } } } From 185309bfda4d3e0ea66d65aac34007fb8fa127b9 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 22 Oct 2015 01:09:42 -0700 Subject: [PATCH 093/295] Switching to generations TFMs --- src/Microsoft.AspNet.Session/project.json | 48 +++++++++++------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 9058ae48f1..9a4551e48a 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -1,26 +1,26 @@ { - "version": "1.0.0-*", - "description": "ASP.NET 5 session state middleware.", - "repository": { - "type": "git", - "url": "git://github.com/aspnet/session" - }, - "dependencies": { - "Microsoft.AspNet.Http.Abstractions": "1.0.0-*", - "Microsoft.Extensions.Caching.Abstractions": "1.0.0-*", - "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", - "Microsoft.Extensions.OptionsModel": "1.0.0-*" - }, - "compilationOptions": { - "allowUnsafe": true, - "warningsAsErrors": true - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { - "dependencies": { - "System.Security.Cryptography.Algorithms": "4.0.0-beta-*" - } - } + "version": "1.0.0-*", + "description": "ASP.NET 5 session state middleware.", + "repository": { + "type": "git", + "url": "git://github.com/aspnet/session" + }, + "dependencies": { + "Microsoft.AspNet.Http.Abstractions": "1.0.0-*", + "Microsoft.Extensions.Caching.Abstractions": "1.0.0-*", + "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", + "Microsoft.Extensions.OptionsModel": "1.0.0-*" + }, + "compilationOptions": { + "allowUnsafe": true, + "warningsAsErrors": true + }, + "frameworks": { + "net451": {}, + "dotnet5.4": { + "dependencies": { + "System.Security.Cryptography.Algorithms": "4.0.0-beta-*" + } } -} + } +} \ No newline at end of file From 8bcbddc09ba2abcdeaec70eba1080a38c6157f3c Mon Sep 17 00:00:00 2001 From: Victor Hurdugaci Date: Tue, 27 Oct 2015 09:19:30 -0700 Subject: [PATCH 094/295] Make tests more robust by only checking the messages coming from session. Otherwise, anyone logging more below could break them --- .../SessionTests.cs | 22 ++++++++++++------- .../TestExtensions.cs | 18 +++++++++++++++ 2 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 test/Microsoft.AspNet.Session.Tests/TestExtensions.cs diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 209d716ff1..fc959441be 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -240,9 +240,12 @@ namespace Microsoft.AspNet.Session var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); - Assert.Single(sink.Writes); - Assert.Contains("started", sink.Writes[0].State.ToString()); - Assert.Equal(LogLevel.Information, sink.Writes[0].LogLevel); + + var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + + Assert.Single(sessionLogMessages); + Assert.Contains("started", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); } } @@ -287,11 +290,14 @@ namespace Microsoft.AspNet.Session client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); Thread.Sleep(50); Assert.Equal("2", await client.GetStringAsync("/second")); - Assert.Equal(2, sink.Writes.Count); - Assert.Contains("started", sink.Writes[0].State.ToString()); - Assert.Contains("expired", sink.Writes[1].State.ToString()); - Assert.Equal(LogLevel.Information, sink.Writes[0].LogLevel); - Assert.Equal(LogLevel.Warning, sink.Writes[1].LogLevel); + + var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + + Assert.Equal(2, sessionLogMessages.Length); + Assert.Contains("started", sessionLogMessages[0].State.ToString()); + Assert.Contains("expired", sessionLogMessages[1].State.ToString()); + Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); + Assert.Equal(LogLevel.Warning, sessionLogMessages[1].LogLevel); } } diff --git a/test/Microsoft.AspNet.Session.Tests/TestExtensions.cs b/test/Microsoft.AspNet.Session.Tests/TestExtensions.cs new file mode 100644 index 0000000000..f14be16e54 --- /dev/null +++ b/test/Microsoft.AspNet.Session.Tests/TestExtensions.cs @@ -0,0 +1,18 @@ +// Copyright (c) .NET Foundation. 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.Generic; +using System.Linq; +using Microsoft.Extensions.Logging.Testing; + +namespace Microsoft.AspNet.Session +{ + public static class TestExtensions + { + public static IEnumerable OnlyMessagesFromSource(this IEnumerable source) + { + return source.Where(message => message.LoggerName.Equals(typeof(T).FullName, StringComparison.Ordinal)); + } + } +} From a01529b321b9f49c50fff1ffb2ffc679d9e58230 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 28 Oct 2015 12:43:09 -0700 Subject: [PATCH 095/295] Updating to release NuGet.config. --- NuGet.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index 1707938c61..9db87a421e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + \ No newline at end of file From 089aca178ca98e40c9f77d8ec06cff85c1d9d09f Mon Sep 17 00:00:00 2001 From: Cesar Blum Silveira Date: Tue, 3 Nov 2015 12:20:50 -0800 Subject: [PATCH 096/295] Strong name Microsoft.AspNet.Session. --- src/Microsoft.AspNet.Session/project.json | 3 ++- tools/Key.snk | Bin 0 -> 596 bytes 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 tools/Key.snk diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 9a4551e48a..b43613f7e6 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -13,7 +13,8 @@ }, "compilationOptions": { "allowUnsafe": true, - "warningsAsErrors": true + "warningsAsErrors": true, + "keyFile": "../../tools/Key.snk" }, "frameworks": { "net451": {}, diff --git a/tools/Key.snk b/tools/Key.snk new file mode 100644 index 0000000000000000000000000000000000000000..e10e4889c125d3120cd9e81582243d70f7cbb806 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50098=Iw=HCsnz~#iVhm& zj%TU(_THUee?3yHBjk$37ysB?i5#7WD$={H zV4B!OxRPrb|8)HPg~A}8P>^=#y<)56#=E&NzcjOtPK~<4n6GHt=K$ro*T(lhby_@U zEk(hLzk1H)0yXj{A_5>fk-TgNoP|q6(tP2xo8zt8i%212CWM#AeCd?`hS|4~L({h~Moo(~vy&3Z z1uI}`fd^*>o=rwbAGymj6RM^pZm(*Kfhs+Y1#`-2JPWZMK8@;ZWCk2+9bX4YP);~fj-BU*R zQPvWv$89!{Rl9wM+zR>_TSkn^voYxA?2G iKnV#iZ6Ah`K>b=@=IjYJXrxL124zR(38)nxe+&q_$QXwJ literal 0 HcmV?d00001 From 226cb963fb44b978062a12ee81d3a6b5dafaa74f Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 12 Nov 2015 12:24:26 -0800 Subject: [PATCH 097/295] Remove System beta tag in project.json for coreclr packages. --- src/Microsoft.AspNet.Session/project.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index b43613f7e6..851ebd6940 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -20,8 +20,8 @@ "net451": {}, "dotnet5.4": { "dependencies": { - "System.Security.Cryptography.Algorithms": "4.0.0-beta-*" + "System.Security.Cryptography.Algorithms": "4.0.0-*" } } } -} \ No newline at end of file +} From 196450ac99472aac0cca908ec946b1dc50424dd0 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 13 Nov 2015 11:30:07 -0800 Subject: [PATCH 098/295] Reacting to DI changes --- test/Microsoft.AspNet.Session.Tests/SessionTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index fc959441be..7268f386ed 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -232,7 +232,7 @@ namespace Microsoft.AspNet.Session }, services => { - services.AddInstance(typeof(ILoggerFactory), loggerFactory); + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); services.AddCaching(); services.AddSession(); })) @@ -276,7 +276,7 @@ namespace Microsoft.AspNet.Session }, services => { - services.AddInstance(typeof(ILoggerFactory), loggerFactory); + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); services.AddCaching(); services.AddSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30)); })) @@ -331,7 +331,7 @@ namespace Microsoft.AspNet.Session }, services => { - services.AddInstance(typeof(ILoggerFactory), new NullLoggerFactory()); + services.AddSingleton(typeof(ILoggerFactory), new NullLoggerFactory()); services.AddCaching(); services.AddSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20)); services.Configure(o => o.Clock = clock); From cf9a4a63718e4db4444d9f6e35750140f33c9244 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Tue, 17 Nov 2015 11:13:01 -0800 Subject: [PATCH 099/295] Explicitly choose Mono 4.0.5 - avoids future problems related to aspnet/External#48 - e.g. when Travis updates default Mono version in `csharp` bundle --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 947bf868ee..dc44c0f660 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: csharp sudo: false +mono: + - 4.0.5 script: - ./build.sh --quiet verify \ No newline at end of file From 1227fffcf5e48d64610d5cf5b82f222cc6c886c5 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Tue, 17 Nov 2015 14:34:48 -0800 Subject: [PATCH 100/295] Move Travis to supported Linux distribution - use Ubuntu 14.04 (Trusty) - Travis support for Trusty is in Beta and currently requires `sudo` - run `dnu restore` with DNX Core since aspnet/External#49 is not fixed in Mono versions we can use - add required dependencies for DNX Core to `.travis.yml` - addresses part of aspnet/Universe#290 --- .travis.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index dc44c0f660..2fc624899f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,18 @@ language: csharp -sudo: false +sudo: required +dist: trusty +addons: + apt: + packages: + - gettext + - libcurl4-openssl-dev + - libicu-dev + - libssl-dev + - libunwind8 + - zlib1g +env: + - KOREBUILD_DNU_RESTORE_CORECLR=true mono: - 4.0.5 script: - - ./build.sh --quiet verify \ No newline at end of file + - ./build.sh --quiet verify From 8644a2179b84e19b7728140415213fc1a3f80533 Mon Sep 17 00:00:00 2001 From: John Luo Date: Sun, 6 Dec 2015 17:45:55 -0800 Subject: [PATCH 101/295] Reacting to verbose rename --- samples/SessionSample/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 1445e050de..fdf43a4881 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -13,7 +13,7 @@ namespace SessionSample { public Startup(ILoggerFactory loggerFactory) { - loggerFactory.AddConsole(LogLevel.Verbose); + loggerFactory.AddConsole(LogLevel.Debug); } public void ConfigureServices(IServiceCollection services) From a6396df69059a6d49ccdcbf50b838e25ce9605dc Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 11 Dec 2015 12:24:25 -0800 Subject: [PATCH 102/295] Updating to release NuGet.config. --- NuGet.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index 1707938c61..9db87a421e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + \ No newline at end of file From 09278f701310c5e4d61a9bf299e9a0e438804787 Mon Sep 17 00:00:00 2001 From: Brennan Date: Mon, 14 Dec 2015 14:56:18 -0800 Subject: [PATCH 103/295] Adding logging event ids --- .../DistributedSession.cs | 4 +- .../LoggingExtensions.cs | 45 +++++++++++++++++++ .../SessionMiddleware.cs | 2 +- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 src/Microsoft.AspNet.Session/LoggingExtensions.cs diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNet.Session/DistributedSession.cs index 134dfcbe47..04c2c3aed1 100644 --- a/src/Microsoft.AspNet.Session/DistributedSession.cs +++ b/src/Microsoft.AspNet.Session/DistributedSession.cs @@ -139,7 +139,7 @@ namespace Microsoft.AspNet.Session } else if (!_isNewSessionKey) { - _logger.LogWarning("Accessing expired session {0}", _sessionId); + _logger.AccessingExpiredSession(_sessionId); } _loaded = true; } @@ -152,7 +152,7 @@ namespace Microsoft.AspNet.Session var data = await _cache.GetAsync(_sessionId); if (_logger.IsEnabled(LogLevel.Information) && data == null) { - _logger.LogInformation("Session {0} started", _sessionId); + _logger.SessionStarted(_sessionId); } _isModified = false; diff --git a/src/Microsoft.AspNet.Session/LoggingExtensions.cs b/src/Microsoft.AspNet.Session/LoggingExtensions.cs new file mode 100644 index 0000000000..d9cc0b8654 --- /dev/null +++ b/src/Microsoft.AspNet.Session/LoggingExtensions.cs @@ -0,0 +1,45 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.Extensions.Logging +{ + internal static class LoggingExtensions + { + private static Action _errorClosingTheSession; + private static Action _accessingExpiredSession; + private static Action _sessionStarted; + + static LoggingExtensions() + { + _errorClosingTheSession = LoggerMessage.Define( + eventId: 1, + logLevel: LogLevel.Error, + formatString: "Error closing the session."); + _accessingExpiredSession = LoggerMessage.Define( + eventId: 2, + logLevel: LogLevel.Warning, + formatString: "Accessing expired session {SessionId}"); + _sessionStarted = LoggerMessage.Define( + eventId: 3, + logLevel: LogLevel.Information, + formatString: "Session {SessionId} started"); + } + + public static void ErrorClosingTheSession(this ILogger logger, Exception exception) + { + _errorClosingTheSession(logger, exception); + } + + public static void AccessingExpiredSession(this ILogger logger, string sessionId) + { + _accessingExpiredSession(logger, sessionId, null); + } + + public static void SessionStarted(this ILogger logger, string sessionId) + { + _sessionStarted(logger, sessionId, null); + } + } +} diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 1abdcf4db4..b0ce4444ff 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -106,7 +106,7 @@ namespace Microsoft.AspNet.Session } catch (Exception ex) { - _logger.LogError("Error closing the session.", ex); + _logger.ErrorClosingTheSession(ex); } } } From 257c1786b30779fb796d67ac74c66da0ef316eb2 Mon Sep 17 00:00:00 2001 From: John Luo Date: Thu, 17 Dec 2015 19:58:58 -0800 Subject: [PATCH 104/295] Reacting to new Hosting API --- samples/SessionSample/Startup.cs | 11 + samples/SessionSample/hosting.json | 3 + samples/SessionSample/project.json | 35 +- samples/SessionSample/wwwroot/web.config | 9 + .../SessionTests.cs | 501 ++++++++++-------- 5 files changed, 310 insertions(+), 249 deletions(-) create mode 100644 samples/SessionSample/hosting.json create mode 100644 samples/SessionSample/wwwroot/web.config diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index fdf43a4881..8ea3a5af80 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -3,6 +3,7 @@ using System; using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -74,5 +75,15 @@ namespace SessionSample await context.Response.WriteAsync(""); }); } + + public static void Main(string[] args) + { + var application = new WebApplicationBuilder() + .UseConfiguration(WebApplicationConfiguration.GetDefault(args)) + .UseStartup() + .Build(); + + application.Run(); + } } } \ No newline at end of file diff --git a/samples/SessionSample/hosting.json b/samples/SessionSample/hosting.json new file mode 100644 index 0000000000..f8ef14574d --- /dev/null +++ b/samples/SessionSample/hosting.json @@ -0,0 +1,3 @@ +{ + "server": "Microsoft.AspNet.Server.Kestrel" +} diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 5b354a5d16..e8bf22b968 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -1,19 +1,20 @@ { - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" - }, - "dependencies": { - "Microsoft.AspNet.Server.IIS": "1.0.0-*", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.Session": "1.0.0-*", - "Microsoft.Extensions.Caching.Memory": "1.0.0-*", - "Microsoft.Extensions.Caching.Redis": "1.0.0-*", - "Microsoft.Extensions.Caching.SqlServer": "1.0.0-*", - "Microsoft.Extensions.Logging.Console": "1.0.0-*" - }, - "exclude": "wwwroot/**/*.*", - "frameworks": { - "dnx451": { } - }, - "webroot": "wwwroot" + "compilationOptions": { + "emitEntryPoint": true + }, + "commands": { + "web": "SessionSample" + }, + "dependencies": { + "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", + "Microsoft.AspNet.Session": "1.0.0-*", + "Microsoft.Extensions.Caching.Memory": "1.0.0-*", + "Microsoft.Extensions.Caching.Redis": "1.0.0-*", + "Microsoft.Extensions.Caching.SqlServer": "1.0.0-*", + "Microsoft.Extensions.Logging.Console": "1.0.0-*" + }, + "exclude": "wwwroot/**/*.*", + "frameworks": { + "dnx451": { } + } } diff --git a/samples/SessionSample/wwwroot/web.config b/samples/SessionSample/wwwroot/web.config new file mode 100644 index 0000000000..9a0d90abf8 --- /dev/null +++ b/samples/SessionSample/wwwroot/web.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 7268f386ed..287a7eae8d 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -4,10 +4,10 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Net; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.TestHost; @@ -27,21 +27,24 @@ namespace Microsoft.AspNet.Session [Fact] public async Task ReadingEmptySessionDoesNotCreateCookie() { - using (var server = TestServer.Create(app => - { - app.UseSession(); - - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - Assert.Null(context.Session.GetString("NotFound")); - return Task.FromResult(0); + app.UseSession(); + + app.Run(context => + { + Assert.Null(context.Session.GetString("NotFound")); + return Task.FromResult(0); + }); + }) + .ConfigureServices(services => + { + services.AddCaching(); + services.AddSession(); }); - }, - services => - { - services.AddCaching(); - services.AddSession(); - })) + + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); @@ -54,22 +57,25 @@ namespace Microsoft.AspNet.Session [Fact] public async Task SettingAValueCausesTheCookieToBeCreated() { - using (var server = TestServer.Create(app => - { - app.UseSession(); - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - Assert.Null(context.Session.GetString("Key")); - context.Session.SetString("Key", "Value"); - Assert.Equal("Value", context.Session.GetString("Key")); - return Task.FromResult(0); + app.UseSession(); + app.Run(context => + { + Assert.Null(context.Session.GetString("Key")); + context.Session.SetString("Key", "Value"); + Assert.Equal("Value", context.Session.GetString("Key")); + return Task.FromResult(0); + }); + }) + .ConfigureServices(services => + { + services.AddCaching(); + services.AddSession(); }); - }, - services => - { - services.AddCaching(); - services.AddSession(); - })) + + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); @@ -84,27 +90,30 @@ namespace Microsoft.AspNet.Session [Fact] public async Task SessionCanBeAccessedOnTheNextRequest() { - using (var server = TestServer.Create(app => - { - app.UseSession(); - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - int? value = context.Session.GetInt32("Key"); - if (context.Request.Path == new PathString("/first")) + app.UseSession(); + app.Run(context => { - Assert.False(value.HasValue); - value = 0; - } - Assert.True(value.HasValue); - context.Session.SetInt32("Key", value.Value + 1); - return context.Response.WriteAsync(value.Value.ToString()); + int? value = context.Session.GetInt32("Key"); + if (context.Request.Path == new PathString("/first")) + { + Assert.False(value.HasValue); + value = 0; + } + Assert.True(value.HasValue); + context.Session.SetInt32("Key", value.Value + 1); + return context.Response.WriteAsync(value.Value.ToString()); + }); + }) + .ConfigureServices(services => + { + services.AddCaching(); + services.AddSession(); }); - }, - services => - { - services.AddCaching(); - services.AddSession(); - })) + + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync("first"); @@ -123,37 +132,41 @@ namespace Microsoft.AspNet.Session [Fact] public async Task RemovedItemCannotBeAccessedAgain() { - using (var server = TestServer.Create(app => - { - app.UseSession(); - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - int? value = context.Session.GetInt32("Key"); - if (context.Request.Path == new PathString("/first")) + app.UseSession(); + app.Run(context => { - Assert.False(value.HasValue); - value = 0; - context.Session.SetInt32("Key", 1); - } - else if (context.Request.Path == new PathString("/second")) - { - Assert.True(value.HasValue); - Assert.Equal(1, value); - context.Session.Remove("Key"); - } - else if (context.Request.Path == new PathString("/third")) - { - Assert.False(value.HasValue); - value = 2; - } - return context.Response.WriteAsync(value.Value.ToString()); + int? value = context.Session.GetInt32("Key"); + if (context.Request.Path == new PathString("/first")) + { + Assert.False(value.HasValue); + value = 0; + context.Session.SetInt32("Key", 1); + } + else if (context.Request.Path == new PathString("/second")) + { + Assert.True(value.HasValue); + Assert.Equal(1, value); + context.Session.Remove("Key"); + } + else if (context.Request.Path == new PathString("/third")) + { + Assert.False(value.HasValue); + value = 2; + } + return context.Response.WriteAsync(value.Value.ToString()); + }); + }) + .ConfigureServices( + services => + { + services.AddCaching(); + services.AddSession(); }); - }, - services => - { - services.AddCaching(); - services.AddSession(); - })) + + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync("first"); @@ -171,37 +184,40 @@ namespace Microsoft.AspNet.Session [Fact] public async Task ClearedItemsCannotBeAccessedAgain() { - using (var server = TestServer.Create(app => - { - app.UseSession(); - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - int? value = context.Session.GetInt32("Key"); - if (context.Request.Path == new PathString("/first")) + app.UseSession(); + app.Run(context => { - Assert.False(value.HasValue); - value = 0; - context.Session.SetInt32("Key", 1); - } - else if (context.Request.Path == new PathString("/second")) - { - Assert.True(value.HasValue); - Assert.Equal(1, value); - context.Session.Clear(); - } - else if (context.Request.Path == new PathString("/third")) - { - Assert.False(value.HasValue); - value = 2; - } - return context.Response.WriteAsync(value.Value.ToString()); + int? value = context.Session.GetInt32("Key"); + if (context.Request.Path == new PathString("/first")) + { + Assert.False(value.HasValue); + value = 0; + context.Session.SetInt32("Key", 1); + } + else if (context.Request.Path == new PathString("/second")) + { + Assert.True(value.HasValue); + Assert.Equal(1, value); + context.Session.Clear(); + } + else if (context.Request.Path == new PathString("/third")) + { + Assert.False(value.HasValue); + value = 2; + } + return context.Response.WriteAsync(value.Value.ToString()); + }); + }) + .ConfigureServices(services => + { + services.AddCaching(); + services.AddSession(); }); - }, - services => - { - services.AddCaching(); - services.AddSession(); - })) + + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync("first"); @@ -221,21 +237,24 @@ namespace Microsoft.AspNet.Session { var sink = new TestSink(); var loggerFactory = new TestLoggerFactory(sink, enabled: true); - using (var server = TestServer.Create(app => - { - app.UseSession(); - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - context.Session.SetString("Key", "Value"); - return Task.FromResult(0); + app.UseSession(); + app.Run(context => + { + context.Session.SetString("Key", "Value"); + return Task.FromResult(0); + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); + services.AddCaching(); + services.AddSession(); }); - }, - services => - { - services.AddSingleton(typeof(ILoggerFactory), loggerFactory); - services.AddCaching(); - services.AddSession(); - })) + + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); @@ -254,32 +273,35 @@ namespace Microsoft.AspNet.Session { var sink = new TestSink(); var loggerFactory = new TestLoggerFactory(sink, enabled: true); - using (var server = TestServer.Create(app => - { - app.UseSession(); - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - int? value = context.Session.GetInt32("Key"); - if (context.Request.Path == new PathString("/first")) + app.UseSession(); + app.Run(context => { - Assert.False(value.HasValue); - value = 1; - context.Session.SetInt32("Key", 1); - } - else if (context.Request.Path == new PathString("/second")) - { - Assert.False(value.HasValue); - value = 2; - } - return context.Response.WriteAsync(value.Value.ToString()); + int? value = context.Session.GetInt32("Key"); + if (context.Request.Path == new PathString("/first")) + { + Assert.False(value.HasValue); + value = 1; + context.Session.SetInt32("Key", 1); + } + else if (context.Request.Path == new PathString("/second")) + { + Assert.False(value.HasValue); + value = 2; + } + return context.Response.WriteAsync(value.Value.ToString()); + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); + services.AddCaching(); + services.AddSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30)); }); - }, - services => - { - services.AddSingleton(typeof(ILoggerFactory), loggerFactory); - services.AddCaching(); - services.AddSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30)); - })) + + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync("first"); @@ -305,37 +327,40 @@ namespace Microsoft.AspNet.Session public async Task RefreshesSession_WhenSessionData_IsNotModified() { var clock = new TestClock(); - using (var server = TestServer.Create(app => - { - app.UseSession(); - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - string responseData = string.Empty; - if (context.Request.Path == new PathString("/AddDataToSession")) + app.UseSession(); + app.Run(context => { - context.Session.SetInt32("Key", 10); - responseData = "added data to session"; - } - else if (context.Request.Path == new PathString("/AccessSessionData")) - { - var value = context.Session.GetInt32("Key"); - responseData = (value == null) ? "No value found in session." : value.ToString(); - } - else if (context.Request.Path == new PathString("/DoNotAccessSessionData")) - { - responseData = "did not access session data"; - } + string responseData = string.Empty; + if (context.Request.Path == new PathString("/AddDataToSession")) + { + context.Session.SetInt32("Key", 10); + responseData = "added data to session"; + } + else if (context.Request.Path == new PathString("/AccessSessionData")) + { + var value = context.Session.GetInt32("Key"); + responseData = (value == null) ? "No value found in session." : value.ToString(); + } + else if (context.Request.Path == new PathString("/DoNotAccessSessionData")) + { + responseData = "did not access session data"; + } - return context.Response.WriteAsync(responseData); + return context.Response.WriteAsync(responseData); + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), new NullLoggerFactory()); + services.AddCaching(); + services.AddSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20)); + services.Configure(o => o.Clock = clock); }); - }, - services => - { - services.AddSingleton(typeof(ILoggerFactory), new NullLoggerFactory()); - services.AddCaching(); - services.AddSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20)); - services.Configure(o => o.Clock = clock); - })) + + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync("AddDataToSession"); @@ -360,28 +385,31 @@ namespace Microsoft.AspNet.Session [Fact] public async Task SessionFeature_IsUnregistered_WhenResponseGoingOut() { - using (var server = TestServer.Create(app => - { - app.Use(async (httpContext, next) => + var builder = new WebApplicationBuilder() + .Configure(app => { - await next(); + app.Use(async (httpContext, next) => + { + await next(); - Assert.Null(httpContext.Features.Get()); + Assert.Null(httpContext.Features.Get()); + }); + + app.UseSession(); + + app.Run(context => + { + context.Session.SetString("key", "value"); + return Task.FromResult(0); + }); + }) + .ConfigureServices(services => + { + services.AddCaching(); + services.AddSession(); }); - app.UseSession(); - - app.Run(context => - { - context.Session.SetString("key", "value"); - return Task.FromResult(0); - }); - }, - services => - { - services.AddCaching(); - services.AddSession(); - })) + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); @@ -392,36 +420,39 @@ namespace Microsoft.AspNet.Session [Fact] public async Task SessionFeature_IsUnregistered_WhenResponseGoingOut_AndAnUnhandledExcetionIsThrown() { - using (var server = TestServer.Create(app => - { - app.Use(async (httpContext, next) => + var builder = new WebApplicationBuilder() + .Configure(app => { - var exceptionThrown = false; - try + app.Use(async (httpContext, next) => { - await next(); - } - catch - { - exceptionThrown = true; - } + var exceptionThrown = false; + try + { + await next(); + } + catch + { + exceptionThrown = true; + } - Assert.True(exceptionThrown); - Assert.Null(httpContext.Features.Get()); + Assert.True(exceptionThrown); + Assert.Null(httpContext.Features.Get()); + }); + + app.UseSession(); + + app.Run(context => + { + throw new InvalidOperationException("An error occurred."); + }); + }) + .ConfigureServices(services => + { + services.AddCaching(); + services.AddSession(); }); - app.UseSession(); - - app.Run(context => - { - throw new InvalidOperationException("An error occurred."); - }); - }, - services => - { - services.AddCaching(); - services.AddSession(); - })) + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); @@ -434,15 +465,18 @@ namespace Microsoft.AspNet.Session // Arrange, Act & Assert var exception = await Assert.ThrowsAsync(async () => { - using (var server = TestServer.Create(app => - { - app.UseSession(); - }, - services => - { - services.AddSingleton(); - services.AddSession(); - })) + var builder = new WebApplicationBuilder() + .Configure(app => + { + app.UseSession(); + }) + .ConfigureServices(services => + { + services.AddSingleton(); + services.AddSession(); + }); + + using (var server = new TestServer(builder)) { var client = server.CreateClient(); await client.GetAsync(string.Empty); @@ -455,23 +489,26 @@ namespace Microsoft.AspNet.Session [Fact] public async Task SessionKeys_AreCaseSensitive() { - using (var server = TestServer.Create(app => - { - app.UseSession(); - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - context.Session.SetString("KEY", "VALUE"); - context.Session.SetString("key", "value"); - Assert.Equal("VALUE", context.Session.GetString("KEY")); - Assert.Equal("value", context.Session.GetString("key")); - return Task.FromResult(0); + app.UseSession(); + app.Run(context => + { + context.Session.SetString("KEY", "VALUE"); + context.Session.SetString("key", "value"); + Assert.Equal("VALUE", context.Session.GetString("KEY")); + Assert.Equal("value", context.Session.GetString("key")); + return Task.FromResult(0); + }); + }) + .ConfigureServices(services => + { + services.AddCaching(); + services.AddSession(); }); - }, - services => - { - services.AddCaching(); - services.AddSession(); - })) + + using (var server = new TestServer(builder)) { var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); From e91ce99c70614efab26825f685dd026e721b0fa0 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Mon, 21 Dec 2015 15:55:38 -0800 Subject: [PATCH 105/295] OptionsModel => Options --- src/Microsoft.AspNet.Session/SessionMiddleware.cs | 2 +- src/Microsoft.AspNet.Session/project.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index b0ce4444ff..f0d00838f9 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -8,7 +8,7 @@ using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.OptionsModel; +using Microsoft.Extensions.Options; namespace Microsoft.AspNet.Session { diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNet.Session/project.json index 851ebd6940..5cf014b90a 100644 --- a/src/Microsoft.AspNet.Session/project.json +++ b/src/Microsoft.AspNet.Session/project.json @@ -9,7 +9,7 @@ "Microsoft.AspNet.Http.Abstractions": "1.0.0-*", "Microsoft.Extensions.Caching.Abstractions": "1.0.0-*", "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", - "Microsoft.Extensions.OptionsModel": "1.0.0-*" + "Microsoft.Extensions.Options": "1.0.0-*" }, "compilationOptions": { "allowUnsafe": true, From c59528e4f9a99344c205e70341e6947320bc71fe Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 5 Jan 2016 18:05:43 -0800 Subject: [PATCH 106/295] Updating to new options pattern --- .../SessionMiddlewareExtensions.cs | 21 +++++++++++++++++++ .../SessionOptions.cs | 3 ++- .../SessionServiceCollectionExtensions.cs | 4 ++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs index 96feb96721..08fea0017c 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs @@ -3,6 +3,7 @@ using System; using Microsoft.AspNet.Session; +using Microsoft.Extensions.Options; namespace Microsoft.AspNet.Builder { @@ -25,5 +26,25 @@ namespace Microsoft.AspNet.Builder return app.UseMiddleware(); } + + /// + /// Adds the to automatically enable session state for the application. + /// + /// The . + /// The . + /// The . + public static IApplicationBuilder UseSession(this IApplicationBuilder app, SessionOptions options) + { + if (app == null) + { + throw new ArgumentNullException(nameof(app)); + } + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + return app.UseMiddleware(Options.Create(options)); + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionOptions.cs b/src/Microsoft.AspNet.Session/SessionOptions.cs index edc83b2f93..2f6fe56d58 100644 --- a/src/Microsoft.AspNet.Session/SessionOptions.cs +++ b/src/Microsoft.AspNet.Session/SessionOptions.cs @@ -2,8 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.AspNet.Session; -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNet.Builder { /// /// Represents the session state options for the application. diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs index 4f20017203..2abcd0d668 100644 --- a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.AspNet.Builder; using Microsoft.AspNet.Session; namespace Microsoft.Extensions.DependencyInjection @@ -22,8 +23,7 @@ namespace Microsoft.Extensions.DependencyInjection { throw new ArgumentNullException(nameof(services)); } - - services.AddOptions(); + services.AddTransient(); return services; } From 09fe466c56d1f719f0cc7bb39ea97fd6a8b0b573 Mon Sep 17 00:00:00 2001 From: Victor Hurdugaci Date: Mon, 11 Jan 2016 14:50:14 -0800 Subject: [PATCH 107/295] Build with dotnet --- .gitattributes | 1 + .gitignore | 2 + .travis.yml | 8 ++- appveyor.yml | 2 +- build.cmd | 68 +++++++++---------- build.sh | 47 +++++++------ makefile.shade | 7 -- .../project.json | 36 ++++++---- 8 files changed, 93 insertions(+), 78 deletions(-) delete mode 100644 makefile.shade diff --git a/.gitattributes b/.gitattributes index bdaa5ba982..1e333226db 100644 --- a/.gitattributes +++ b/.gitattributes @@ -48,3 +48,4 @@ *.fsproj text=auto *.dbproj text=auto *.sln text=auto eol=crlf +*.sh eod=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6d4976b407..10053022ad 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ nuget.exe *.ipch .vs/ project.lock.json +.build/ +.testPublish/ diff --git a/.travis.yml b/.travis.yml index 2fc624899f..bf811dc26a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,11 @@ addons: - libssl-dev - libunwind8 - zlib1g -env: - - KOREBUILD_DNU_RESTORE_CORECLR=true mono: - 4.0.5 +os: + - linux + - osx +osx_image: xcode7.1 script: - - ./build.sh --quiet verify + - ./build.sh verify \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 636a7618d3..3fab83e134 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ init: - git config --global core.autocrlf true build_script: - - build.cmd --quiet verify + - build.cmd verify clone_depth: 1 test: off deploy: off \ No newline at end of file diff --git a/build.cmd b/build.cmd index 553e3929a0..ebb619e737 100644 --- a/build.cmd +++ b/build.cmd @@ -1,40 +1,40 @@ -@echo off -cd %~dp0 - +@ECHO off SETLOCAL + +SET REPO_FOLDER=%~dp0 +CD %REPO_FOLDER% + +SET BUILD_FOLDER=.build +SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet +SET KOREBUILD_VERSION= + +SET NUGET_PATH=%BUILD_FOLDER%\NuGet.exe SET NUGET_VERSION=latest SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe -SET BUILDCMD_KOREBUILD_VERSION= -SET BUILDCMD_DNX_VERSION= -IF EXIST %CACHED_NUGET% goto copynuget -echo Downloading latest version of NuGet.exe... -IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet -@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'" - -:copynuget -IF EXIST .nuget\nuget.exe goto restore -md .nuget -copy %CACHED_NUGET% .nuget\nuget.exe > nul - -:restore -IF EXIST packages\Sake goto getdnx -IF "%BUILDCMD_KOREBUILD_VERSION%"=="" ( - .nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre -) ELSE ( - .nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre -) -.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages - -:getdnx -IF "%BUILDCMD_DNX_VERSION%"=="" ( - SET BUILDCMD_DNX_VERSION=latest -) -IF "%SKIP_DNX_INSTALL%"=="" ( - CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86 -alias default - CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x86 -alias default -) ELSE ( - CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86 +IF NOT EXIST %BUILD_FOLDER% ( + md %BUILD_FOLDER% ) -packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* +IF NOT EXIST %NUGET_PATH% ( + IF NOT EXIST %CACHED_NUGET% ( + echo Downloading latest version of NuGet.exe... + IF NOT EXIST %LocalAppData%\NuGet ( + md %LocalAppData%\NuGet + ) + @powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'" + ) + + copy %CACHED_NUGET% %NUGET_PATH% > nul +) + +IF NOT EXIST %KOREBUILD_FOLDER% ( + SET KOREBUILD_DOWNLOAD_ARGS= + IF NOT "%KOREBUILD_VERSION%"=="" ( + SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION% + ) + + %BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS% +) + +"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %* diff --git a/build.sh b/build.sh index da4e3fcd1c..7b5e25e3a8 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +repoFolder="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +buildFolder=.build +koreBuildFolder=$buildFolder/KoreBuild-dotnet + +nugetPath=$buildFolder/nuget.exe + if test `uname` = Darwin; then cachedir=~/Library/Caches/KBuild else @@ -11,33 +24,25 @@ else fi mkdir -p $cachedir nugetVersion=latest -cachePath=$cachedir/nuget.$nugetVersion.exe +cacheNuget=$cachedir/nuget.$nugetVersion.exe -url=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe +nugetUrl=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe -if test ! -f $cachePath; then - wget -O $cachePath $url 2>/dev/null || curl -o $cachePath --location $url /dev/null +if test ! -d $buildFolder; then + mkdir $buildFolder fi -if test ! -e .nuget; then - mkdir .nuget - cp $cachePath .nuget/nuget.exe +if test ! -f $nugetPath; then + if test ! -f $cacheNuget; then + wget -O $cacheNuget $nugetUrl 2>/dev/null || curl -o $cacheNuget --location $nugetUrl /dev/null + fi + + cp $cacheNuget $nugetPath fi -if test ! -d packages/Sake; then - mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre - mono .nuget/nuget.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages +if test ! -d $koreBuildFolder; then + mono $nugetPath install KoreBuild-dotnet -ExcludeVersion -o $buildFolder -nocache -pre fi -if ! type dnvm > /dev/null 2>&1; then - source packages/KoreBuild/build/dnvm.sh -fi +source $koreBuildFolder/build/KoreBuild.sh -if ! type dnx > /dev/null 2>&1 || [ -z "$SKIP_DNX_INSTALL" ]; then - dnvm install latest -runtime coreclr -alias default - dnvm install default -runtime mono -alias default -else - dnvm use default -runtime mono -fi - -mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@" diff --git a/makefile.shade b/makefile.shade deleted file mode 100644 index 562494d144..0000000000 --- a/makefile.shade +++ /dev/null @@ -1,7 +0,0 @@ - -var VERSION='0.1' -var FULL_VERSION='0.1' -var AUTHORS='Microsoft Open Technologies, Inc.' - -use-standard-lifecycle -k-standard-goals diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNet.Session.Tests/project.json index 1c42d8113f..1d8bcbbc30 100644 --- a/test/Microsoft.AspNet.Session.Tests/project.json +++ b/test/Microsoft.AspNet.Session.Tests/project.json @@ -1,16 +1,28 @@ { - "dependencies": { - "Microsoft.AspNet.Session": "1.0.0-*", - "Microsoft.AspNet.TestHost": "1.0.0-*", - "Microsoft.Extensions.Caching.Memory": "1.0.0-*", - "Microsoft.Extensions.Logging.Testing": "1.0.0-*", + "dependencies": { + "Microsoft.AspNet.Session": "1.0.0-*", + "Microsoft.AspNet.TestHost": "1.0.0-*", + "Microsoft.Extensions.Caching.Memory": "1.0.0-*", + "Microsoft.Extensions.Logging.Testing": "1.0.0-*", + "xunit": "2.1.0" + }, + "testRunner": "xunit", + "commands": { + "test": "xunit.runner.aspnet" + }, + "frameworks": { + "dnx451": { + "frameworkAssemblies": { + "System.Threading.Tasks": "" + }, + "dependencies": { + "xunit.runner.console": "2.1.0" + } + }, + "dnxcore50": { + "dependencies": { "xunit.runner.aspnet": "2.0.0-aspnet-*" - }, - "commands": { - "test": "xunit.runner.aspnet" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } + } } + } } From c1359a2166d5500c2b6fbae8e3ea8dde1a204f93 Mon Sep 17 00:00:00 2001 From: Chris R Date: Tue, 12 Jan 2016 14:31:03 -0800 Subject: [PATCH 108/295] React to hosting API changes. --- samples/SessionSample/Startup.cs | 1 + samples/SessionSample/project.json | 1 + 2 files changed, 2 insertions(+) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 8ea3a5af80..5344ad7a37 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -80,6 +80,7 @@ namespace SessionSample { var application = new WebApplicationBuilder() .UseConfiguration(WebApplicationConfiguration.GetDefault(args)) + .UseIISPlatformHandlerUrl() .UseStartup() .Build(); diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index e8bf22b968..238b600e10 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -6,6 +6,7 @@ "web": "SessionSample" }, "dependencies": { + "Microsoft.AspNet.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", "Microsoft.AspNet.Session": "1.0.0-*", "Microsoft.Extensions.Caching.Memory": "1.0.0-*", From 89faa2fc4cacc08b2e9be51903080625391f1c52 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 14 Jan 2016 16:41:15 -0800 Subject: [PATCH 109/295] Updating build script --- build.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index 7b5e25e3a8..263fb667a8 100755 --- a/build.sh +++ b/build.sh @@ -1,13 +1,5 @@ #!/usr/bin/env bash -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done -repoFolder="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - buildFolder=.build koreBuildFolder=$buildFolder/KoreBuild-dotnet @@ -42,7 +34,12 @@ fi if test ! -d $koreBuildFolder; then mono $nugetPath install KoreBuild-dotnet -ExcludeVersion -o $buildFolder -nocache -pre + chmod +x $koreBuildFolder/build/KoreBuild.sh fi -source $koreBuildFolder/build/KoreBuild.sh +makeFile=makefile.shade +if [ ! -e $makeFile ]; then + makeFile=$koreBuildFolder/build/makefile.shade +fi +./$koreBuildFolder/build/KoreBuild.sh -n $nugetPath -m $makeFile "$@" From 9ae4e9e3dd3990944caba085c8f046501efa4a98 Mon Sep 17 00:00:00 2001 From: John Luo Date: Sun, 17 Jan 2016 17:34:55 -0800 Subject: [PATCH 110/295] Reacting to hosting rename --- samples/SessionSample/Startup.cs | 6 ++--- .../SessionTests.cs | 24 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 5344ad7a37..154124cf6a 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -78,13 +78,13 @@ namespace SessionSample public static void Main(string[] args) { - var application = new WebApplicationBuilder() - .UseConfiguration(WebApplicationConfiguration.GetDefault(args)) + var host = new WebHostBuilder() + .UseDefaultConfiguration(args) .UseIISPlatformHandlerUrl() .UseStartup() .Build(); - application.Run(); + host.Run(); } } } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs index 287a7eae8d..2903e7214c 100644 --- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Session [Fact] public async Task ReadingEmptySessionDoesNotCreateCookie() { - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.UseSession(); @@ -57,7 +57,7 @@ namespace Microsoft.AspNet.Session [Fact] public async Task SettingAValueCausesTheCookieToBeCreated() { - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.UseSession(); @@ -90,7 +90,7 @@ namespace Microsoft.AspNet.Session [Fact] public async Task SessionCanBeAccessedOnTheNextRequest() { - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.UseSession(); @@ -132,7 +132,7 @@ namespace Microsoft.AspNet.Session [Fact] public async Task RemovedItemCannotBeAccessedAgain() { - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.UseSession(); @@ -184,7 +184,7 @@ namespace Microsoft.AspNet.Session [Fact] public async Task ClearedItemsCannotBeAccessedAgain() { - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.UseSession(); @@ -237,7 +237,7 @@ namespace Microsoft.AspNet.Session { var sink = new TestSink(); var loggerFactory = new TestLoggerFactory(sink, enabled: true); - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.UseSession(); @@ -273,7 +273,7 @@ namespace Microsoft.AspNet.Session { var sink = new TestSink(); var loggerFactory = new TestLoggerFactory(sink, enabled: true); - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.UseSession(); @@ -327,7 +327,7 @@ namespace Microsoft.AspNet.Session public async Task RefreshesSession_WhenSessionData_IsNotModified() { var clock = new TestClock(); - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.UseSession(); @@ -385,7 +385,7 @@ namespace Microsoft.AspNet.Session [Fact] public async Task SessionFeature_IsUnregistered_WhenResponseGoingOut() { - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.Use(async (httpContext, next) => @@ -420,7 +420,7 @@ namespace Microsoft.AspNet.Session [Fact] public async Task SessionFeature_IsUnregistered_WhenResponseGoingOut_AndAnUnhandledExcetionIsThrown() { - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.Use(async (httpContext, next) => @@ -465,7 +465,7 @@ namespace Microsoft.AspNet.Session // Arrange, Act & Assert var exception = await Assert.ThrowsAsync(async () => { - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.UseSession(); @@ -489,7 +489,7 @@ namespace Microsoft.AspNet.Session [Fact] public async Task SessionKeys_AreCaseSensitive() { - var builder = new WebApplicationBuilder() + var builder = new WebHostBuilder() .Configure(app => { app.UseSession(); From bebac7151a1ab6adf3d856f3455c9d1e5eb4d3ec Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Fri, 22 Jan 2016 12:16:41 -0800 Subject: [PATCH 111/295] Rename AspNet 5 folders and files. See https://github.com/aspnet/Announcements/issues/144 for more information. --- .../DistributedSession.cs | 0 .../DistributedSessionStore.cs | 0 .../ISessionStore.cs | 0 .../LoggingExtensions.cs | 0 .../Microsoft.AspNetCore.Session.xproj} | 0 .../Properties/AssemblyInfo.cs | 0 .../Properties/Resources.Designer.cs | 0 .../Resources.resx | 0 .../SessionDefaults.cs | 0 .../SessionFeature.cs | 0 .../SessionMiddleware.cs | 0 .../SessionMiddlewareExtensions.cs | 0 .../SessionOptions.cs | 0 .../SessionServiceCollectionExtensions.cs | 0 .../SipHash.cs | 0 .../project.json | 0 .../Microsoft.AspNetCore.Session.Tests.xproj} | 0 .../SessionTests.cs | 0 .../TestExtensions.cs | 0 .../project.json | 0 20 files changed, 0 insertions(+), 0 deletions(-) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/DistributedSession.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/DistributedSessionStore.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/ISessionStore.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/LoggingExtensions.cs (100%) rename src/{Microsoft.AspNet.Session/Microsoft.AspNet.Session.xproj => Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj} (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/Properties/AssemblyInfo.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/Properties/Resources.Designer.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/Resources.resx (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/SessionDefaults.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/SessionFeature.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/SessionMiddleware.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/SessionMiddlewareExtensions.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/SessionOptions.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/SessionServiceCollectionExtensions.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/SipHash.cs (100%) rename src/{Microsoft.AspNet.Session => Microsoft.AspNetCore.Session}/project.json (100%) rename test/{Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.xproj => Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj} (100%) rename test/{Microsoft.AspNet.Session.Tests => Microsoft.AspNetCore.Session.Tests}/SessionTests.cs (100%) rename test/{Microsoft.AspNet.Session.Tests => Microsoft.AspNetCore.Session.Tests}/TestExtensions.cs (100%) rename test/{Microsoft.AspNet.Session.Tests => Microsoft.AspNetCore.Session.Tests}/project.json (100%) diff --git a/src/Microsoft.AspNet.Session/DistributedSession.cs b/src/Microsoft.AspNetCore.Session/DistributedSession.cs similarity index 100% rename from src/Microsoft.AspNet.Session/DistributedSession.cs rename to src/Microsoft.AspNetCore.Session/DistributedSession.cs diff --git a/src/Microsoft.AspNet.Session/DistributedSessionStore.cs b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs similarity index 100% rename from src/Microsoft.AspNet.Session/DistributedSessionStore.cs rename to src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs diff --git a/src/Microsoft.AspNet.Session/ISessionStore.cs b/src/Microsoft.AspNetCore.Session/ISessionStore.cs similarity index 100% rename from src/Microsoft.AspNet.Session/ISessionStore.cs rename to src/Microsoft.AspNetCore.Session/ISessionStore.cs diff --git a/src/Microsoft.AspNet.Session/LoggingExtensions.cs b/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Session/LoggingExtensions.cs rename to src/Microsoft.AspNetCore.Session/LoggingExtensions.cs diff --git a/src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.xproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj similarity index 100% rename from src/Microsoft.AspNet.Session/Microsoft.AspNet.Session.xproj rename to src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj diff --git a/src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs similarity index 100% rename from src/Microsoft.AspNet.Session/Properties/AssemblyInfo.cs rename to src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs diff --git a/src/Microsoft.AspNet.Session/Properties/Resources.Designer.cs b/src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs similarity index 100% rename from src/Microsoft.AspNet.Session/Properties/Resources.Designer.cs rename to src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs diff --git a/src/Microsoft.AspNet.Session/Resources.resx b/src/Microsoft.AspNetCore.Session/Resources.resx similarity index 100% rename from src/Microsoft.AspNet.Session/Resources.resx rename to src/Microsoft.AspNetCore.Session/Resources.resx diff --git a/src/Microsoft.AspNet.Session/SessionDefaults.cs b/src/Microsoft.AspNetCore.Session/SessionDefaults.cs similarity index 100% rename from src/Microsoft.AspNet.Session/SessionDefaults.cs rename to src/Microsoft.AspNetCore.Session/SessionDefaults.cs diff --git a/src/Microsoft.AspNet.Session/SessionFeature.cs b/src/Microsoft.AspNetCore.Session/SessionFeature.cs similarity index 100% rename from src/Microsoft.AspNet.Session/SessionFeature.cs rename to src/Microsoft.AspNetCore.Session/SessionFeature.cs diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs similarity index 100% rename from src/Microsoft.AspNet.Session/SessionMiddleware.cs rename to src/Microsoft.AspNetCore.Session/SessionMiddleware.cs diff --git a/src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Session/SessionMiddlewareExtensions.cs rename to src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs diff --git a/src/Microsoft.AspNet.Session/SessionOptions.cs b/src/Microsoft.AspNetCore.Session/SessionOptions.cs similarity index 100% rename from src/Microsoft.AspNet.Session/SessionOptions.cs rename to src/Microsoft.AspNetCore.Session/SessionOptions.cs diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs rename to src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs diff --git a/src/Microsoft.AspNet.Session/SipHash.cs b/src/Microsoft.AspNetCore.Session/SipHash.cs similarity index 100% rename from src/Microsoft.AspNet.Session/SipHash.cs rename to src/Microsoft.AspNetCore.Session/SipHash.cs diff --git a/src/Microsoft.AspNet.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json similarity index 100% rename from src/Microsoft.AspNet.Session/project.json rename to src/Microsoft.AspNetCore.Session/project.json diff --git a/test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.xproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj similarity index 100% rename from test/Microsoft.AspNet.Session.Tests/Microsoft.AspNet.Session.Tests.xproj rename to test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs similarity index 100% rename from test/Microsoft.AspNet.Session.Tests/SessionTests.cs rename to test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs diff --git a/test/Microsoft.AspNet.Session.Tests/TestExtensions.cs b/test/Microsoft.AspNetCore.Session.Tests/TestExtensions.cs similarity index 100% rename from test/Microsoft.AspNet.Session.Tests/TestExtensions.cs rename to test/Microsoft.AspNetCore.Session.Tests/TestExtensions.cs diff --git a/test/Microsoft.AspNet.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json similarity index 100% rename from test/Microsoft.AspNet.Session.Tests/project.json rename to test/Microsoft.AspNetCore.Session.Tests/project.json From ea0c57122d7f9e3fcec92b8a4406c60618147e62 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Fri, 22 Jan 2016 12:16:42 -0800 Subject: [PATCH 112/295] Rename AspNet 5 file contents. See https://github.com/aspnet/Announcements/issues/144 for more information. --- NuGetPackageVerifier.json | 2 +- Session.sln | 6 +++--- samples/SessionSample/Startup.cs | 6 +++--- samples/SessionSample/hosting.json | 4 ++-- samples/SessionSample/project.json | 6 +++--- .../DistributedSession.cs | 4 ++-- .../DistributedSessionStore.cs | 4 ++-- src/Microsoft.AspNetCore.Session/ISessionStore.cs | 4 ++-- .../Properties/Resources.Designer.cs | 4 ++-- src/Microsoft.AspNetCore.Session/SessionDefaults.cs | 2 +- src/Microsoft.AspNetCore.Session/SessionFeature.cs | 4 ++-- .../SessionMiddleware.cs | 8 ++++---- .../SessionMiddlewareExtensions.cs | 4 ++-- src/Microsoft.AspNetCore.Session/SessionOptions.cs | 4 ++-- .../SessionServiceCollectionExtensions.cs | 4 ++-- src/Microsoft.AspNetCore.Session/SipHash.cs | 4 ++-- src/Microsoft.AspNetCore.Session/project.json | 2 +- .../SessionTests.cs | 12 ++++++------ .../TestExtensions.cs | 4 ++-- test/Microsoft.AspNetCore.Session.Tests/project.json | 4 ++-- 20 files changed, 46 insertions(+), 46 deletions(-) diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json index a925467083..0611a268af 100644 --- a/NuGetPackageVerifier.json +++ b/NuGetPackageVerifier.json @@ -9,7 +9,7 @@ "StrictSemanticVersionValidationRule" ], "packages": { - "Microsoft.AspNet.Session": { } + "Microsoft.AspNetCore.Session": { } } }, "Default": { // Rules to run for packages not listed in any other set. diff --git a/Session.sln b/Session.sln index c1c9671948..ea16779ff6 100644 --- a/Session.sln +++ b/Session.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.22625.0 @@ -7,9 +7,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A189F10C-3A9C-4F81-83D0-32E5FE50DAD8}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session", "src\Microsoft.AspNet.Session\Microsoft.AspNet.Session.xproj", "{71802736-F640-4733-9671-02D267EDD76A}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Session", "src\Microsoft.AspNetCore.Session\Microsoft.AspNetCore.Session.xproj", "{71802736-F640-4733-9671-02D267EDD76A}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Session.Tests", "test\Microsoft.AspNet.Session.Tests\Microsoft.AspNet.Session.Tests.xproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Session.Tests", "test\Microsoft.AspNetCore.Session.Tests\Microsoft.AspNetCore.Session.Tests.xproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE}" EndProject diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 154124cf6a..64d1de4638 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Hosting; -using Microsoft.AspNet.Http; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; diff --git a/samples/SessionSample/hosting.json b/samples/SessionSample/hosting.json index f8ef14574d..6a93dbafa8 100644 --- a/samples/SessionSample/hosting.json +++ b/samples/SessionSample/hosting.json @@ -1,3 +1,3 @@ -{ - "server": "Microsoft.AspNet.Server.Kestrel" +{ + "server": "Microsoft.AspNetCore.Server.Kestrel" } diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 238b600e10..0385620785 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -6,9 +6,9 @@ "web": "SessionSample" }, "dependencies": { - "Microsoft.AspNet.IISPlatformHandler": "1.0.0-*", - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Session": "1.0.0-*", + "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*", + "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", + "Microsoft.AspNetCore.Session": "1.0.0-*", "Microsoft.Extensions.Caching.Memory": "1.0.0-*", "Microsoft.Extensions.Caching.Redis": "1.0.0-*", "Microsoft.Extensions.Caching.SqlServer": "1.0.0-*", diff --git a/src/Microsoft.AspNetCore.Session/DistributedSession.cs b/src/Microsoft.AspNetCore.Session/DistributedSession.cs index 04c2c3aed1..2a06b62075 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSession.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSession.cs @@ -7,11 +7,11 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; -using Microsoft.AspNet.Http.Features; +using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Logging; -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNetCore.Session { public class DistributedSession : ISession { diff --git a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs index 27b3b88372..7605dd1d77 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs @@ -2,11 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http.Features; +using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Logging; -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNetCore.Session { public class DistributedSessionStore : ISessionStore { diff --git a/src/Microsoft.AspNetCore.Session/ISessionStore.cs b/src/Microsoft.AspNetCore.Session/ISessionStore.cs index 14d22d9af7..68a62aeb63 100644 --- a/src/Microsoft.AspNetCore.Session/ISessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/ISessionStore.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http.Features; +using Microsoft.AspNetCore.Http.Features; -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNetCore.Session { public interface ISessionStore { diff --git a/src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs b/src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs index 4ee53d8b6c..d071f6b698 100644 --- a/src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs +++ b/src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs @@ -1,5 +1,5 @@ // -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNetCore.Session { using System.Globalization; using System.Reflection; @@ -8,7 +8,7 @@ namespace Microsoft.AspNet.Session internal static class Resources { private static readonly ResourceManager _resourceManager - = new ResourceManager("Microsoft.AspNet.Session.Resources", typeof(Resources).GetTypeInfo().Assembly); + = new ResourceManager("Microsoft.AspNetCore.Session.Resources", typeof(Resources).GetTypeInfo().Assembly); /// /// The key cannot be longer than '{0}' when encoded with UTF-8. diff --git a/src/Microsoft.AspNetCore.Session/SessionDefaults.cs b/src/Microsoft.AspNetCore.Session/SessionDefaults.cs index 1fb6859cab..31c8748dc4 100644 --- a/src/Microsoft.AspNetCore.Session/SessionDefaults.cs +++ b/src/Microsoft.AspNetCore.Session/SessionDefaults.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNetCore.Session { /// /// Represents defaults for the Session. diff --git a/src/Microsoft.AspNetCore.Session/SessionFeature.cs b/src/Microsoft.AspNetCore.Session/SessionFeature.cs index 6fba066552..9a46919896 100644 --- a/src/Microsoft.AspNetCore.Session/SessionFeature.cs +++ b/src/Microsoft.AspNetCore.Session/SessionFeature.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNet.Http.Features; +using Microsoft.AspNetCore.Http.Features; -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNetCore.Session { public class SessionFeature : ISessionFeature { diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs index f0d00838f9..a97177ed93 100644 --- a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs @@ -4,13 +4,13 @@ using System; using System.Security.Cryptography; using System.Threading.Tasks; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Http.Features; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNetCore.Session { /// /// Enables the session state for the application. diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs b/src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs index 08fea0017c..c273124379 100644 --- a/src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Session; +using Microsoft.AspNetCore.Session; using Microsoft.Extensions.Options; -namespace Microsoft.AspNet.Builder +namespace Microsoft.AspNetCore.Builder { /// /// Extension methods for adding the to an application. diff --git a/src/Microsoft.AspNetCore.Session/SessionOptions.cs b/src/Microsoft.AspNetCore.Session/SessionOptions.cs index 2f6fe56d58..12caa678ad 100644 --- a/src/Microsoft.AspNetCore.Session/SessionOptions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionOptions.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Session; +using Microsoft.AspNetCore.Session; -namespace Microsoft.AspNet.Builder +namespace Microsoft.AspNetCore.Builder { /// /// Represents the session state options for the application. diff --git a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs index 2abcd0d668..8f0d184d58 100644 --- a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Session; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Session; namespace Microsoft.Extensions.DependencyInjection { diff --git a/src/Microsoft.AspNetCore.Session/SipHash.cs b/src/Microsoft.AspNetCore.Session/SipHash.cs index 18afddf1e9..bad98fcab3 100644 --- a/src/Microsoft.AspNetCore.Session/SipHash.cs +++ b/src/Microsoft.AspNetCore.Session/SipHash.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNetCore.Session { // A byte[] equality comparer based on the SipHash-2-4 algorithm. Key differences: // (a) we output 32-bit hashes instead of 64-bit hashes, and @@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Session // and aren't returned to user code. // // Derived from the implementation in SignalR and modified to address byte[] instead of string. This derived version is not for cryptographic use, just hash codes. - // https://github.com/aspnet/SignalR-Server/blob/75f74169c81a51780f195d06b798302b2d76dbde/src/Microsoft.AspNet.SignalR.Server/Infrastructure/SipHashBasedStringEqualityComparer.cs + // https://github.com/aspnet/SignalR-Server/blob/75f74169c81a51780f195d06b798302b2d76dbde/src/Microsoft.AspNetCore.SignalR.Server/Infrastructure/SipHashBasedStringEqualityComparer.cs // Derivative work of https://github.com/tanglebones/ch-siphash. internal static class SipHash { diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 5cf014b90a..a625347596 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -6,7 +6,7 @@ "url": "git://github.com/aspnet/session" }, "dependencies": { - "Microsoft.AspNet.Http.Abstractions": "1.0.0-*", + "Microsoft.AspNetCore.Http.Abstractions": "1.0.0-*", "Microsoft.Extensions.Caching.Abstractions": "1.0.0-*", "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", "Microsoft.Extensions.Options": "1.0.0-*" diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 2903e7214c..2df22a23f4 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -6,11 +6,11 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Hosting; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Http.Features; -using Microsoft.AspNet.TestHost; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.DependencyInjection; @@ -20,7 +20,7 @@ using Microsoft.Extensions.Logging.Testing; using Microsoft.Net.Http.Headers; using Xunit; -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNetCore.Session { public class SessionTests { diff --git a/test/Microsoft.AspNetCore.Session.Tests/TestExtensions.cs b/test/Microsoft.AspNetCore.Session.Tests/TestExtensions.cs index f14be16e54..ddd2152589 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/TestExtensions.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/TestExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Logging.Testing; -namespace Microsoft.AspNet.Session +namespace Microsoft.AspNetCore.Session { public static class TestExtensions { diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 1d8bcbbc30..08aba5bc99 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -1,7 +1,7 @@ { "dependencies": { - "Microsoft.AspNet.Session": "1.0.0-*", - "Microsoft.AspNet.TestHost": "1.0.0-*", + "Microsoft.AspNetCore.Session": "1.0.0-*", + "Microsoft.AspNetCore.TestHost": "1.0.0-*", "Microsoft.Extensions.Caching.Memory": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", "xunit": "2.1.0" From 8b29de899376ae57e38b9a467ed30a3b792031ea Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 25 Jan 2016 13:56:14 -0800 Subject: [PATCH 113/295] Remove ISessionStore.Connect in raction to removal of IDistrbutedCache.Connect. --- .../DistributedSessionStore.cs | 5 --- .../ISessionStore.cs | 2 +- .../SessionMiddleware.cs | 1 - .../SessionTests.cs | 37 ------------------- 4 files changed, 1 insertion(+), 44 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs index 7605dd1d77..e170d08df8 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs @@ -37,11 +37,6 @@ namespace Microsoft.AspNetCore.Session } } - public void Connect() - { - _cache.Connect(); - } - public ISession Create(string sessionId, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey) { if (string.IsNullOrEmpty(sessionId)) diff --git a/src/Microsoft.AspNetCore.Session/ISessionStore.cs b/src/Microsoft.AspNetCore.Session/ISessionStore.cs index 68a62aeb63..17a3261b97 100644 --- a/src/Microsoft.AspNetCore.Session/ISessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/ISessionStore.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Session public interface ISessionStore { bool IsAvailable { get; } - void Connect(); + ISession Create(string sessionId, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey); } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs index a97177ed93..23ccd289ce 100644 --- a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs @@ -62,7 +62,6 @@ namespace Microsoft.AspNetCore.Session _logger = loggerFactory.CreateLogger(); _options = options.Value; _sessionStore = sessionStore; - _sessionStore.Connect(); } /// diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 2df22a23f4..8e224f050e 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -459,33 +459,6 @@ namespace Microsoft.AspNetCore.Session } } - [Fact] - public async Task SessionMiddleware_DoesNotStart_IfUnderlyingStoreIsUnavailable() - { - // Arrange, Act & Assert - var exception = await Assert.ThrowsAsync(async () => - { - var builder = new WebHostBuilder() - .Configure(app => - { - app.UseSession(); - }) - .ConfigureServices(services => - { - services.AddSingleton(); - services.AddSession(); - }); - - using (var server = new TestServer(builder)) - { - var client = server.CreateClient(); - await client.GetAsync(string.Empty); - } - }); - - Assert.Equal("Error connecting database.", exception.Message); - } - [Fact] public async Task SessionKeys_AreCaseSensitive() { @@ -533,16 +506,6 @@ namespace Microsoft.AspNetCore.Session private class TestDistributedCache : IDistributedCache { - public void Connect() - { - throw new InvalidOperationException("Error connecting database."); - } - - public Task ConnectAsync() - { - throw new InvalidOperationException("Error connecting database."); - } - public byte[] Get(string key) { throw new NotImplementedException(); From 461fd40251eb735f3eeb8070e39074e56864800e Mon Sep 17 00:00:00 2001 From: John Luo Date: Wed, 3 Feb 2016 12:02:12 -0800 Subject: [PATCH 114/295] Updating to new CLI --- samples/SessionSample/project.json | 3 ++- test/Microsoft.AspNetCore.Session.Tests/project.json | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 0385620785..d09b78e314 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -12,7 +12,8 @@ "Microsoft.Extensions.Caching.Memory": "1.0.0-*", "Microsoft.Extensions.Caching.Redis": "1.0.0-*", "Microsoft.Extensions.Caching.SqlServer": "1.0.0-*", - "Microsoft.Extensions.Logging.Console": "1.0.0-*" + "Microsoft.Extensions.Logging.Console": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" }, "exclude": "wwwroot/**/*.*", "frameworks": { diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 08aba5bc99..dc30f9faac 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -4,6 +4,7 @@ "Microsoft.AspNetCore.TestHost": "1.0.0-*", "Microsoft.Extensions.Caching.Memory": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", + "Microsoft.NETCore.Platforms": "1.0.1-*", "xunit": "2.1.0" }, "testRunner": "xunit", @@ -22,7 +23,8 @@ "dnxcore50": { "dependencies": { "xunit.runner.aspnet": "2.0.0-aspnet-*" - } + }, + "imports": "portable-net451+win8" } } } From c9d8a1330e6b9d7cd7534b9dd40d7c6c736323ad Mon Sep 17 00:00:00 2001 From: Hisham Bin Ateya Date: Wed, 3 Feb 2016 23:53:13 +0300 Subject: [PATCH 115/295] Add 'UseServer' --- samples/SessionSample/Startup.cs | 1 + samples/SessionSample/hosting.json | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 samples/SessionSample/hosting.json diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 64d1de4638..b4dce011d4 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -80,6 +80,7 @@ namespace SessionSample { var host = new WebHostBuilder() .UseDefaultConfiguration(args) + .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseIISPlatformHandlerUrl() .UseStartup() .Build(); diff --git a/samples/SessionSample/hosting.json b/samples/SessionSample/hosting.json deleted file mode 100644 index 6a93dbafa8..0000000000 --- a/samples/SessionSample/hosting.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel" -} From c00a2de2c7df8185418cafff457c6ed3c7c6d91e Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Fri, 5 Feb 2016 16:13:30 -0800 Subject: [PATCH 116/295] Enabled tests to run in dotnet xunit runner --- build.cmd | 9 ++++----- .../project.json | 20 +++++++++---------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/build.cmd b/build.cmd index ebb619e737..fa5e51f81e 100644 --- a/build.cmd +++ b/build.cmd @@ -28,12 +28,11 @@ IF NOT EXIST %NUGET_PATH% ( copy %CACHED_NUGET% %NUGET_PATH% > nul ) +SET KOREBUILD_DOWNLOAD_ARGS= +IF NOT "%KOREBUILD_VERSION%"=="" ( + SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION% +) IF NOT EXIST %KOREBUILD_FOLDER% ( - SET KOREBUILD_DOWNLOAD_ARGS= - IF NOT "%KOREBUILD_VERSION%"=="" ( - SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION% - ) - %BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS% ) diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index dc30f9faac..e158ff0d08 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -8,23 +8,21 @@ "xunit": "2.1.0" }, "testRunner": "xunit", - "commands": { - "test": "xunit.runner.aspnet" - }, "frameworks": { + "dnxcore50": { + "dependencies": { + "dotnet-test-xunit": "1.0.0-dev-*", + "Microsoft.NETCore.Platforms": "1.0.1-*" + }, + "imports": "portable-net451+win8" + }, "dnx451": { "frameworkAssemblies": { - "System.Threading.Tasks": "" + "System.Threading.Tasks": "" }, "dependencies": { "xunit.runner.console": "2.1.0" } - }, - "dnxcore50": { - "dependencies": { - "xunit.runner.aspnet": "2.0.0-aspnet-*" - }, - "imports": "portable-net451+win8" } } -} +} \ No newline at end of file From 4bbea583b096e0c4d77d8401f2e3249d72620f52 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Fri, 19 Feb 2016 11:17:16 -0800 Subject: [PATCH 117/295] Enabled xml doc generation --- NuGetPackageVerifier.json | 14 ++------------ src/Microsoft.AspNetCore.Session/project.json | 4 +++- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json index 0611a268af..bf800fecdf 100644 --- a/NuGetPackageVerifier.json +++ b/NuGetPackageVerifier.json @@ -1,12 +1,7 @@ { "adx": { // Packages written by the ADX team and that ship on NuGet.org "rules": [ - "AssemblyHasDocumentFileRule", - "AssemblyHasVersionAttributesRule", - "AssemblyHasServicingAttributeRule", - "AssemblyHasNeutralResourcesLanguageAttributeRule", - "SatellitePackageRule", - "StrictSemanticVersionValidationRule" + "AdxVerificationCompositeRule" ], "packages": { "Microsoft.AspNetCore.Session": { } @@ -14,12 +9,7 @@ }, "Default": { // Rules to run for packages not listed in any other set. "rules": [ - "AssemblyHasDocumentFileRule", - "AssemblyHasVersionAttributesRule", - "AssemblyHasServicingAttributeRule", - "AssemblyHasNeutralResourcesLanguageAttributeRule", - "SatellitePackageRule", - "StrictSemanticVersionValidationRule" + "DefaultCompositeRule" ] } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index a625347596..11f4b7001e 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -14,7 +14,9 @@ "compilationOptions": { "allowUnsafe": true, "warningsAsErrors": true, - "keyFile": "../../tools/Key.snk" + "keyFile": "../../tools/Key.snk", + "nowarn": [ "CS1591" ], + "xmlDoc": true }, "frameworks": { "net451": {}, From 342fe0b38b1183362d51ca8a3f66cfeca4e49354 Mon Sep 17 00:00:00 2001 From: John Luo Date: Fri, 19 Feb 2016 16:41:46 -0800 Subject: [PATCH 118/295] Updating test TFMs for custom test discovery --- test/Microsoft.AspNetCore.Session.Tests/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index e158ff0d08..7cb18b919e 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -16,7 +16,7 @@ }, "imports": "portable-net451+win8" }, - "dnx451": { + "net451": { "frameworkAssemblies": { "System.Threading.Tasks": "" }, From 46f6fa85d5c7366ee3a383cbe92c10146127f916 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Wed, 17 Feb 2016 09:11:19 -0800 Subject: [PATCH 119/295] Minor fix to service collection extensions --- .gitignore | 1 + .../SessionServiceCollectionExtensions.cs | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 10053022ad..f76d5c553d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ nuget.exe project.lock.json .build/ .testPublish/ +launchSettings.json \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs index 8f0d184d58..af5c9c4344 100644 --- a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs @@ -16,16 +16,14 @@ namespace Microsoft.Extensions.DependencyInjection /// Adds services required for application session state. /// /// The to add the services to. - /// The . - public static IServiceCollection AddSession(this IServiceCollection services) + public static void AddSession(this IServiceCollection services) { if (services == null) { throw new ArgumentNullException(nameof(services)); } - + services.AddTransient(); - return services; } /// @@ -33,16 +31,20 @@ namespace Microsoft.Extensions.DependencyInjection /// /// The to add the services to. /// The session options to configure the middleware with. - /// The . - public static IServiceCollection AddSession(this IServiceCollection services, Action configure) + public static void AddSession(this IServiceCollection services, Action configure) { if (services == null) { throw new ArgumentNullException(nameof(services)); } + if (configure == null) + { + throw new ArgumentNullException(nameof(configure)); + } + services.Configure(configure); - return services.AddSession(); + services.AddSession(); } } } \ No newline at end of file From b3bc995d316685379291a47403fb108f37eb8069 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Wed, 24 Feb 2016 13:05:45 -0800 Subject: [PATCH 120/295] Update `build.cmd` to match latest template - aspnet/Universe#347 - `%KOREBUILD_VERSION%` doesn't work without this fix --- build.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cmd b/build.cmd index fa5e51f81e..95b049cf63 100644 --- a/build.cmd +++ b/build.cmd @@ -2,7 +2,7 @@ SETLOCAL SET REPO_FOLDER=%~dp0 -CD %REPO_FOLDER% +CD "%REPO_FOLDER%" SET BUILD_FOLDER=.build SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet From 85fea1c9a466a40f48289afdac07b7b70e72faab Mon Sep 17 00:00:00 2001 From: Victor Hurdugaci Date: Sat, 27 Feb 2016 12:51:15 -0800 Subject: [PATCH 121/295] Update the build scripts --- build.cmd | 41 ++----------------------------------- build.ps1 | 36 +++++++++++++++++++++++++++++++++ build.sh | 60 +++++++++++++++++++++++-------------------------------- 3 files changed, 63 insertions(+), 74 deletions(-) create mode 100644 build.ps1 diff --git a/build.cmd b/build.cmd index 95b049cf63..2fa024b15e 100644 --- a/build.cmd +++ b/build.cmd @@ -1,39 +1,2 @@ -@ECHO off -SETLOCAL - -SET REPO_FOLDER=%~dp0 -CD "%REPO_FOLDER%" - -SET BUILD_FOLDER=.build -SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet -SET KOREBUILD_VERSION= - -SET NUGET_PATH=%BUILD_FOLDER%\NuGet.exe -SET NUGET_VERSION=latest -SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe - -IF NOT EXIST %BUILD_FOLDER% ( - md %BUILD_FOLDER% -) - -IF NOT EXIST %NUGET_PATH% ( - IF NOT EXIST %CACHED_NUGET% ( - echo Downloading latest version of NuGet.exe... - IF NOT EXIST %LocalAppData%\NuGet ( - md %LocalAppData%\NuGet - ) - @powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'" - ) - - copy %CACHED_NUGET% %NUGET_PATH% > nul -) - -SET KOREBUILD_DOWNLOAD_ARGS= -IF NOT "%KOREBUILD_VERSION%"=="" ( - SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION% -) -IF NOT EXIST %KOREBUILD_FOLDER% ( - %BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS% -) - -"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %* +@ECHO OFF +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*" \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000000..4fd24a30d5 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,36 @@ +cd $PSScriptRoot + +$repoFolder = $PSScriptRoot +$env:REPO_FOLDER = $repoFolder + +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +if ($env:KOREBUILD_ZIP) +{ + $koreBuildZip=$env:KOREBUILD_ZIP +} + +$buildFolder = ".build" +$buildFile="$buildFolder\KoreBuild.ps1" + +if (!(Test-Path $buildFolder)) { + Write-Host "Downloading KoreBuild from $koreBuildZip" + + $tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid() + New-Item -Path "$tempFolder" -Type directory | Out-Null + + $localZipFile="$tempFolder\korebuild.zip" + + Invoke-WebRequest $koreBuildZip -OutFile $localZipFile + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) + + New-Item -Path "$buildFolder" -Type directory | Out-Null + copy-item "$tempFolder\**\build\*" $buildFolder -Recurse + + # Cleanup + if (Test-Path $tempFolder) { + Remove-Item -Recurse -Force $tempFolder + } +} + +&"$buildFile" $args \ No newline at end of file diff --git a/build.sh b/build.sh index 263fb667a8..79638d06b6 100755 --- a/build.sh +++ b/build.sh @@ -1,45 +1,35 @@ #!/usr/bin/env bash +repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $repoFolder -buildFolder=.build -koreBuildFolder=$buildFolder/KoreBuild-dotnet - -nugetPath=$buildFolder/nuget.exe - -if test `uname` = Darwin; then - cachedir=~/Library/Caches/KBuild -else - if [ -z $XDG_DATA_HOME ]; then - cachedir=$HOME/.local/share - else - cachedir=$XDG_DATA_HOME; - fi +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +if [ ! -z $KOREBUILD_ZIP ]; then + koreBuildZip=$KOREBUILD_ZIP fi -mkdir -p $cachedir -nugetVersion=latest -cacheNuget=$cachedir/nuget.$nugetVersion.exe -nugetUrl=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe +buildFolder=".build" +buildFile="$buildFolder/KoreBuild.sh" if test ! -d $buildFolder; then + echo "Downloading KoreBuild from $koreBuildZip" + + tempFolder="/tmp/KoreBuild-$(uuidgen)" + mkdir $tempFolder + + localZipFile="$tempFolder/korebuild.zip" + + wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip /dev/null + unzip -q -d $tempFolder $localZipFile + mkdir $buildFolder -fi - -if test ! -f $nugetPath; then - if test ! -f $cacheNuget; then - wget -O $cacheNuget $nugetUrl 2>/dev/null || curl -o $cacheNuget --location $nugetUrl /dev/null + cp -r $tempFolder/**/build/** $buildFolder + + chmod +x $buildFile + + # Cleanup + if test ! -d $tempFolder; then + rm -rf $tempFolder fi - - cp $cacheNuget $nugetPath fi -if test ! -d $koreBuildFolder; then - mono $nugetPath install KoreBuild-dotnet -ExcludeVersion -o $buildFolder -nocache -pre - chmod +x $koreBuildFolder/build/KoreBuild.sh -fi - -makeFile=makefile.shade -if [ ! -e $makeFile ]; then - makeFile=$koreBuildFolder/build/makefile.shade -fi - -./$koreBuildFolder/build/KoreBuild.sh -n $nugetPath -m $makeFile "$@" +$buildFile -r $repoFolder "$@" From fb21277a80cc3c22530542d3b17d1d9d558d9bac Mon Sep 17 00:00:00 2001 From: Victor Hurdugaci Date: Sun, 28 Feb 2016 10:12:18 -0800 Subject: [PATCH 122/295] Return the error code from build.cmd --- build.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cmd b/build.cmd index 2fa024b15e..7d4894cb4a 100644 --- a/build.cmd +++ b/build.cmd @@ -1,2 +1,2 @@ @ECHO OFF -PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*" \ No newline at end of file +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" \ No newline at end of file From 6ef4e68ced04077f96cb0edf32e4f95f7151bec3 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Tue, 1 Mar 2016 13:38:23 -0800 Subject: [PATCH 123/295] Transition to netstandard. - dotnet5.X => netstandard1.y (where y = x-1). - DNXCore50 => netstandardapp1.5. - Applied the same changes to ifdefs. --- src/Microsoft.AspNetCore.Session/project.json | 13 +++++++++---- .../Microsoft.AspNetCore.Session.Tests/project.json | 7 +++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 11f4b7001e..e88498c841 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -15,15 +15,20 @@ "allowUnsafe": true, "warningsAsErrors": true, "keyFile": "../../tools/Key.snk", - "nowarn": [ "CS1591" ], + "nowarn": [ + "CS1591" + ], "xmlDoc": true }, "frameworks": { "net451": {}, - "dotnet5.4": { + "netstandard1.3": { "dependencies": { "System.Security.Cryptography.Algorithms": "4.0.0-*" - } + }, + "imports": [ + "dotnet5.4" + ] } } -} +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 7cb18b919e..d83b23776f 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -9,12 +9,15 @@ }, "testRunner": "xunit", "frameworks": { - "dnxcore50": { + "netstandardapp1.5": { "dependencies": { "dotnet-test-xunit": "1.0.0-dev-*", "Microsoft.NETCore.Platforms": "1.0.1-*" }, - "imports": "portable-net451+win8" + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] }, "net451": { "frameworkAssemblies": { From 2f1bb39407ae8c4f30d9203b135ff2835ebf00d3 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Wed, 2 Mar 2016 21:22:43 -0800 Subject: [PATCH 124/295] Remove project name from output path - aspnet/Coherence-Signed#187 - remove `` settings but maintain other unique aspects e.g. `` - in a few cases, standardize on VS version `14.0` and not something more specific --- samples/SessionSample/SessionSample.xproj | 2 +- .../Microsoft.AspNetCore.Session.xproj | 2 +- .../Microsoft.AspNetCore.Session.Tests.xproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/SessionSample/SessionSample.xproj b/samples/SessionSample/SessionSample.xproj index d092ddc3e1..23f0e9a0f1 100644 --- a/samples/SessionSample/SessionSample.xproj +++ b/samples/SessionSample/SessionSample.xproj @@ -8,7 +8,7 @@ fe0b9969-3bde-4a7d-be1b-47eae8dbf365 ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ + ..\..\artifacts\bin\ 2.0 diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj index bfd4661379..18442b5af3 100644 --- a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj +++ b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj @@ -8,7 +8,7 @@ 71802736-f640-4733-9671-02d267edd76a ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ + ..\..\artifacts\bin\ 2.0 diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj index 6171b1b973..2fc2960ef9 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj @@ -8,7 +8,7 @@ 8c131a0a-bc1a-4cf3-8b77-8813fbfe5639 ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ + ..\..\artifacts\bin\ 2.0 From dea425d3b27aaec343a3fb8d9a966f4102f6dd80 Mon Sep 17 00:00:00 2001 From: John Luo Date: Wed, 2 Mar 2016 14:20:16 -0800 Subject: [PATCH 125/295] Update cookie name --- src/Microsoft.AspNetCore.Session/SessionDefaults.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/SessionDefaults.cs b/src/Microsoft.AspNetCore.Session/SessionDefaults.cs index 31c8748dc4..e9f590a0c7 100644 --- a/src/Microsoft.AspNetCore.Session/SessionDefaults.cs +++ b/src/Microsoft.AspNetCore.Session/SessionDefaults.cs @@ -9,9 +9,9 @@ namespace Microsoft.AspNetCore.Session public static class SessionDefaults { /// - /// Represent the default cookie name, which is ".AspNet.Session". + /// Represent the default cookie name, which is ".AspNetCore.Session". /// - public static readonly string CookieName = ".AspNet.Session"; + public static readonly string CookieName = ".AspNetCore.Session"; /// /// Represents the default path used to create the cookie, which is "/". From 7c60cd5fa689ed2baeaa332eed53df284a18a704 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Thu, 3 Mar 2016 17:32:58 -0800 Subject: [PATCH 126/295] Added Company, Copyright and Product attributes to AssemblyInfo --- src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs index b2437d9ad6..76feceeff0 100644 --- a/src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs @@ -5,4 +5,7 @@ using System.Reflection; using System.Resources; [assembly: AssemblyMetadata("Serviceable", "True")] -[assembly: NeutralResourcesLanguage("en-us")] \ No newline at end of file +[assembly: NeutralResourcesLanguage("en-us")] +[assembly: AssemblyCompany("Microsoft Corporation.")] +[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyProduct("Microsoft ASP.NET Core")] From 432de7a15800f1e988ae7cf1b5b5f4ac5a5ef1e7 Mon Sep 17 00:00:00 2001 From: Chris R Date: Fri, 4 Mar 2016 15:11:35 -0800 Subject: [PATCH 127/295] #96 Add a session Id --- .../Properties/launchSettings.json | 25 ++++++ .../DistributedSession.cs | 83 ++++++++++++++++--- .../DistributedSessionStore.cs | 8 +- .../ISessionStore.cs | 2 +- .../LoggingExtensions.cs | 36 ++++++-- .../SessionTests.cs | 12 ++- 6 files changed, 136 insertions(+), 30 deletions(-) create mode 100644 samples/SessionSample/Properties/launchSettings.json diff --git a/samples/SessionSample/Properties/launchSettings.json b/samples/SessionSample/Properties/launchSettings.json new file mode 100644 index 0000000000..bd71d7713a --- /dev/null +++ b/samples/SessionSample/Properties/launchSettings.json @@ -0,0 +1,25 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:2481/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "Hosting:Environment": "Development" + } + }, + "web": { + "commandName": "web", + "environmentVariables": { + "Hosting:Environment": "Development" + } + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/DistributedSession.cs b/src/Microsoft.AspNetCore.Session/DistributedSession.cs index 2a06b62075..e9ae5867e2 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSession.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSession.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; @@ -15,11 +16,14 @@ namespace Microsoft.AspNetCore.Session { public class DistributedSession : ISession { - private const byte SerializationRevision = 1; + private static readonly RandomNumberGenerator CryptoRandom = RandomNumberGenerator.Create(); + private const int IdByteCount = 16; + + private const byte SerializationRevision = 2; private const int KeyLengthLimit = ushort.MaxValue; private readonly IDistributedCache _cache; - private readonly string _sessionId; + private readonly string _sessionKey; private readonly TimeSpan _idleTimeout; private readonly Func _tryEstablishSession; private readonly IDictionary _store; @@ -27,10 +31,12 @@ namespace Microsoft.AspNetCore.Session private bool _isModified; private bool _loaded; private bool _isNewSessionKey; + private string _sessionId; + private byte[] _sessionIdBytes; public DistributedSession( IDistributedCache cache, - string sessionId, + string sessionKey, TimeSpan idleTimeout, Func tryEstablishSession, ILoggerFactory loggerFactory, @@ -41,9 +47,9 @@ namespace Microsoft.AspNetCore.Session throw new ArgumentNullException(nameof(cache)); } - if (string.IsNullOrEmpty(sessionId)) + if (string.IsNullOrEmpty(sessionKey)) { - throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(sessionId)); + throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(sessionKey)); } if (tryEstablishSession == null) @@ -57,7 +63,7 @@ namespace Microsoft.AspNetCore.Session } _cache = cache; - _sessionId = sessionId; + _sessionKey = sessionKey; _idleTimeout = idleTimeout; _tryEstablishSession = tryEstablishSession; _store = new Dictionary(); @@ -65,6 +71,33 @@ namespace Microsoft.AspNetCore.Session _isNewSessionKey = isNewSessionKey; } + public string Id + { + get + { + Load(); // TODO: Silent failure + if (_sessionId == null) + { + _sessionId = new Guid(IdBytes).ToString(); + } + return _sessionId; + } + } + + private byte[] IdBytes + { + get + { + Load(); // TODO: Silent failure + if (_sessionIdBytes == null) + { + _sessionIdBytes = new byte[IdByteCount]; + CryptoRandom.GetBytes(_sessionIdBytes); + } + return _sessionIdBytes; + } + } + public IEnumerable Keys { get @@ -122,7 +155,16 @@ namespace Microsoft.AspNetCore.Session { if (!_loaded) { - LoadAsync().GetAwaiter().GetResult(); + var data = _cache.Get(_sessionKey); + if (data != null) + { + Deserialize(new MemoryStream(data)); + } + else if (!_isNewSessionKey) + { + _logger.AccessingExpiredSession(_sessionKey); + } + _loaded = true; } } @@ -132,14 +174,14 @@ namespace Microsoft.AspNetCore.Session { if (!_loaded) { - var data = await _cache.GetAsync(_sessionId); + var data = await _cache.GetAsync(_sessionKey); if (data != null) { Deserialize(new MemoryStream(data)); } else if (!_isNewSessionKey) { - _logger.AccessingExpiredSession(_sessionId); + _logger.AccessingExpiredSession(_sessionKey); } _loaded = true; } @@ -149,29 +191,35 @@ namespace Microsoft.AspNetCore.Session { if (_isModified) { - var data = await _cache.GetAsync(_sessionId); + var data = await _cache.GetAsync(_sessionKey); if (_logger.IsEnabled(LogLevel.Information) && data == null) { - _logger.SessionStarted(_sessionId); + _logger.SessionStarted(_sessionKey, Id); } _isModified = false; var stream = new MemoryStream(); Serialize(stream); await _cache.SetAsync( - _sessionId, + _sessionKey, stream.ToArray(), new DistributedCacheEntryOptions().SetSlidingExpiration(_idleTimeout)); + + if (_logger.IsEnabled(LogLevel.Debug)) + { + _logger.SessionStored(_sessionKey, Id, _store.Count); + } } else { - await _cache.RefreshAsync(_sessionId); + await _cache.RefreshAsync(_sessionKey); } } // Format: // Serialization revision: 1 byte, range 0-255 // Entry count: 3 bytes, range 0-16,777,215 + // SessionId: IdByteCount bytes (16) // foreach entry: // key name byte length: 2 bytes, range 0-65,535 // UTF-8 encoded key name byte[] @@ -181,6 +229,7 @@ namespace Microsoft.AspNetCore.Session { output.WriteByte(SerializationRevision); SerializeNumAs3Bytes(output, _store.Count); + output.Write(IdBytes, 0, IdByteCount); foreach (var entry in _store) { @@ -203,6 +252,8 @@ namespace Microsoft.AspNetCore.Session } int expectedEntries = DeserializeNumFrom3Bytes(content); + _sessionIdBytes = ReadBytes(content, IdByteCount); + for (int i = 0; i < expectedEntries; i++) { int keyLength = DeserializeNumFrom2Bytes(content); @@ -210,6 +261,12 @@ namespace Microsoft.AspNetCore.Session int dataLength = DeserializeNumFrom4Bytes(content); _store[key] = ReadBytes(content, dataLength); } + + if (_logger.IsEnabled(LogLevel.Debug)) + { + _sessionId = new Guid(_sessionIdBytes).ToString(); + _logger.SessionLoaded(_sessionKey, _sessionId, expectedEntries); + } } private void SerializeNumAs2Bytes(Stream output, int num) diff --git a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs index e170d08df8..41200e9d7e 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs @@ -37,11 +37,11 @@ namespace Microsoft.AspNetCore.Session } } - public ISession Create(string sessionId, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey) + public ISession Create(string sessionKey, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey) { - if (string.IsNullOrEmpty(sessionId)) + if (string.IsNullOrEmpty(sessionKey)) { - throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(sessionId)); + throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(sessionKey)); } if (tryEstablishSession == null) @@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Session throw new ArgumentNullException(nameof(tryEstablishSession)); } - return new DistributedSession(_cache, sessionId, idleTimeout, tryEstablishSession, _loggerFactory, isNewSessionKey); + return new DistributedSession(_cache, sessionKey, idleTimeout, tryEstablishSession, _loggerFactory, isNewSessionKey); } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/ISessionStore.cs b/src/Microsoft.AspNetCore.Session/ISessionStore.cs index 17a3261b97..0b48648c8a 100644 --- a/src/Microsoft.AspNetCore.Session/ISessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/ISessionStore.cs @@ -10,6 +10,6 @@ namespace Microsoft.AspNetCore.Session { bool IsAvailable { get; } - ISession Create(string sessionId, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey); + ISession Create(string sessionKey, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey); } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs b/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs index d9cc0b8654..1dcc93e709 100644 --- a/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs @@ -9,7 +9,9 @@ namespace Microsoft.Extensions.Logging { private static Action _errorClosingTheSession; private static Action _accessingExpiredSession; - private static Action _sessionStarted; + private static Action _sessionStarted; + private static Action _sessionLoaded; + private static Action _sessionStored; static LoggingExtensions() { @@ -20,11 +22,19 @@ namespace Microsoft.Extensions.Logging _accessingExpiredSession = LoggerMessage.Define( eventId: 2, logLevel: LogLevel.Warning, - formatString: "Accessing expired session {SessionId}"); - _sessionStarted = LoggerMessage.Define( + formatString: "Accessing expired session; Key:{sessionKey}"); + _sessionStarted = LoggerMessage.Define( eventId: 3, logLevel: LogLevel.Information, - formatString: "Session {SessionId} started"); + formatString: "Session started; Key:{sessionKey}, Id:{sessionId}"); + _sessionLoaded = LoggerMessage.Define( + eventId: 4, + logLevel: LogLevel.Debug, + formatString: "Session loaded; Key:{sessionKey}, Id:{sessionId}, Count:{count}"); + _sessionStored = LoggerMessage.Define( + eventId: 5, + logLevel: LogLevel.Debug, + formatString: "Session stored; Key:{sessionKey}, Id:{sessionId}, Count:{count}"); } public static void ErrorClosingTheSession(this ILogger logger, Exception exception) @@ -32,14 +42,24 @@ namespace Microsoft.Extensions.Logging _errorClosingTheSession(logger, exception); } - public static void AccessingExpiredSession(this ILogger logger, string sessionId) + public static void AccessingExpiredSession(this ILogger logger, string sessionKey) { - _accessingExpiredSession(logger, sessionId, null); + _accessingExpiredSession(logger, sessionKey, null); } - public static void SessionStarted(this ILogger logger, string sessionId) + public static void SessionStarted(this ILogger logger, string sessionKey, string sessionId) { - _sessionStarted(logger, sessionId, null); + _sessionStarted(logger, sessionKey, sessionId, null); + } + + public static void SessionLoaded(this ILogger logger, string sessionKey, string sessionId, int count) + { + _sessionLoaded(logger, sessionKey, sessionId, count, null); + } + + public static void SessionStored(this ILogger logger, string sessionKey, string sessionId, int count) + { + _sessionStored(logger, sessionKey, sessionId, count, null); } } } diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 8e224f050e..e30f541584 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -262,9 +262,11 @@ namespace Microsoft.AspNetCore.Session var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); - Assert.Single(sessionLogMessages); + Assert.Equal(2, sessionLogMessages.Length); Assert.Contains("started", sessionLogMessages[0].State.ToString()); Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); + Assert.Contains("stored", sessionLogMessages[1].State.ToString()); + Assert.Equal(LogLevel.Debug, sessionLogMessages[1].LogLevel); } } @@ -315,11 +317,13 @@ namespace Microsoft.AspNetCore.Session var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); - Assert.Equal(2, sessionLogMessages.Length); + Assert.Equal(3, sessionLogMessages.Length); Assert.Contains("started", sessionLogMessages[0].State.ToString()); - Assert.Contains("expired", sessionLogMessages[1].State.ToString()); + Assert.Contains("stored", sessionLogMessages[1].State.ToString()); + Assert.Contains("expired", sessionLogMessages[2].State.ToString()); Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); - Assert.Equal(LogLevel.Warning, sessionLogMessages[1].LogLevel); + Assert.Equal(LogLevel.Debug, sessionLogMessages[1].LogLevel); + Assert.Equal(LogLevel.Warning, sessionLogMessages[2].LogLevel); } } From 2b1841fc86fb4b07e19e8e96b229f64e7c23817a Mon Sep 17 00:00:00 2001 From: jacalvar Date: Mon, 7 Mar 2016 16:07:07 -0800 Subject: [PATCH 128/295] React to changes in Caching --- samples/SessionSample/Startup.cs | 3 +- .../SessionTests.cs | 45 ++++++++++++++----- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index b4dce011d4..86a1303f69 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -33,7 +33,8 @@ namespace SessionSample //services.AddSingleton(); // Adds a default in-memory implementation of IDistributedCache - services.AddCaching(); + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); services.AddSession(o => { diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index e30f541584..f59805e9f2 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -40,7 +40,8 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddCaching(); + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); services.AddSession(); }); @@ -71,7 +72,8 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddCaching(); + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); services.AddSession(); }); @@ -109,7 +111,9 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddCaching(); + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); + services.AddSession(); }); @@ -162,7 +166,9 @@ namespace Microsoft.AspNetCore.Session .ConfigureServices( services => { - services.AddCaching(); + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); + services.AddSession(); }); @@ -213,7 +219,9 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddCaching(); + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); + services.AddSession(); }); @@ -250,7 +258,10 @@ namespace Microsoft.AspNetCore.Session .ConfigureServices(services => { services.AddSingleton(typeof(ILoggerFactory), loggerFactory); - services.AddCaching(); + + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); + services.AddSession(); }); @@ -299,7 +310,10 @@ namespace Microsoft.AspNetCore.Session .ConfigureServices(services => { services.AddSingleton(typeof(ILoggerFactory), loggerFactory); - services.AddCaching(); + + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); + services.AddSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30)); }); @@ -359,7 +373,10 @@ namespace Microsoft.AspNetCore.Session .ConfigureServices(services => { services.AddSingleton(typeof(ILoggerFactory), new NullLoggerFactory()); - services.AddCaching(); + + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); + services.AddSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20)); services.Configure(o => o.Clock = clock); }); @@ -409,7 +426,9 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddCaching(); + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); + services.AddSession(); }); @@ -452,7 +471,9 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddCaching(); + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); + services.AddSession(); }); @@ -481,7 +502,9 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddCaching(); + services.AddMemoryCache(); + services.AddDistributedMemoryCache(); + services.AddSession(); }); From 6a37b0ace2f02cf74af63ceae1346982b7f91055 Mon Sep 17 00:00:00 2001 From: Victor Hurdugaci Date: Mon, 7 Mar 2016 20:55:04 -0800 Subject: [PATCH 129/295] Update the build scripts to the latest version --- build.ps1 | 33 ++++++++++++++++++++++++++++++++- build.sh | 15 +++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/build.ps1 b/build.ps1 index 4fd24a30d5..8f2f99691a 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,3 +1,33 @@ +$ErrorActionPreference = "Stop" + +function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) +{ + while($true) + { + try + { + Invoke-WebRequest $url -OutFile $downloadLocation + break + } + catch + { + $exceptionMessage = $_.Exception.Message + Write-Host "Failed to download '$url': $exceptionMessage" + if ($retries -gt 0) { + $retries-- + Write-Host "Waiting 10 seconds before retrying. Retries left: $retries" + Start-Sleep -Seconds 10 + + } + else + { + $exception = $_.Exception + throw $exception + } + } + } +} + cd $PSScriptRoot $repoFolder = $PSScriptRoot @@ -20,7 +50,8 @@ if (!(Test-Path $buildFolder)) { $localZipFile="$tempFolder\korebuild.zip" - Invoke-WebRequest $koreBuildZip -OutFile $localZipFile + DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6 + Add-Type -AssemblyName System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) diff --git a/build.sh b/build.sh index 79638d06b6..f4208100eb 100755 --- a/build.sh +++ b/build.sh @@ -18,7 +18,18 @@ if test ! -d $buildFolder; then localZipFile="$tempFolder/korebuild.zip" - wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip /dev/null + retries=6 + until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null) + do + echo "Failed to download '$koreBuildZip'" + if [ "$retries" -le 0 ]; then + exit 1 + fi + retries=$((retries - 1)) + echo "Waiting 10 seconds before retrying. Retries left: $retries" + sleep 10s + done + unzip -q -d $tempFolder $localZipFile mkdir $buildFolder @@ -32,4 +43,4 @@ if test ! -d $buildFolder; then fi fi -$buildFile -r $repoFolder "$@" +$buildFile -r $repoFolder "$@" \ No newline at end of file From 4865151879d845b750fd55c8ee5abc48952a3ad7 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 9 Mar 2016 16:35:09 -0800 Subject: [PATCH 130/295] Limit the branches that build on our public CI. [ci skip] --- .travis.yml | 6 ++++++ appveyor.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.travis.yml b/.travis.yml index bf811dc26a..dd4686f39c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,11 @@ os: - linux - osx osx_image: xcode7.1 +branches: + only: + - master + - release + - dev + - /^(.*\\/)?ci-.*$/ script: - ./build.sh verify \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 3fab83e134..c6d5f7d997 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,11 @@ init: - git config --global core.autocrlf true +branches: + only: + - master + - release + - dev + - /^(.*\\/)?ci-.*$/ build_script: - build.cmd verify clone_depth: 1 From 2e64ed8ce49dc2ad6b2d8dab10541ac56190cb2b Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 9 Mar 2016 17:44:48 -0800 Subject: [PATCH 131/295] Fix backslashes in yml config. [ci skip] --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index dd4686f39c..df22f7a880 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,6 @@ branches: - master - release - dev - - /^(.*\\/)?ci-.*$/ + - /^(.*\/)?ci-.*$/ script: - ./build.sh verify \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index c6d5f7d997..b9a9bcd1e6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ branches: - master - release - dev - - /^(.*\\/)?ci-.*$/ + - /^(.*\/)?ci-.*$/ build_script: - build.cmd verify clone_depth: 1 From 0c3b17dafd15539d5338ed8c7cdba379a2aae386 Mon Sep 17 00:00:00 2001 From: Cesar Blum Silveira Date: Mon, 14 Mar 2016 21:51:06 -0700 Subject: [PATCH 132/295] ASP.NET 5 -> ASP.NET Core --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3d30bf1251..61c48b1491 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/yyivj6uwu3uj2 Travis: [![Travis](https://travis-ci.org/aspnet/Session.svg?branch=dev)](https://travis-ci.org/aspnet/Session) -Contains libraries for session state middleware for ASP.NET 5. +Contains libraries for session state middleware for ASP.NET Core. -This project is part of ASP.NET 5. You can find samples, documentation and getting started instructions for ASP.NET 5 at the [Home](https://github.com/aspnet/home) repo. +This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [Home](https://github.com/aspnet/home) repo. From 396bef4b6d6a96479b7f71889108969cd31816b4 Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Tue, 15 Mar 2016 14:42:37 -0700 Subject: [PATCH 133/295] Fix package metadata --- samples/SessionSample/wwwroot/Readme.md | 2 +- src/Microsoft.AspNetCore.Session/project.json | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/samples/SessionSample/wwwroot/Readme.md b/samples/SessionSample/wwwroot/Readme.md index e65d8d9d2c..a13a1e1fe3 100644 --- a/samples/SessionSample/wwwroot/Readme.md +++ b/samples/SessionSample/wwwroot/Readme.md @@ -1 +1 @@ -Sample demonstrating ASP.NET 5 Session middleware. \ No newline at end of file +Sample demonstrating ASP.NET Core Session middleware. \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index e88498c841..9aa2d5beee 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -1,6 +1,11 @@ { "version": "1.0.0-*", - "description": "ASP.NET 5 session state middleware.", + "description": "ASP.NET Core session state middleware.", + "tags": [ + "aspnetcore", + "session", + "sessionstate" + ], "repository": { "type": "git", "url": "git://github.com/aspnet/session" @@ -21,7 +26,7 @@ "xmlDoc": true }, "frameworks": { - "net451": {}, + "net451": { }, "netstandard1.3": { "dependencies": { "System.Security.Cryptography.Algorithms": "4.0.0-*" From 41b0ea9c3c6d95e2dc74762ddd17ead781356e61 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 21 Mar 2016 06:56:02 -0700 Subject: [PATCH 134/295] Reacting to CoreCLR package changes --- src/Microsoft.AspNetCore.Session/project.json | 2 +- test/Microsoft.AspNetCore.Session.Tests/project.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 9aa2d5beee..63f3b8929a 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -29,7 +29,7 @@ "net451": { }, "netstandard1.3": { "dependencies": { - "System.Security.Cryptography.Algorithms": "4.0.0-*" + "System.Security.Cryptography.Algorithms": "4.1.0-*" }, "imports": [ "dotnet5.4" diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index d83b23776f..406c72fa83 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -12,7 +12,7 @@ "netstandardapp1.5": { "dependencies": { "dotnet-test-xunit": "1.0.0-dev-*", - "Microsoft.NETCore.Platforms": "1.0.1-*" + "System.Threading.Thread": "4.0.0-*" }, "imports": [ "dnxcore50", From 5371e13a5a412afc64cdf4e7f52bef22f144f085 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Sat, 19 Mar 2016 14:20:17 -0700 Subject: [PATCH 135/295] React to HttpAbstractions change: `ISession` in new namespace - see issue aspnet/HttpAbstractions#590 and pull aspnet/HttpAbstractions#589 --- src/Microsoft.AspNetCore.Session/DistributedSession.cs | 2 +- src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs | 2 +- src/Microsoft.AspNetCore.Session/ISessionStore.cs | 2 +- src/Microsoft.AspNetCore.Session/SessionFeature.cs | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/DistributedSession.cs b/src/Microsoft.AspNetCore.Session/DistributedSession.cs index e9ae5867e2..1a638ff926 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSession.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSession.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Logging; diff --git a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs index 41200e9d7e..da8f6cc867 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Logging; diff --git a/src/Microsoft.AspNetCore.Session/ISessionStore.cs b/src/Microsoft.AspNetCore.Session/ISessionStore.cs index 0b48648c8a..e62a0eb42c 100644 --- a/src/Microsoft.AspNetCore.Session/ISessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/ISessionStore.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.Session { diff --git a/src/Microsoft.AspNetCore.Session/SessionFeature.cs b/src/Microsoft.AspNetCore.Session/SessionFeature.cs index 9a46919896..44a378e614 100644 --- a/src/Microsoft.AspNetCore.Session/SessionFeature.cs +++ b/src/Microsoft.AspNetCore.Session/SessionFeature.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; namespace Microsoft.AspNetCore.Session From e3229fc4ea606e8d28ac13366a899c24fe38033e Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Tue, 22 Mar 2016 09:49:34 -0700 Subject: [PATCH 136/295] Revert "Reacting to CoreCLR package changes" This reverts commit 41b0ea9c3c6d95e2dc74762ddd17ead781356e61. --- src/Microsoft.AspNetCore.Session/project.json | 2 +- test/Microsoft.AspNetCore.Session.Tests/project.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 63f3b8929a..9aa2d5beee 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -29,7 +29,7 @@ "net451": { }, "netstandard1.3": { "dependencies": { - "System.Security.Cryptography.Algorithms": "4.1.0-*" + "System.Security.Cryptography.Algorithms": "4.0.0-*" }, "imports": [ "dotnet5.4" diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 406c72fa83..d83b23776f 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -12,7 +12,7 @@ "netstandardapp1.5": { "dependencies": { "dotnet-test-xunit": "1.0.0-dev-*", - "System.Threading.Thread": "4.0.0-*" + "Microsoft.NETCore.Platforms": "1.0.1-*" }, "imports": [ "dnxcore50", From 069220a85a3325b2d1a9f537cdf9a2ffbd4ad638 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 23 Mar 2016 11:47:23 -0700 Subject: [PATCH 137/295] Revert "Revert "Reacting to CoreCLR package changes"" This reverts commit e3229fc4ea606e8d28ac13366a899c24fe38033e. --- src/Microsoft.AspNetCore.Session/project.json | 2 +- test/Microsoft.AspNetCore.Session.Tests/project.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 9aa2d5beee..63f3b8929a 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -29,7 +29,7 @@ "net451": { }, "netstandard1.3": { "dependencies": { - "System.Security.Cryptography.Algorithms": "4.0.0-*" + "System.Security.Cryptography.Algorithms": "4.1.0-*" }, "imports": [ "dotnet5.4" diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index d83b23776f..406c72fa83 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -12,7 +12,7 @@ "netstandardapp1.5": { "dependencies": { "dotnet-test-xunit": "1.0.0-dev-*", - "Microsoft.NETCore.Platforms": "1.0.1-*" + "System.Threading.Thread": "4.0.0-*" }, "imports": [ "dnxcore50", From 97b775de2a2900f0dec699b7e0d037ddd848ba65 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 22 Mar 2016 12:06:10 -0700 Subject: [PATCH 138/295] React to Hosting changes --- samples/SessionSample/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 86a1303f69..92f014267c 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -80,7 +80,7 @@ namespace SessionSample public static void Main(string[] args) { var host = new WebHostBuilder() - .UseDefaultConfiguration(args) + .UseDefaultHostingConfiguration(args) .UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseIISPlatformHandlerUrl() .UseStartup() From 14bd62d880baf8db9c5f47fcfe5d693b4bcb6c6f Mon Sep 17 00:00:00 2001 From: David Fowler Date: Fri, 25 Mar 2016 02:53:31 -0700 Subject: [PATCH 139/295] Fixed the build --- test/Microsoft.AspNetCore.Session.Tests/project.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 406c72fa83..933e0171f7 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -4,7 +4,6 @@ "Microsoft.AspNetCore.TestHost": "1.0.0-*", "Microsoft.Extensions.Caching.Memory": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", "xunit": "2.1.0" }, "testRunner": "xunit", @@ -12,7 +11,9 @@ "netstandardapp1.5": { "dependencies": { "dotnet-test-xunit": "1.0.0-dev-*", - "System.Threading.Thread": "4.0.0-*" + "System.Threading.Thread": "4.0.0-*", + "NETStandard.Library": "1.5.0-*", + "System.Diagnostics.Process": "4.1.0-*" }, "imports": [ "dnxcore50", From a6382fe6af01c49af52ef6dda6358efad1c4464e Mon Sep 17 00:00:00 2001 From: John Luo Date: Thu, 24 Mar 2016 21:16:19 -0700 Subject: [PATCH 140/295] Update sample TFM --- samples/SessionSample/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index d09b78e314..64c6384fbe 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -17,6 +17,6 @@ }, "exclude": "wwwroot/**/*.*", "frameworks": { - "dnx451": { } + "net451": { } } } From 14473b545889539151d7cf5d8c2a58ade870af2d Mon Sep 17 00:00:00 2001 From: jacalvar Date: Mon, 28 Mar 2016 15:46:40 -0700 Subject: [PATCH 141/295] Return IServiceCollection from AddSession extension methods --- .../SessionServiceCollectionExtensions.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs index af5c9c4344..c078a12fac 100644 --- a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs @@ -16,7 +16,8 @@ namespace Microsoft.Extensions.DependencyInjection /// Adds services required for application session state. /// /// The to add the services to. - public static void AddSession(this IServiceCollection services) + /// The so that additional calls can be chained. + public static IServiceCollection AddSession(this IServiceCollection services) { if (services == null) { @@ -24,6 +25,7 @@ namespace Microsoft.Extensions.DependencyInjection } services.AddTransient(); + return services; } /// @@ -31,7 +33,8 @@ namespace Microsoft.Extensions.DependencyInjection /// /// The to add the services to. /// The session options to configure the middleware with. - public static void AddSession(this IServiceCollection services, Action configure) + /// The so that additional calls can be chained. + public static IServiceCollection AddSession(this IServiceCollection services, Action configure) { if (services == null) { @@ -45,6 +48,8 @@ namespace Microsoft.Extensions.DependencyInjection services.Configure(configure); services.AddSession(); + + return services; } } } \ No newline at end of file From c0d265ce7b83bd86f9d19a4622150227d28c507c Mon Sep 17 00:00:00 2001 From: John Luo Date: Wed, 30 Mar 2016 16:27:01 -0700 Subject: [PATCH 142/295] Reacting to Kestrel extensions --- samples/SessionSample/Startup.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 92f014267c..c8c6432722 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -81,7 +81,7 @@ namespace SessionSample { var host = new WebHostBuilder() .UseDefaultHostingConfiguration(args) - .UseServer("Microsoft.AspNetCore.Server.Kestrel") + .UseKestrel() .UseIISPlatformHandlerUrl() .UseStartup() .Build(); @@ -89,4 +89,4 @@ namespace SessionSample host.Run(); } } -} \ No newline at end of file +} From 31627b7e70c9a3c38107848245a31d4d8792dcb3 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 6 Apr 2016 09:47:16 -0700 Subject: [PATCH 143/295] Updating to release. --- NuGet.config | 2 +- build.ps1 | 2 +- build.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NuGet.config b/NuGet.config index 1707938c61..9db87a421e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 8f2f99691a..cf8bff13bb 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/release.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index f4208100eb..f88fe4052e 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/release.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi From c2503d1da14ecd9ee606db4e21db9788532d25df Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 7 Apr 2016 15:43:23 -0700 Subject: [PATCH 144/295] Removing imports from src projects --- src/Microsoft.AspNetCore.Session/project.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 63f3b8929a..189a228171 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -26,14 +26,11 @@ "xmlDoc": true }, "frameworks": { - "net451": { }, + "net451": {}, "netstandard1.3": { "dependencies": { "System.Security.Cryptography.Algorithms": "4.1.0-*" - }, - "imports": [ - "dotnet5.4" - ] + } } } } \ No newline at end of file From 8742b463ba4520332aa42c746efedd7bb1852266 Mon Sep 17 00:00:00 2001 From: John Luo Date: Wed, 6 Apr 2016 16:53:32 -0700 Subject: [PATCH 145/295] Moving web.config --- samples/SessionSample/Startup.cs | 2 +- samples/SessionSample/project.json | 9 ++++----- samples/SessionSample/web.config | 9 +++++++++ samples/SessionSample/wwwroot/Readme.md | 1 - samples/SessionSample/wwwroot/web.config | 9 --------- 5 files changed, 14 insertions(+), 16 deletions(-) create mode 100644 samples/SessionSample/web.config delete mode 100644 samples/SessionSample/wwwroot/Readme.md delete mode 100644 samples/SessionSample/wwwroot/web.config diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index c8c6432722..9aad777ccb 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -82,7 +82,7 @@ namespace SessionSample var host = new WebHostBuilder() .UseDefaultHostingConfiguration(args) .UseKestrel() - .UseIISPlatformHandlerUrl() + .UseIISIntegration() .UseStartup() .Build(); diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 64c6384fbe..5de54b45bd 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -2,11 +2,8 @@ "compilationOptions": { "emitEntryPoint": true }, - "commands": { - "web": "SessionSample" - }, "dependencies": { - "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*", + "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", "Microsoft.AspNetCore.Session": "1.0.0-*", "Microsoft.Extensions.Caching.Memory": "1.0.0-*", @@ -15,7 +12,9 @@ "Microsoft.Extensions.Logging.Console": "1.0.0-*", "Microsoft.NETCore.Platforms": "1.0.1-*" }, - "exclude": "wwwroot/**/*.*", + "content": [ + "web.config" + ], "frameworks": { "net451": { } } diff --git a/samples/SessionSample/web.config b/samples/SessionSample/web.config new file mode 100644 index 0000000000..f1dc29a792 --- /dev/null +++ b/samples/SessionSample/web.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/samples/SessionSample/wwwroot/Readme.md b/samples/SessionSample/wwwroot/Readme.md deleted file mode 100644 index a13a1e1fe3..0000000000 --- a/samples/SessionSample/wwwroot/Readme.md +++ /dev/null @@ -1 +0,0 @@ -Sample demonstrating ASP.NET Core Session middleware. \ No newline at end of file diff --git a/samples/SessionSample/wwwroot/web.config b/samples/SessionSample/wwwroot/web.config deleted file mode 100644 index 9a0d90abf8..0000000000 --- a/samples/SessionSample/wwwroot/web.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file From d26e7781c6cefdf770900b3d6fc81d42dcb98089 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 14 Apr 2016 16:03:47 -0700 Subject: [PATCH 146/295] Migrate tests, tools and samples to portable --- test/Microsoft.AspNetCore.Session.Tests/project.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 933e0171f7..cbc98b5447 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -8,11 +8,14 @@ }, "testRunner": "xunit", "frameworks": { - "netstandardapp1.5": { + "netcoreapp1.0": { "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0-*", + "type": "platform" + }, "dotnet-test-xunit": "1.0.0-dev-*", "System.Threading.Thread": "4.0.0-*", - "NETStandard.Library": "1.5.0-*", "System.Diagnostics.Process": "4.1.0-*" }, "imports": [ From 4bddd93e322231b1687bb3bd95df133e676cc53b Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 18 Apr 2016 17:02:26 -0700 Subject: [PATCH 147/295] Bring Microsoft.NETCore.Platforms dependency back --- samples/SessionSample/project.json | 8 ++++---- test/Microsoft.AspNetCore.Session.Tests/project.json | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 5de54b45bd..cb4378380e 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -3,19 +3,19 @@ "emitEntryPoint": true }, "dependencies": { + "Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", "Microsoft.AspNetCore.Session": "1.0.0-*", "Microsoft.Extensions.Caching.Memory": "1.0.0-*", "Microsoft.Extensions.Caching.Redis": "1.0.0-*", "Microsoft.Extensions.Caching.SqlServer": "1.0.0-*", - "Microsoft.Extensions.Logging.Console": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*" + "Microsoft.Extensions.Logging.Console": "1.0.0-*" }, "content": [ "web.config" ], "frameworks": { - "net451": { } + "net451": {} } -} +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index cbc98b5447..1d2236a347 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -1,5 +1,6 @@ { "dependencies": { + "Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.AspNetCore.Session": "1.0.0-*", "Microsoft.AspNetCore.TestHost": "1.0.0-*", "Microsoft.Extensions.Caching.Memory": "1.0.0-*", From 2b45e806cc5d2031490aa3b66e7a228f8dfb7fdd Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 19 Apr 2016 14:54:12 -0700 Subject: [PATCH 148/295] Use latest build of dotnet-test-xunit --- test/Microsoft.AspNetCore.Session.Tests/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 1d2236a347..26476d981c 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -15,7 +15,7 @@ "version": "1.0.0-*", "type": "platform" }, - "dotnet-test-xunit": "1.0.0-dev-*", + "dotnet-test-xunit": "1.0.0-*", "System.Threading.Thread": "4.0.0-*", "System.Diagnostics.Process": "4.1.0-*" }, From ac8de5072400daeb05d74af8dc7a2c6ab2cbc788 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Mon, 25 Apr 2016 08:52:22 -0700 Subject: [PATCH 149/295] Update web.config and add publish tool --- samples/SessionSample/project.json | 9 +++++++++ samples/SessionSample/web.config | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index cb4378380e..a75d821039 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -17,5 +17,14 @@ ], "frameworks": { "net451": {} + }, + "tools": { + "Microsoft.AspNetCore.Server.IISIntegration.Tools": { + "version": "1.0.0-*", + "imports": "portable-net45+wp80+win8+wpa81+dnxcore50" + } + }, + "scripts": { + "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" } } \ No newline at end of file diff --git a/samples/SessionSample/web.config b/samples/SessionSample/web.config index f1dc29a792..f7ac679334 100644 --- a/samples/SessionSample/web.config +++ b/samples/SessionSample/web.config @@ -4,6 +4,6 @@ - + \ No newline at end of file From f4452846cf4825328325a03d7e0de80ffc574ca9 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Wed, 27 Apr 2016 18:59:59 -0700 Subject: [PATCH 150/295] Remove reference to UseDefaultHostConfiguration --- samples/SessionSample/Startup.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 9aad777ccb..b87fa956c7 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -80,7 +80,6 @@ namespace SessionSample public static void Main(string[] args) { var host = new WebHostBuilder() - .UseDefaultHostingConfiguration(args) .UseKestrel() .UseIISIntegration() .UseStartup() From 5ad3ffc4f69ee83ffce2c68bc1d183155fcd8b74 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 2 May 2016 11:27:27 -0700 Subject: [PATCH 151/295] Fix build warnings --- samples/SessionSample/project.json | 10 ++++++---- src/Microsoft.AspNetCore.Session/project.json | 20 ++++++++++--------- .../project.json | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index a75d821039..349065e475 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -1,5 +1,5 @@ { - "compilationOptions": { + "buildOptions": { "emitEntryPoint": true }, "dependencies": { @@ -12,9 +12,11 @@ "Microsoft.Extensions.Caching.SqlServer": "1.0.0-*", "Microsoft.Extensions.Logging.Console": "1.0.0-*" }, - "content": [ - "web.config" - ], + "publishOptions": { + "include": [ + "web.config" + ] + }, "frameworks": { "net451": {} }, diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 189a228171..22720aad9e 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -1,14 +1,16 @@ { "version": "1.0.0-*", "description": "ASP.NET Core session state middleware.", - "tags": [ - "aspnetcore", - "session", - "sessionstate" - ], - "repository": { - "type": "git", - "url": "git://github.com/aspnet/session" + "packOptions": { + "repository": { + "type": "git", + "url": "git://github.com/aspnet/session" + }, + "tags": [ + "aspnetcore", + "session", + "sessionstate" + ] }, "dependencies": { "Microsoft.AspNetCore.Http.Abstractions": "1.0.0-*", @@ -16,7 +18,7 @@ "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", "Microsoft.Extensions.Options": "1.0.0-*" }, - "compilationOptions": { + "buildOptions": { "allowUnsafe": true, "warningsAsErrors": true, "keyFile": "../../tools/Key.snk", diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 26476d981c..cddfad394d 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -1,5 +1,6 @@ { "dependencies": { + "dotnet-test-xunit": "1.0.0-*", "Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.AspNetCore.Session": "1.0.0-*", "Microsoft.AspNetCore.TestHost": "1.0.0-*", @@ -15,7 +16,6 @@ "version": "1.0.0-*", "type": "platform" }, - "dotnet-test-xunit": "1.0.0-*", "System.Threading.Thread": "4.0.0-*", "System.Diagnostics.Process": "4.1.0-*" }, From 1d588e0e82002186dce1a30b28ac43467a106412 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 17 May 2016 14:57:06 -0700 Subject: [PATCH 152/295] React to updated CoreCLR packages https://github.com/aspnet/Coherence/issues/97 --- src/Microsoft.AspNetCore.Session/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 22720aad9e..b9b48f6237 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -31,7 +31,7 @@ "net451": {}, "netstandard1.3": { "dependencies": { - "System.Security.Cryptography.Algorithms": "4.1.0-*" + "System.Security.Cryptography.Algorithms": "4.2.0-*" } } } From 627dfdc64615eecd7b5d62bfb52063722b4355f3 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 18 May 2016 09:43:09 -0700 Subject: [PATCH 153/295] Revert "React to updated CoreCLR packages" This reverts commit 1d588e0e82002186dce1a30b28ac43467a106412. --- src/Microsoft.AspNetCore.Session/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index b9b48f6237..22720aad9e 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -31,7 +31,7 @@ "net451": {}, "netstandard1.3": { "dependencies": { - "System.Security.Cryptography.Algorithms": "4.2.0-*" + "System.Security.Cryptography.Algorithms": "4.1.0-*" } } } From dabd28a5d9ac7837afbfce7c8dfa2805a9559857 Mon Sep 17 00:00:00 2001 From: Chris R Date: Fri, 29 Apr 2016 13:17:39 -0700 Subject: [PATCH 154/295] #105 Use DataProtection to encrypt the cookie --- .../Properties/launchSettings.json | 8 ++- samples/SessionSample/Startup.cs | 4 +- samples/SessionSample/project.json | 18 ++++- .../CookieProtection.cs | 71 +++++++++++++++++++ .../LoggingExtensions.cs | 10 +++ .../SessionMiddleware.cs | 24 +++++-- .../SessionServiceCollectionExtensions.cs | 1 + src/Microsoft.AspNetCore.Session/project.json | 1 + .../Microsoft.AspNetCore.Session.Tests.xproj | 3 + 9 files changed, 127 insertions(+), 13 deletions(-) create mode 100644 src/Microsoft.AspNetCore.Session/CookieProtection.cs diff --git a/samples/SessionSample/Properties/launchSettings.json b/samples/SessionSample/Properties/launchSettings.json index bd71d7713a..9137a2c6f4 100644 --- a/samples/SessionSample/Properties/launchSettings.json +++ b/samples/SessionSample/Properties/launchSettings.json @@ -15,10 +15,12 @@ "Hosting:Environment": "Development" } }, - "web": { - "commandName": "web", + "SessionSample": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "http://localhost:5000/", "environmentVariables": { - "Hosting:Environment": "Development" + "ASPNETCORE_ENVIRONMENT": "Development" } } } diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index b87fa956c7..8946d5e2df 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -27,11 +27,11 @@ namespace SessionSample // o.SchemaName = "dbo"; // o.TableName = "Sessions"; //}); - +#if NET451 // Uncomment the following line to use the Redis implementation of IDistributedCache. // This will override any previously registered IDistributedCache service. //services.AddSingleton(); - +#endif // Adds a default in-memory implementation of IDistributedCache services.AddMemoryCache(); services.AddDistributedMemoryCache(); diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 349065e475..3b12791852 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -8,7 +8,6 @@ "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", "Microsoft.AspNetCore.Session": "1.0.0-*", "Microsoft.Extensions.Caching.Memory": "1.0.0-*", - "Microsoft.Extensions.Caching.Redis": "1.0.0-*", "Microsoft.Extensions.Caching.SqlServer": "1.0.0-*", "Microsoft.Extensions.Logging.Console": "1.0.0-*" }, @@ -18,7 +17,22 @@ ] }, "frameworks": { - "net451": {} + "net451": { + "dependencies": { + "Microsoft.Extensions.Caching.Redis": "1.0.0-*" + } + }, + "netcoreapp1.0": { + "imports": [ + "dnxcore50" + ], + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0-*", + "type": "platform" + } + } + } }, "tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": { diff --git a/src/Microsoft.AspNetCore.Session/CookieProtection.cs b/src/Microsoft.AspNetCore.Session/CookieProtection.cs new file mode 100644 index 0000000000..64a3a3fbbf --- /dev/null +++ b/src/Microsoft.AspNetCore.Session/CookieProtection.cs @@ -0,0 +1,71 @@ +// Copyright (c) .NET Foundation. 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.Text; +using Microsoft.AspNetCore.DataProtection; +using Microsoft.Extensions.Logging; + +namespace Microsoft.AspNetCore.Session +{ + internal static class CookieProtection + { + internal static string Protect(IDataProtector protector, string data) + { + if (protector == null) + { + throw new ArgumentNullException(nameof(protector)); + } + if (string.IsNullOrEmpty(data)) + { + return data; + } + + var userData = Encoding.UTF8.GetBytes(data); + + var protectedData = protector.Protect(userData); + return Convert.ToBase64String(protectedData).TrimEnd('='); + } + + internal static string Unprotect(IDataProtector protector, string protectedText, ILogger logger) + { + try + { + if (string.IsNullOrEmpty(protectedText)) + { + return string.Empty; + } + + var protectedData = Convert.FromBase64String(Pad(protectedText)); + if (protectedData == null) + { + return string.Empty; + } + + var userData = protector.Unprotect(protectedData); + if (userData == null) + { + return string.Empty; + } + + return Encoding.UTF8.GetString(userData); + } + catch (Exception ex) + { + // Log the exception, but do not leak other information + logger.ErrorUnprotectingSessionCookie(ex); + return string.Empty; + } + } + + private static string Pad(string text) + { + var padding = 3 - ((text.Length + 3) % 4); + if (padding == 0) + { + return text; + } + return text + new string('=', padding); + } + } +} diff --git a/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs b/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs index 1dcc93e709..f2bb1be87d 100644 --- a/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs @@ -12,6 +12,7 @@ namespace Microsoft.Extensions.Logging private static Action _sessionStarted; private static Action _sessionLoaded; private static Action _sessionStored; + private static Action _errorUnprotectingCookie; static LoggingExtensions() { @@ -35,6 +36,10 @@ namespace Microsoft.Extensions.Logging eventId: 5, logLevel: LogLevel.Debug, formatString: "Session stored; Key:{sessionKey}, Id:{sessionId}, Count:{count}"); + _errorUnprotectingCookie = LoggerMessage.Define( + eventId: 6, + logLevel: LogLevel.Warning, + formatString: "Error unprotecting the session cookie."); } public static void ErrorClosingTheSession(this ILogger logger, Exception exception) @@ -61,5 +66,10 @@ namespace Microsoft.Extensions.Logging { _sessionStored(logger, sessionKey, sessionId, count, null); } + + public static void ErrorUnprotectingSessionCookie(this ILogger logger, Exception exception) + { + _errorUnprotectingCookie(logger, exception); + } } } diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs index 23ccd289ce..8f6ff452f6 100644 --- a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs @@ -5,6 +5,7 @@ using System; using System.Security.Cryptography; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Logging; @@ -24,17 +25,20 @@ namespace Microsoft.AspNetCore.Session private readonly SessionOptions _options; private readonly ILogger _logger; private readonly ISessionStore _sessionStore; + private readonly IDataProtector _dataProtector; /// /// Creates a new . /// /// The representing the next middleware in the pipeline. /// The representing the factory that used to create logger instances. + /// The used to protect and verify the cookie. /// The representing the session store. /// The session configuration options. public SessionMiddleware( RequestDelegate next, ILoggerFactory loggerFactory, + IDataProtectionProvider dataProtectionProvider, ISessionStore sessionStore, IOptions options) { @@ -48,6 +52,11 @@ namespace Microsoft.AspNetCore.Session throw new ArgumentNullException(nameof(loggerFactory)); } + if (dataProtectionProvider == null) + { + throw new ArgumentNullException(nameof(dataProtectionProvider)); + } + if (sessionStore == null) { throw new ArgumentNullException(nameof(sessionStore)); @@ -60,6 +69,7 @@ namespace Microsoft.AspNetCore.Session _next = next; _logger = loggerFactory.CreateLogger(); + _dataProtector = dataProtectionProvider.CreateProtector(nameof(SessionMiddleware)); _options = options.Value; _sessionStore = sessionStore; } @@ -73,14 +83,16 @@ namespace Microsoft.AspNetCore.Session { var isNewSessionKey = false; Func tryEstablishSession = ReturnTrue; - string sessionKey = context.Request.Cookies[_options.CookieName]; + var cookieValue = context.Request.Cookies[_options.CookieName]; + var sessionKey = CookieProtection.Unprotect(_dataProtector, cookieValue, _logger); if (string.IsNullOrWhiteSpace(sessionKey) || sessionKey.Length != SessionKeyLength) { // No valid cookie, new session. var guidBytes = new byte[16]; CryptoRandom.GetBytes(guidBytes); sessionKey = new Guid(guidBytes).ToString(); - var establisher = new SessionEstablisher(context, sessionKey, _options); + cookieValue = CookieProtection.Protect(_dataProtector, sessionKey); + var establisher = new SessionEstablisher(context, cookieValue, _options); tryEstablishSession = establisher.TryEstablishSession; isNewSessionKey = true; } @@ -114,14 +126,14 @@ namespace Microsoft.AspNetCore.Session private class SessionEstablisher { private readonly HttpContext _context; - private readonly string _sessionKey; + private readonly string _cookieValue; private readonly SessionOptions _options; private bool _shouldEstablishSession; - public SessionEstablisher(HttpContext context, string sessionKey, SessionOptions options) + public SessionEstablisher(HttpContext context, string cookieValue, SessionOptions options) { _context = context; - _sessionKey = sessionKey; + _cookieValue = cookieValue; _options = options; context.Response.OnStarting(OnStartingCallback, state: this); } @@ -145,7 +157,7 @@ namespace Microsoft.AspNetCore.Session Path = _options.CookiePath ?? SessionDefaults.CookiePath, }; - _context.Response.Cookies.Append(_options.CookieName, _sessionKey, cookieOptions); + _context.Response.Cookies.Append(_options.CookieName, _cookieValue, cookieOptions); _context.Response.Headers["Cache-Control"] = "no-cache"; _context.Response.Headers["Pragma"] = "no-cache"; diff --git a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs index c078a12fac..48424e48cd 100644 --- a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs @@ -25,6 +25,7 @@ namespace Microsoft.Extensions.DependencyInjection } services.AddTransient(); + services.AddDataProtection(); return services; } diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 22720aad9e..7eb81db2b5 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -13,6 +13,7 @@ ] }, "dependencies": { + "Microsoft.AspNetCore.DataProtection": "1.0.0-*", "Microsoft.AspNetCore.Http.Abstractions": "1.0.0-*", "Microsoft.Extensions.Caching.Abstractions": "1.0.0-*", "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj index 2fc2960ef9..c030463c79 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj @@ -13,5 +13,8 @@ 2.0 + + + \ No newline at end of file From d61c5100c9b30463b8684cd72934280aeb23ec15 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 17 May 2016 14:42:55 -0700 Subject: [PATCH 155/295] Handle cache unreliability #99 --- .../Properties/launchSettings.json | 4 +- samples/SessionSample/Startup.cs | 7 +- .../DistributedSession.cs | 178 ++++++--------- .../DistributedSessionStore.cs | 8 - .../EncodedKey.cs | 80 +++++++ .../ISessionStore.cs | 2 - .../LoggingExtensions.cs | 14 +- .../NoOpSessionStore.cs | 59 +++++ .../SessionTests.cs | 212 +++++++++++++----- 9 files changed, 383 insertions(+), 181 deletions(-) create mode 100644 src/Microsoft.AspNetCore.Session/EncodedKey.cs create mode 100644 src/Microsoft.AspNetCore.Session/NoOpSessionStore.cs diff --git a/samples/SessionSample/Properties/launchSettings.json b/samples/SessionSample/Properties/launchSettings.json index 9137a2c6f4..6bab3d3602 100644 --- a/samples/SessionSample/Properties/launchSettings.json +++ b/samples/SessionSample/Properties/launchSettings.json @@ -12,13 +12,13 @@ "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { - "Hosting:Environment": "Development" + "ASPNETCORE_ENVIRONMENT": "Development" } }, "SessionSample": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "http://localhost:5000/", + "launchUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 8946d5e2df..8c65358399 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -19,6 +19,9 @@ namespace SessionSample public void ConfigureServices(IServiceCollection services) { + // Adds a default in-memory implementation of IDistributedCache + services.AddDistributedMemoryCache(); + // Uncomment the following line to use the Microsoft SQL Server implementation of IDistributedCache. // Note that this would require setting up the session state database. //services.AddSqlServerCache(o => @@ -32,10 +35,6 @@ namespace SessionSample // This will override any previously registered IDistributedCache service. //services.AddSingleton(); #endif - // Adds a default in-memory implementation of IDistributedCache - services.AddMemoryCache(); - services.AddDistributedMemoryCache(); - services.AddSession(o => { o.IdleTimeout = TimeSpan.FromSeconds(10); diff --git a/src/Microsoft.AspNetCore.Session/DistributedSession.cs b/src/Microsoft.AspNetCore.Session/DistributedSession.cs index 1a638ff926..6025423ad1 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSession.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSession.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Cryptography; -using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Caching.Distributed; @@ -26,10 +25,11 @@ namespace Microsoft.AspNetCore.Session private readonly string _sessionKey; private readonly TimeSpan _idleTimeout; private readonly Func _tryEstablishSession; - private readonly IDictionary _store; private readonly ILogger _logger; + private IDictionary _store; private bool _isModified; private bool _loaded; + private bool _isAvailable; private bool _isNewSessionKey; private string _sessionId; private byte[] _sessionIdBytes; @@ -71,11 +71,20 @@ namespace Microsoft.AspNetCore.Session _isNewSessionKey = isNewSessionKey; } + public bool IsAvailable + { + get + { + Load(); + return _isAvailable; + } + } + public string Id { get { - Load(); // TODO: Silent failure + Load(); if (_sessionId == null) { _sessionId = new Guid(IdBytes).ToString(); @@ -88,8 +97,7 @@ namespace Microsoft.AspNetCore.Session { get { - Load(); // TODO: Silent failure - if (_sessionIdBytes == null) + if (IsAvailable && _sessionIdBytes == null) { _sessionIdBytes = new byte[IdByteCount]; CryptoRandom.GetBytes(_sessionIdBytes); @@ -102,14 +110,14 @@ namespace Microsoft.AspNetCore.Session { get { - Load(); // TODO: Silent failure + Load(); return _store.Keys.Select(key => key.KeyString); } } public bool TryGetValue(string key, out byte[] value) { - Load(); // TODO: Silent failure + Load(); return _store.TryGetValue(new EncodedKey(key), out value); } @@ -120,22 +128,24 @@ namespace Microsoft.AspNetCore.Session throw new ArgumentNullException(nameof(value)); } - var encodedKey = new EncodedKey(key); - if (encodedKey.KeyBytes.Length > KeyLengthLimit) + if (IsAvailable) { - throw new ArgumentOutOfRangeException(nameof(key), - Resources.FormatException_KeyLengthIsExceeded(KeyLengthLimit)); - } + var encodedKey = new EncodedKey(key); + if (encodedKey.KeyBytes.Length > KeyLengthLimit) + { + throw new ArgumentOutOfRangeException(nameof(key), + Resources.FormatException_KeyLengthIsExceeded(KeyLengthLimit)); + } - Load(); - if (!_tryEstablishSession()) - { - throw new InvalidOperationException(Resources.Exception_InvalidSessionEstablishment); + if (!_tryEstablishSession()) + { + throw new InvalidOperationException(Resources.Exception_InvalidSessionEstablishment); + } + _isModified = true; + byte[] copy = new byte[value.Length]; + Buffer.BlockCopy(src: value, srcOffset: 0, dst: copy, dstOffset: 0, count: value.Length); + _store[encodedKey] = copy; } - _isModified = true; - byte[] copy = new byte[value.Length]; - Buffer.BlockCopy(src: value, srcOffset: 0, dst: copy, dstOffset: 0, count: value.Length); - _store[encodedKey] = copy; } public void Remove(string key) @@ -155,21 +165,35 @@ namespace Microsoft.AspNetCore.Session { if (!_loaded) { - var data = _cache.Get(_sessionKey); - if (data != null) + try { - Deserialize(new MemoryStream(data)); + var data = _cache.Get(_sessionKey); + if (data != null) + { + Deserialize(new MemoryStream(data)); + } + else if (!_isNewSessionKey) + { + _logger.AccessingExpiredSession(_sessionKey); + } + _isAvailable = true; } - else if (!_isNewSessionKey) + catch (Exception exception) { - _logger.AccessingExpiredSession(_sessionKey); + _logger.SessionCacheReadException(_sessionKey, exception); + _isAvailable = false; + _sessionId = string.Empty; + _sessionIdBytes = null; + _store = new NoOpSessionStore(); + } + finally + { + _loaded = true; } - _loaded = true; } } - // TODO: This should throw if called directly, but most other places it should fail silently - // (e.g. TryGetValue should just return null). + // This will throw if called directly and a failure occurs. The user is expected to handle the failures. public async Task LoadAsync() { if (!_loaded) @@ -183,6 +207,7 @@ namespace Microsoft.AspNetCore.Session { _logger.AccessingExpiredSession(_sessionKey); } + _isAvailable = true; _loaded = true; } } @@ -191,24 +216,32 @@ namespace Microsoft.AspNetCore.Session { if (_isModified) { - var data = await _cache.GetAsync(_sessionKey); - if (_logger.IsEnabled(LogLevel.Information) && data == null) + if (_logger.IsEnabled(LogLevel.Information)) { - _logger.SessionStarted(_sessionKey, Id); + try + { + var data = await _cache.GetAsync(_sessionKey); + if (data == null) + { + _logger.SessionStarted(_sessionKey, Id); + } + } + catch (Exception exception) + { + _logger.SessionCacheReadException(_sessionKey, exception); + } } - _isModified = false; var stream = new MemoryStream(); Serialize(stream); + await _cache.SetAsync( _sessionKey, stream.ToArray(), new DistributedCacheEntryOptions().SetSlidingExpiration(_idleTimeout)); - if (_logger.IsEnabled(LogLevel.Debug)) - { - _logger.SessionStored(_sessionKey, Id, _store.Count); - } + _isModified = false; + _logger.SessionStored(_sessionKey, Id, _store.Count); } else { @@ -245,7 +278,6 @@ namespace Microsoft.AspNetCore.Session { if (content == null || content.ReadByte() != SerializationRevision) { - // TODO: Throw? // Replace the un-readable format. _isModified = true; return; @@ -333,77 +365,5 @@ namespace Microsoft.AspNetCore.Session return output; } - // Keys are stored in their utf-8 encoded state. - // This saves us from de-serializing and re-serializing every key on every request. - private class EncodedKey - { - private string _keyString; - private int? _hashCode; - - internal EncodedKey(string key) - { - _keyString = key; - KeyBytes = Encoding.UTF8.GetBytes(key); - } - - public EncodedKey(byte[] key) - { - KeyBytes = key; - } - - internal string KeyString - { - get - { - if (_keyString == null) - { - _keyString = Encoding.UTF8.GetString(KeyBytes, 0, KeyBytes.Length); - } - return _keyString; - } - } - - internal byte[] KeyBytes { get; private set; } - - public override bool Equals(object obj) - { - var otherKey = obj as EncodedKey; - if (otherKey == null) - { - return false; - } - if (KeyBytes.Length != otherKey.KeyBytes.Length) - { - return false; - } - if (_hashCode.HasValue && otherKey._hashCode.HasValue - && _hashCode.Value != otherKey._hashCode.Value) - { - return false; - } - for (int i = 0; i < KeyBytes.Length; i++) - { - if (KeyBytes[i] != otherKey.KeyBytes[i]) - { - return false; - } - } - return true; - } - - public override int GetHashCode() - { - if (!_hashCode.HasValue) - { - _hashCode = SipHash.GetHashCode(KeyBytes); - } - return _hashCode.Value; - } - - public override string ToString() - { - return KeyString; - } - } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs index da8f6cc867..180599ba18 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs @@ -29,14 +29,6 @@ namespace Microsoft.AspNetCore.Session _loggerFactory = loggerFactory; } - public bool IsAvailable - { - get - { - return true; // TODO: - } - } - public ISession Create(string sessionKey, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey) { if (string.IsNullOrEmpty(sessionKey)) diff --git a/src/Microsoft.AspNetCore.Session/EncodedKey.cs b/src/Microsoft.AspNetCore.Session/EncodedKey.cs new file mode 100644 index 0000000000..ac169542f5 --- /dev/null +++ b/src/Microsoft.AspNetCore.Session/EncodedKey.cs @@ -0,0 +1,80 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Text; + +namespace Microsoft.AspNetCore.Session +{ + // Keys are stored in their utf-8 encoded state. + // This saves us from de-serializing and re-serializing every key on every request. + internal class EncodedKey + { + private string _keyString; + private int? _hashCode; + + internal EncodedKey(string key) + { + _keyString = key; + KeyBytes = Encoding.UTF8.GetBytes(key); + } + + public EncodedKey(byte[] key) + { + KeyBytes = key; + } + + internal string KeyString + { + get + { + if (_keyString == null) + { + _keyString = Encoding.UTF8.GetString(KeyBytes, 0, KeyBytes.Length); + } + return _keyString; + } + } + + internal byte[] KeyBytes { get; private set; } + + public override bool Equals(object obj) + { + var otherKey = obj as EncodedKey; + if (otherKey == null) + { + return false; + } + if (KeyBytes.Length != otherKey.KeyBytes.Length) + { + return false; + } + if (_hashCode.HasValue && otherKey._hashCode.HasValue + && _hashCode.Value != otherKey._hashCode.Value) + { + return false; + } + for (int i = 0; i < KeyBytes.Length; i++) + { + if (KeyBytes[i] != otherKey.KeyBytes[i]) + { + return false; + } + } + return true; + } + + public override int GetHashCode() + { + if (!_hashCode.HasValue) + { + _hashCode = SipHash.GetHashCode(KeyBytes); + } + return _hashCode.Value; + } + + public override string ToString() + { + return KeyString; + } + } +} diff --git a/src/Microsoft.AspNetCore.Session/ISessionStore.cs b/src/Microsoft.AspNetCore.Session/ISessionStore.cs index e62a0eb42c..8831a60f5a 100644 --- a/src/Microsoft.AspNetCore.Session/ISessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/ISessionStore.cs @@ -8,8 +8,6 @@ namespace Microsoft.AspNetCore.Session { public interface ISessionStore { - bool IsAvailable { get; } - ISession Create(string sessionKey, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey); } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs b/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs index f2bb1be87d..c6780a7dfc 100644 --- a/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs @@ -12,6 +12,7 @@ namespace Microsoft.Extensions.Logging private static Action _sessionStarted; private static Action _sessionLoaded; private static Action _sessionStored; + private static Action _sessionCacheReadException; private static Action _errorUnprotectingCookie; static LoggingExtensions() @@ -23,7 +24,7 @@ namespace Microsoft.Extensions.Logging _accessingExpiredSession = LoggerMessage.Define( eventId: 2, logLevel: LogLevel.Warning, - formatString: "Accessing expired session; Key:{sessionKey}"); + formatString: "Accessing expired session, Key:{sessionKey}"); _sessionStarted = LoggerMessage.Define( eventId: 3, logLevel: LogLevel.Information, @@ -36,8 +37,12 @@ namespace Microsoft.Extensions.Logging eventId: 5, logLevel: LogLevel.Debug, formatString: "Session stored; Key:{sessionKey}, Id:{sessionId}, Count:{count}"); - _errorUnprotectingCookie = LoggerMessage.Define( + _sessionCacheReadException = LoggerMessage.Define( eventId: 6, + logLevel: LogLevel.Error, + formatString: "Session cache read exception, Key:{sessionKey}"); + _errorUnprotectingCookie = LoggerMessage.Define( + eventId: 7, logLevel: LogLevel.Warning, formatString: "Error unprotecting the session cookie."); } @@ -67,6 +72,11 @@ namespace Microsoft.Extensions.Logging _sessionStored(logger, sessionKey, sessionId, count, null); } + public static void SessionCacheReadException(this ILogger logger, string sessionKey, Exception exception) + { + _sessionCacheReadException(logger, sessionKey, exception); + } + public static void ErrorUnprotectingSessionCookie(this ILogger logger, Exception exception) { _errorUnprotectingCookie(logger, exception); diff --git a/src/Microsoft.AspNetCore.Session/NoOpSessionStore.cs b/src/Microsoft.AspNetCore.Session/NoOpSessionStore.cs new file mode 100644 index 0000000000..6a89ad3900 --- /dev/null +++ b/src/Microsoft.AspNetCore.Session/NoOpSessionStore.cs @@ -0,0 +1,59 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.AspNetCore.Session +{ + internal class NoOpSessionStore : IDictionary + { + public byte[] this[EncodedKey key] + { + get + { + return null; + } + + set + { + + } + } + + public int Count { get; } = 0; + + public bool IsReadOnly { get; } = false; + + public ICollection Keys { get; } = new EncodedKey[0]; + + public ICollection Values { get; } = new byte[0][]; + + public void Add(KeyValuePair item) { } + + public void Add(EncodedKey key, byte[] value) { } + + public void Clear() { } + + public bool Contains(KeyValuePair item) => false; + + public bool ContainsKey(EncodedKey key) => false; + + public void CopyTo(KeyValuePair[] array, int arrayIndex) { } + + public IEnumerator> GetEnumerator() => Enumerable.Empty>().GetEnumerator(); + + public bool Remove(KeyValuePair item) => false; + + public bool Remove(EncodedKey key) => false; + + public bool TryGetValue(EncodedKey key, out byte[] value) + { + value = null; + return false; + } + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + } +} diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index f59805e9f2..ed7cf6c268 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -40,7 +40,6 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddMemoryCache(); services.AddDistributedMemoryCache(); services.AddSession(); }); @@ -72,7 +71,6 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddMemoryCache(); services.AddDistributedMemoryCache(); services.AddSession(); }); @@ -111,9 +109,7 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddMemoryCache(); services.AddDistributedMemoryCache(); - services.AddSession(); }); @@ -166,9 +162,7 @@ namespace Microsoft.AspNetCore.Session .ConfigureServices( services => { - services.AddMemoryCache(); services.AddDistributedMemoryCache(); - services.AddSession(); }); @@ -219,9 +213,7 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddMemoryCache(); services.AddDistributedMemoryCache(); - services.AddSession(); }); @@ -258,10 +250,7 @@ namespace Microsoft.AspNetCore.Session .ConfigureServices(services => { services.AddSingleton(typeof(ILoggerFactory), loggerFactory); - - services.AddMemoryCache(); services.AddDistributedMemoryCache(); - services.AddSession(); }); @@ -310,10 +299,7 @@ namespace Microsoft.AspNetCore.Session .ConfigureServices(services => { services.AddSingleton(typeof(ILoggerFactory), loggerFactory); - - services.AddMemoryCache(); services.AddDistributedMemoryCache(); - services.AddSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30)); }); @@ -373,10 +359,7 @@ namespace Microsoft.AspNetCore.Session .ConfigureServices(services => { services.AddSingleton(typeof(ILoggerFactory), new NullLoggerFactory()); - - services.AddMemoryCache(); services.AddDistributedMemoryCache(); - services.AddSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20)); services.Configure(o => o.Clock = clock); }); @@ -426,9 +409,7 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddMemoryCache(); services.AddDistributedMemoryCache(); - services.AddSession(); }); @@ -471,9 +452,7 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddMemoryCache(); services.AddDistributedMemoryCache(); - services.AddSession(); }); @@ -502,9 +481,7 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddMemoryCache(); services.AddDistributedMemoryCache(); - services.AddSession(); }); @@ -516,6 +493,132 @@ namespace Microsoft.AspNetCore.Session } } + [Fact] + public async Task SessionLogsCacheReadException() + { + var sink = new TestSink(); + var loggerFactory = new TestLoggerFactory(sink, enabled: true); + var builder = new WebHostBuilder() + .Configure(app => + { + app.UseSession(); + app.Run(context => + { + byte[] value; + Assert.False(context.Session.TryGetValue("key", out value)); + Assert.Equal(null, value); + Assert.Equal(string.Empty, context.Session.Id); + Assert.False(context.Session.Keys.Any()); + return Task.FromResult(0); + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); + services.AddSingleton(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) + { + DisableGet = true + }); + services.AddSession(); + }); + + using (var server = new TestServer(builder)) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + response.EnsureSuccessStatusCode(); + + var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + + Assert.Equal(1, sessionLogMessages.Length); + Assert.Contains("Session cache read exception", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); + } + } + + [Fact] + public async Task SessionLogsCacheWriteException() + { + var sink = new TestSink(); + var loggerFactory = new TestLoggerFactory(sink, enabled: true); + var builder = new WebHostBuilder() + .Configure(app => + { + app.UseSession(); + app.Run(context => + { + context.Session.SetInt32("key", 0); + return Task.FromResult(0); + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); + services.AddSingleton(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) + { + DisableSetAsync = true + }); + services.AddSession(); + }); + + using (var server = new TestServer(builder)) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + response.EnsureSuccessStatusCode(); + + var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + + Assert.Equal(1, sessionLogMessages.Length); + Assert.Contains("Session started", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); + + var sessionMiddlewareLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + Assert.Equal(1, sessionMiddlewareLogMessages.Length); + Assert.Contains("Error closing the session.", sessionMiddlewareLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Error, sessionMiddlewareLogMessages[0].LogLevel); + } + } + + [Fact] + public async Task SessionLogsCacheRefreshException() + { + var sink = new TestSink(); + var loggerFactory = new TestLoggerFactory(sink, enabled: true); + var builder = new WebHostBuilder() + .Configure(app => + { + app.UseSession(); + app.Run(context => + { + // The middleware calls context.Session.CommitAsync() once per request + return Task.FromResult(0); + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); + services.AddSingleton(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) + { + DisableRefreshAsync = true + }); + services.AddSession(); + }); + + using (var server = new TestServer(builder)) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + response.EnsureSuccessStatusCode(); + + var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + + Assert.Equal(1, sessionLogMessages.Length); + Assert.Contains("Error closing the session.", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); + } + } + private class TestClock : ISystemClock { public TestClock() @@ -531,46 +634,47 @@ namespace Microsoft.AspNetCore.Session } } - private class TestDistributedCache : IDistributedCache + private class UnreliableCache : IDistributedCache { + private readonly MemoryDistributedCache _cache; + + public bool DisableGet { get; set; } + public bool DisableSetAsync { get; set; } + public bool DisableRefreshAsync { get; set; } + + public UnreliableCache(IMemoryCache memoryCache) + { + _cache = new MemoryDistributedCache(memoryCache); + } + public byte[] Get(string key) { - throw new NotImplementedException(); + if (DisableGet) + { + throw new InvalidOperationException(); + } + return _cache.Get(key); } - - public Task GetAsync(string key) - { - throw new NotImplementedException(); - } - - public void Refresh(string key) - { - throw new NotImplementedException(); - } - + public Task GetAsync(string key) => _cache.GetAsync(key); + public void Refresh(string key) => _cache.Refresh(key); public Task RefreshAsync(string key) { - throw new NotImplementedException(); + if (DisableRefreshAsync) + { + throw new InvalidOperationException(); + } + return _cache.RefreshAsync(key); } - - public void Remove(string key) - { - throw new NotImplementedException(); - } - - public Task RemoveAsync(string key) - { - throw new NotImplementedException(); - } - - public void Set(string key, byte[] value, DistributedCacheEntryOptions options) - { - throw new NotImplementedException(); - } - + public void Remove(string key) => _cache.Remove(key); + public Task RemoveAsync(string key) => _cache.RemoveAsync(key); + public void Set(string key, byte[] value, DistributedCacheEntryOptions options) => _cache.Set(key, value, options); public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options) { - throw new NotImplementedException(); + if (DisableSetAsync) + { + throw new InvalidOperationException(); + } + return _cache.SetAsync(key, value, options); } } } From 8469da66d0a9996c96fc77389d35e4bace69183d Mon Sep 17 00:00:00 2001 From: John Luo Date: Thu, 26 May 2016 18:34:09 -0700 Subject: [PATCH 156/295] React to updated CoreCLR packages https://github.com/aspnet/Coherence/issues/97 --- src/Microsoft.AspNetCore.Session/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 7eb81db2b5..5ed36e1299 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -32,7 +32,7 @@ "net451": {}, "netstandard1.3": { "dependencies": { - "System.Security.Cryptography.Algorithms": "4.1.0-*" + "System.Security.Cryptography.Algorithms": "4.2.0-*" } } } From 9d954e1bd9a5ed65a83404869d4207a2ff6063da Mon Sep 17 00:00:00 2001 From: Cesar Blum Silveira Date: Fri, 27 May 2016 11:29:01 -0700 Subject: [PATCH 157/295] Fix OSX build on Travis. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index df22f7a880..5b786d54f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,5 +22,7 @@ branches: - release - dev - /^(.*\/)?ci-.*$/ +before_install: + - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; brew link --force openssl; fi script: - ./build.sh verify \ No newline at end of file From e2fd776e5bc59041cc951461098529c84357bfe8 Mon Sep 17 00:00:00 2001 From: jacalvar Date: Tue, 7 Jun 2016 22:47:31 -0700 Subject: [PATCH 158/295] Remove unncessary usings --- samples/SessionSample/project.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 3b12791852..3b6a85fdbd 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -23,9 +23,6 @@ } }, "netcoreapp1.0": { - "imports": [ - "dnxcore50" - ], "dependencies": { "Microsoft.NETCore.App": { "version": "1.0.0-*", @@ -35,10 +32,7 @@ } }, "tools": { - "Microsoft.AspNetCore.Server.IISIntegration.Tools": { - "version": "1.0.0-*", - "imports": "portable-net45+wp80+win8+wpa81+dnxcore50" - } + "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-*" }, "scripts": { "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" From b2c7469f17246b31f102b123ef4cdb06f9c902df Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Wed, 8 Jun 2016 12:24:04 -0700 Subject: [PATCH 159/295] Fix Collection was modified exception in test --- .../SessionTests.cs | 86 ++++++++++--------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index ed7cf6c268..7c81e78383 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -259,15 +259,15 @@ namespace Microsoft.AspNetCore.Session var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); - - var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); - - Assert.Equal(2, sessionLogMessages.Length); - Assert.Contains("started", sessionLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); - Assert.Contains("stored", sessionLogMessages[1].State.ToString()); - Assert.Equal(LogLevel.Debug, sessionLogMessages[1].LogLevel); } + + var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + + Assert.Equal(2, sessionLogMessages.Length); + Assert.Contains("started", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); + Assert.Contains("stored", sessionLogMessages[1].State.ToString()); + Assert.Equal(LogLevel.Debug, sessionLogMessages[1].LogLevel); } [Fact] @@ -303,6 +303,7 @@ namespace Microsoft.AspNetCore.Session services.AddSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30)); }); + string result; using (var server = new TestServer(builder)) { var client = server.CreateClient(); @@ -313,18 +314,19 @@ namespace Microsoft.AspNetCore.Session var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First(); client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); Thread.Sleep(50); - Assert.Equal("2", await client.GetStringAsync("/second")); - - var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); - - Assert.Equal(3, sessionLogMessages.Length); - Assert.Contains("started", sessionLogMessages[0].State.ToString()); - Assert.Contains("stored", sessionLogMessages[1].State.ToString()); - Assert.Contains("expired", sessionLogMessages[2].State.ToString()); - Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); - Assert.Equal(LogLevel.Debug, sessionLogMessages[1].LogLevel); - Assert.Equal(LogLevel.Warning, sessionLogMessages[2].LogLevel); + result = await client.GetStringAsync("/second"); } + + var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + + Assert.Equal("2", result); + Assert.Equal(3, sessionLogMessages.Length); + Assert.Contains("started", sessionLogMessages[0].State.ToString()); + Assert.Contains("stored", sessionLogMessages[1].State.ToString()); + Assert.Contains("expired", sessionLogMessages[2].State.ToString()); + Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); + Assert.Equal(LogLevel.Debug, sessionLogMessages[1].LogLevel); + Assert.Equal(LogLevel.Warning, sessionLogMessages[2].LogLevel); } [Fact] @@ -527,13 +529,13 @@ namespace Microsoft.AspNetCore.Session var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); - - var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); - - Assert.Equal(1, sessionLogMessages.Length); - Assert.Contains("Session cache read exception", sessionLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); } + + var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + + Assert.Equal(1, sessionLogMessages.Length); + Assert.Contains("Session cache read exception", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); } [Fact] @@ -566,18 +568,18 @@ namespace Microsoft.AspNetCore.Session var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); - - var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); - - Assert.Equal(1, sessionLogMessages.Length); - Assert.Contains("Session started", sessionLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); - - var sessionMiddlewareLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); - Assert.Equal(1, sessionMiddlewareLogMessages.Length); - Assert.Contains("Error closing the session.", sessionMiddlewareLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Error, sessionMiddlewareLogMessages[0].LogLevel); } + + var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + + Assert.Equal(1, sessionLogMessages.Length); + Assert.Contains("Session started", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); + + var sessionMiddlewareLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + Assert.Equal(1, sessionMiddlewareLogMessages.Length); + Assert.Contains("Error closing the session.", sessionMiddlewareLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Error, sessionMiddlewareLogMessages[0].LogLevel); } [Fact] @@ -610,13 +612,13 @@ namespace Microsoft.AspNetCore.Session var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); - - var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); - - Assert.Equal(1, sessionLogMessages.Length); - Assert.Contains("Error closing the session.", sessionLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); } + + var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + + Assert.Equal(1, sessionLogMessages.Length); + Assert.Contains("Error closing the session.", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); } private class TestClock : ISystemClock From 0acc4f5775b51fe4d4659dff0da2b3ec8c97080b Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Mon, 13 Jun 2016 15:29:27 -0700 Subject: [PATCH 160/295] Remove direct Microsoft.NETCore.Platforms dependency. - Microsoft.NETCore.App now pulls this package in. aspnet/Coherence-Signed#344 --- samples/SessionSample/project.json | 1 - test/Microsoft.AspNetCore.Session.Tests/project.json | 1 - 2 files changed, 2 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 3b6a85fdbd..169963426d 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -3,7 +3,6 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", "Microsoft.AspNetCore.Session": "1.0.0-*", diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index cddfad394d..65ab7e30e7 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -1,7 +1,6 @@ { "dependencies": { "dotnet-test-xunit": "1.0.0-*", - "Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.AspNetCore.Session": "1.0.0-*", "Microsoft.AspNetCore.TestHost": "1.0.0-*", "Microsoft.Extensions.Caching.Memory": "1.0.0-*", From 028c7e2cece801f2992b3e690baa710cfad3290f Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 14 Jun 2016 16:22:50 -0700 Subject: [PATCH 161/295] Updating to release. --- NuGet.config | 2 +- build.ps1 | 2 +- build.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NuGet.config b/NuGet.config index 1707938c61..9db87a421e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 8f2f99691a..cf8bff13bb 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/release.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index f4208100eb..f88fe4052e 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/release.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi From 0112361557549dabb9b0cfd7ad80921f17c8efef Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 16 Jun 2016 10:18:38 -0700 Subject: [PATCH 162/295] Updating to dev versions --- samples/SessionSample/project.json | 14 +++++++------- src/Microsoft.AspNetCore.Session/project.json | 12 ++++++------ .../project.json | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 169963426d..0cecd6f841 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -3,12 +3,12 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*", - "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNetCore.Session": "1.0.0-*", - "Microsoft.Extensions.Caching.Memory": "1.0.0-*", - "Microsoft.Extensions.Caching.SqlServer": "1.0.0-*", - "Microsoft.Extensions.Logging.Console": "1.0.0-*" + "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-*", + "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", + "Microsoft.AspNetCore.Session": "1.1.0-*", + "Microsoft.Extensions.Caching.Memory": "1.1.0-*", + "Microsoft.Extensions.Caching.SqlServer": "1.1.0-*", + "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, "publishOptions": { "include": [ @@ -18,7 +18,7 @@ "frameworks": { "net451": { "dependencies": { - "Microsoft.Extensions.Caching.Redis": "1.0.0-*" + "Microsoft.Extensions.Caching.Redis": "1.1.0-*" } }, "netcoreapp1.0": { diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 5ed36e1299..ca6225bcf6 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -1,5 +1,5 @@ { - "version": "1.0.0-*", + "version": "1.1.0-*", "description": "ASP.NET Core session state middleware.", "packOptions": { "repository": { @@ -13,11 +13,11 @@ ] }, "dependencies": { - "Microsoft.AspNetCore.DataProtection": "1.0.0-*", - "Microsoft.AspNetCore.Http.Abstractions": "1.0.0-*", - "Microsoft.Extensions.Caching.Abstractions": "1.0.0-*", - "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", - "Microsoft.Extensions.Options": "1.0.0-*" + "Microsoft.AspNetCore.DataProtection": "1.1.0-*", + "Microsoft.AspNetCore.Http.Abstractions": "1.1.0-*", + "Microsoft.Extensions.Caching.Abstractions": "1.1.0-*", + "Microsoft.Extensions.Logging.Abstractions": "1.1.0-*", + "Microsoft.Extensions.Options": "1.1.0-*" }, "buildOptions": { "allowUnsafe": true, diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 65ab7e30e7..029be10c81 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -1,10 +1,10 @@ { "dependencies": { "dotnet-test-xunit": "1.0.0-*", - "Microsoft.AspNetCore.Session": "1.0.0-*", - "Microsoft.AspNetCore.TestHost": "1.0.0-*", - "Microsoft.Extensions.Caching.Memory": "1.0.0-*", - "Microsoft.Extensions.Logging.Testing": "1.0.0-*", + "Microsoft.AspNetCore.Session": "1.1.0-*", + "Microsoft.AspNetCore.TestHost": "1.1.0-*", + "Microsoft.Extensions.Caching.Memory": "1.1.0-*", + "Microsoft.Extensions.Logging.Testing": "1.1.0-*", "xunit": "2.1.0" }, "testRunner": "xunit", From 219ef7450be0d9f1e1228b0a27d9d0e070edccc2 Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Thu, 16 Jun 2016 09:51:33 -0700 Subject: [PATCH 163/295] #106 Fix: Adds Secure Cookie flag and tests --- .../SessionMiddleware.cs | 8 +++ .../SessionOptions.cs | 5 ++ .../SessionTests.cs | 53 +++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs index 8f6ff452f6..a9160e4a67 100644 --- a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs @@ -156,6 +156,14 @@ namespace Microsoft.AspNetCore.Session HttpOnly = _options.CookieHttpOnly, Path = _options.CookiePath ?? SessionDefaults.CookiePath, }; + if (_options.CookieSecure == CookieSecurePolicy.SameAsRequest) + { + cookieOptions.Secure = _context.Request.IsHttps; + } + else + { + cookieOptions.Secure = _options.CookieSecure == CookieSecurePolicy.Always; + } _context.Response.Cookies.Append(_options.CookieName, _cookieValue, cookieOptions); diff --git a/src/Microsoft.AspNetCore.Session/SessionOptions.cs b/src/Microsoft.AspNetCore.Session/SessionOptions.cs index 12caa678ad..41c13a8a06 100644 --- a/src/Microsoft.AspNetCore.Session/SessionOptions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionOptions.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Session; namespace Microsoft.AspNetCore.Builder @@ -35,6 +36,10 @@ namespace Microsoft.AspNetCore.Builder /// public bool CookieHttpOnly { get; set; } = true; + /// + /// Determines if the cookie should only be transmitted on HTTPS requests. + public CookieSecurePolicy CookieSecure { get; set; } = CookieSecurePolicy.None; + /// /// The IdleTimeout indicates how long the session can be idle before its contents are abandoned. Each session access /// resets the timeout. Note this only applies to the content of the session, not the cookie. diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 7c81e78383..b2a43f27d6 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -87,6 +87,59 @@ namespace Microsoft.AspNetCore.Session } } + [Theory] + [InlineData(CookieSecurePolicy.Always, "http://example.com/testpath", true)] + [InlineData(CookieSecurePolicy.Always, "https://example.com/testpath", true)] + [InlineData(CookieSecurePolicy.None, "http://example.com/testpath", false)] + [InlineData(CookieSecurePolicy.None, "https://example.com/testpath", false)] + [InlineData(CookieSecurePolicy.SameAsRequest, "http://example.com/testpath", false)] + [InlineData(CookieSecurePolicy.SameAsRequest, "https://example.com/testpath", true)] + public async Task SecureSessionBasedOnHttpsAndSecurePolicy( + CookieSecurePolicy cookieSecurePolicy, + string requestUri, + bool shouldBeSecureOnly) + { + var builder = new WebHostBuilder() + .Configure(app => + { + app.UseSession(new SessionOptions + { + CookieName = "TestCookie", + CookieSecure = cookieSecurePolicy + }); + app.Run(context => + { + Assert.Null(context.Session.GetString("Key")); + context.Session.SetString("Key", "Value"); + Assert.Equal("Value", context.Session.GetString("Key")); + return Task.FromResult(0); + }); + }) + .ConfigureServices(services => + { + services.AddDistributedMemoryCache(); + services.AddSession(); + }); + + using (var server = new TestServer(builder)) + { + var client = server.CreateClient(); + var response = await client.GetAsync(requestUri); + response.EnsureSuccessStatusCode(); + IEnumerable values; + Assert.True(response.Headers.TryGetValues("Set-Cookie", out values)); + Assert.Equal(1, values.Count()); + if (shouldBeSecureOnly) + { + Assert.Contains("; secure", values.First()); + } + else + { + Assert.DoesNotContain("; secure", values.First()); + } + } + } + [Fact] public async Task SessionCanBeAccessedOnTheNextRequest() { From 4f3d984f87f5c7b5946213419049a1d6e2dfff3a Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Thu, 16 Jun 2016 13:40:16 -0700 Subject: [PATCH 164/295] Forgotten summary tag --- src/Microsoft.AspNetCore.Session/SessionOptions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.AspNetCore.Session/SessionOptions.cs b/src/Microsoft.AspNetCore.Session/SessionOptions.cs index 41c13a8a06..a025b60932 100644 --- a/src/Microsoft.AspNetCore.Session/SessionOptions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionOptions.cs @@ -38,6 +38,7 @@ namespace Microsoft.AspNetCore.Builder /// /// Determines if the cookie should only be transmitted on HTTPS requests. + /// public CookieSecurePolicy CookieSecure { get; set; } = CookieSecurePolicy.None; /// From 7be2f4bebe1229fea4a6dbc58b6d68fb3504fb2c Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Fri, 1 Jul 2016 12:46:48 -0700 Subject: [PATCH 165/295] Updating to RTM builds of xunit and Moq --- .../project.json | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 029be10c81..7e23d1cb66 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -1,11 +1,11 @@ { "dependencies": { - "dotnet-test-xunit": "1.0.0-*", + "dotnet-test-xunit": "2.2.0-*", "Microsoft.AspNetCore.Session": "1.1.0-*", "Microsoft.AspNetCore.TestHost": "1.1.0-*", "Microsoft.Extensions.Caching.Memory": "1.1.0-*", "Microsoft.Extensions.Logging.Testing": "1.1.0-*", - "xunit": "2.1.0" + "xunit": "2.2.0-*" }, "testRunner": "xunit", "frameworks": { @@ -15,21 +15,9 @@ "version": "1.0.0-*", "type": "platform" }, - "System.Threading.Thread": "4.0.0-*", - "System.Diagnostics.Process": "4.1.0-*" - }, - "imports": [ - "dnxcore50", - "portable-net451+win8" - ] - }, - "net451": { - "frameworkAssemblies": { - "System.Threading.Tasks": "" - }, - "dependencies": { - "xunit.runner.console": "2.1.0" + "System.Threading.Thread": "4.0.0-*" } - } + }, + "net451": {} } } \ No newline at end of file From caa827f5c3574144cfb7345790cabc3dddbaf9e7 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Thu, 7 Jul 2016 12:43:58 -0700 Subject: [PATCH 166/295] One build to rule them all - well, at least VS and command-line builds will share output - part of aspnet/Coherence-Signed#277 --- samples/SessionSample/SessionSample.xproj | 4 ++-- .../Microsoft.AspNetCore.Session.xproj | 4 ++-- .../Microsoft.AspNetCore.Session.Tests.xproj | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/SessionSample/SessionSample.xproj b/samples/SessionSample/SessionSample.xproj index 23f0e9a0f1..8bf0bf2374 100644 --- a/samples/SessionSample/SessionSample.xproj +++ b/samples/SessionSample/SessionSample.xproj @@ -7,8 +7,8 @@ fe0b9969-3bde-4a7d-be1b-47eae8dbf365 - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\ + .\obj + .\bin\ 2.0 diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj index 18442b5af3..0ddd8c8e57 100644 --- a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj +++ b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj @@ -7,8 +7,8 @@ 71802736-f640-4733-9671-02d267edd76a - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\ + .\obj + .\bin\ 2.0 diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj index c030463c79..934269a7aa 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj @@ -7,8 +7,8 @@ 8c131a0a-bc1a-4cf3-8b77-8813fbfe5639 - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\ + .\obj + .\bin\ 2.0 From eaa8a0a91c642ecf034411dd6163d02fc29468bd Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Tue, 2 Aug 2016 13:13:20 -0700 Subject: [PATCH 167/295] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5b786d54f1..674d95bb7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,6 @@ branches: - dev - /^(.*\/)?ci-.*$/ before_install: - - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; brew link --force openssl; fi + - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi script: - - ./build.sh verify \ No newline at end of file + - ./build.sh verify From efe4477110cb9e184cd1937de022e4e88f3d43f4 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 9 Aug 2016 15:12:02 -0700 Subject: [PATCH 168/295] Switching to dotnet.myget.org feed --- NuGet.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NuGet.config b/NuGet.config index 1707938c61..826a1f9035 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + - + \ No newline at end of file From e77d7801adfec9794724e6b74c11b7afbd865e47 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Sun, 4 Sep 2016 18:18:24 -0700 Subject: [PATCH 169/295] Increase .travis.yml consistency between repos - aspnet/Universe#349 - minimize `dotnet` setup time; no need for caching - build with `--quiet` --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 674d95bb7d..d7636fa329 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,10 @@ addons: - libssl-dev - libunwind8 - zlib1g +env: + global: + - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + - DOTNET_CLI_TELEMETRY_OPTOUT: 1 mono: - 4.0.5 os: @@ -23,6 +27,6 @@ branches: - dev - /^(.*\/)?ci-.*$/ before_install: - - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi + - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi script: - - ./build.sh verify + - ./build.sh --quiet verify From 8f10080ad022e14ca8cdae74b34e84ef353efd93 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 28 Sep 2016 11:52:28 -0700 Subject: [PATCH 170/295] Updating partner package versions --- samples/SessionSample/project.json | 2 +- src/Microsoft.AspNetCore.Session/project.json | 9 +++------ test/Microsoft.AspNetCore.Session.Tests/project.json | 5 ++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 0cecd6f841..d73613027c 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -24,7 +24,7 @@ "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0-*", + "version": "1.1.0-*", "type": "platform" } } diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index ca6225bcf6..fe5fbc930b 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -17,7 +17,8 @@ "Microsoft.AspNetCore.Http.Abstractions": "1.1.0-*", "Microsoft.Extensions.Caching.Abstractions": "1.1.0-*", "Microsoft.Extensions.Logging.Abstractions": "1.1.0-*", - "Microsoft.Extensions.Options": "1.1.0-*" + "Microsoft.Extensions.Options": "1.1.0-*", + "NETStandard.Library": "1.6.1-*" }, "buildOptions": { "allowUnsafe": true, @@ -30,10 +31,6 @@ }, "frameworks": { "net451": {}, - "netstandard1.3": { - "dependencies": { - "System.Security.Cryptography.Algorithms": "4.2.0-*" - } - } + "netstandard1.3": {} } } \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 7e23d1cb66..97f9ce1433 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -12,10 +12,9 @@ "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0-*", + "version": "1.1.0-*", "type": "platform" - }, - "System.Threading.Thread": "4.0.0-*" + } } }, "net451": {} From 295d419265e0399d0129c1e2abb140f31f005cfe Mon Sep 17 00:00:00 2001 From: Hisham Bin Ateya Date: Wed, 5 Oct 2016 00:49:56 +0300 Subject: [PATCH 171/295] Update sample to include Redis for Core (#128) --- samples/SessionSample/Startup.cs | 10 +++++++--- samples/SessionSample/project.json | 7 ++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 8c65358399..1d98147980 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -30,11 +30,15 @@ namespace SessionSample // o.SchemaName = "dbo"; // o.TableName = "Sessions"; //}); -#if NET451 + // Uncomment the following line to use the Redis implementation of IDistributedCache. // This will override any previously registered IDistributedCache service. - //services.AddSingleton(); -#endif + //services.AddDistributedRedisCache(o => + //{ + // o.Configuration = "localhost"; + // o.InstanceName = "SampleInstance"; + //}); + services.AddSession(o => { o.IdleTimeout = TimeSpan.FromSeconds(10); diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index d73613027c..9729846107 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -7,6 +7,7 @@ "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", "Microsoft.AspNetCore.Session": "1.1.0-*", "Microsoft.Extensions.Caching.Memory": "1.1.0-*", + "Microsoft.Extensions.Caching.Redis": "1.1.0-*", "Microsoft.Extensions.Caching.SqlServer": "1.1.0-*", "Microsoft.Extensions.Logging.Console": "1.1.0-*" }, @@ -16,11 +17,7 @@ ] }, "frameworks": { - "net451": { - "dependencies": { - "Microsoft.Extensions.Caching.Redis": "1.1.0-*" - } - }, + "net451": {}, "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { From 1b9ae67215691931e03a452674b2660be6ecd9a0 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 12 Oct 2016 13:46:38 -0700 Subject: [PATCH 172/295] Updating to netcoreapp1.1 --- samples/SessionSample/project.json | 2 +- test/Microsoft.AspNetCore.Session.Tests/project.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 9729846107..e2a784bd99 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -18,7 +18,7 @@ }, "frameworks": { "net451": {}, - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 97f9ce1433..099a333024 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -9,7 +9,7 @@ }, "testRunner": "xunit", "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", From 763634e81ae25ceaae1f23d9f8ec489715819bd8 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 12 Oct 2016 16:09:45 -0700 Subject: [PATCH 173/295] Revert "Updating to netcoreapp1.1" This reverts commit 1b9ae67215691931e03a452674b2660be6ecd9a0. --- samples/SessionSample/project.json | 2 +- test/Microsoft.AspNetCore.Session.Tests/project.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index e2a784bd99..9729846107 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -18,7 +18,7 @@ }, "frameworks": { "net451": {}, - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 099a333024..97f9ce1433 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -9,7 +9,7 @@ }, "testRunner": "xunit", "frameworks": { - "netcoreapp1.1": { + "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", From c8fe8ded591fcc8ab7d5f774cafb1dd2da59b6f3 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 13 Oct 2016 11:25:11 -0700 Subject: [PATCH 174/295] Updating to netcoreapp1.1 --- samples/SessionSample/project.json | 2 +- test/Microsoft.AspNetCore.Session.Tests/project.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index 9729846107..e2a784bd99 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -18,7 +18,7 @@ }, "frameworks": { "net451": {}, - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 97f9ce1433..099a333024 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -9,7 +9,7 @@ }, "testRunner": "xunit", "frameworks": { - "netcoreapp1.0": { + "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0-*", From f9e492261c553a72173698b28f7f1f204cadb4dc Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 17 Oct 2016 09:49:48 -0700 Subject: [PATCH 175/295] Branching for 1.1.0-preview1 --- NuGet.config | 4 ++-- build.ps1 | 2 +- build.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NuGet.config b/NuGet.config index 826a1f9035..6197c93176 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + - + \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 8f2f99691a..787f63ac02 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.1.0-preview1.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index f4208100eb..355c682856 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.1.0-preview1.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi From 8ff910fdbe11e1442aba53dbbf4e7b49754ed6c6 Mon Sep 17 00:00:00 2001 From: jacalvar Date: Mon, 7 Nov 2016 21:48:11 -0800 Subject: [PATCH 176/295] Created public API baselines --- .../baseline.net45.json | 601 ++++++++++++++++++ .../baseline.netcore.json | 601 ++++++++++++++++++ 2 files changed, 1202 insertions(+) create mode 100644 src/Microsoft.AspNetCore.Session/baseline.net45.json create mode 100644 src/Microsoft.AspNetCore.Session/baseline.netcore.json diff --git a/src/Microsoft.AspNetCore.Session/baseline.net45.json b/src/Microsoft.AspNetCore.Session/baseline.net45.json new file mode 100644 index 0000000000..4a03419d7d --- /dev/null +++ b/src/Microsoft.AspNetCore.Session/baseline.net45.json @@ -0,0 +1,601 @@ +{ + "AssemblyIdentity": "Microsoft.AspNetCore.Session, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", + "Types": [ + { + "Name": "Microsoft.Extensions.DependencyInjection.SessionServiceCollectionExtensions", + "Visibility": "Public", + "Kind": "Class", + "Abstract": true, + "Static": true, + "Sealed": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "AddSession", + "Parameters": [ + { + "Name": "services", + "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" + } + ], + "ReturnType": "Microsoft.Extensions.DependencyInjection.IServiceCollection", + "Static": true, + "Extension": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "AddSession", + "Parameters": [ + { + "Name": "services", + "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" + }, + { + "Name": "configure", + "Type": "System.Action" + } + ], + "ReturnType": "Microsoft.Extensions.DependencyInjection.IServiceCollection", + "Static": true, + "Extension": true, + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Builder.SessionMiddlewareExtensions", + "Visibility": "Public", + "Kind": "Class", + "Abstract": true, + "Static": true, + "Sealed": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "UseSession", + "Parameters": [ + { + "Name": "app", + "Type": "Microsoft.AspNetCore.Builder.IApplicationBuilder" + } + ], + "ReturnType": "Microsoft.AspNetCore.Builder.IApplicationBuilder", + "Static": true, + "Extension": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "UseSession", + "Parameters": [ + { + "Name": "app", + "Type": "Microsoft.AspNetCore.Builder.IApplicationBuilder" + }, + { + "Name": "options", + "Type": "Microsoft.AspNetCore.Builder.SessionOptions" + } + ], + "ReturnType": "Microsoft.AspNetCore.Builder.IApplicationBuilder", + "Static": true, + "Extension": true, + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Builder.SessionOptions", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_CookieName", + "Parameters": [], + "ReturnType": "System.String", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_CookieName", + "Parameters": [ + { + "Name": "value", + "Type": "System.String" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_CookieDomain", + "Parameters": [], + "ReturnType": "System.String", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_CookieDomain", + "Parameters": [ + { + "Name": "value", + "Type": "System.String" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_CookiePath", + "Parameters": [], + "ReturnType": "System.String", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_CookiePath", + "Parameters": [ + { + "Name": "value", + "Type": "System.String" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_CookieHttpOnly", + "Parameters": [], + "ReturnType": "System.Boolean", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_CookieHttpOnly", + "Parameters": [ + { + "Name": "value", + "Type": "System.Boolean" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_IdleTimeout", + "Parameters": [], + "ReturnType": "System.TimeSpan", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_IdleTimeout", + "Parameters": [ + { + "Name": "value", + "Type": "System.TimeSpan" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.DistributedSession", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.AspNetCore.Http.ISession" + ], + "Members": [ + { + "Kind": "Method", + "Name": "get_IsAvailable", + "Parameters": [], + "ReturnType": "System.Boolean", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_Id", + "Parameters": [], + "ReturnType": "System.String", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_Keys", + "Parameters": [], + "ReturnType": "System.Collections.Generic.IEnumerable", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TryGetValue", + "Parameters": [ + { + "Name": "key", + "Type": "System.String" + }, + { + "Name": "value", + "Type": "System.Byte[]", + "Direction": "Out" + } + ], + "ReturnType": "System.Boolean", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "Set", + "Parameters": [ + { + "Name": "key", + "Type": "System.String" + }, + { + "Name": "value", + "Type": "System.Byte[]" + } + ], + "ReturnType": "System.Void", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "Remove", + "Parameters": [ + { + "Name": "key", + "Type": "System.String" + } + ], + "ReturnType": "System.Void", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "Clear", + "Parameters": [], + "ReturnType": "System.Void", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "LoadAsync", + "Parameters": [], + "ReturnType": "System.Threading.Tasks.Task", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "CommitAsync", + "Parameters": [], + "ReturnType": "System.Threading.Tasks.Task", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "cache", + "Type": "Microsoft.Extensions.Caching.Distributed.IDistributedCache" + }, + { + "Name": "sessionKey", + "Type": "System.String" + }, + { + "Name": "idleTimeout", + "Type": "System.TimeSpan" + }, + { + "Name": "tryEstablishSession", + "Type": "System.Func" + }, + { + "Name": "loggerFactory", + "Type": "Microsoft.Extensions.Logging.ILoggerFactory" + }, + { + "Name": "isNewSessionKey", + "Type": "System.Boolean" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.DistributedSessionStore", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.AspNetCore.Session.ISessionStore" + ], + "Members": [ + { + "Kind": "Method", + "Name": "Create", + "Parameters": [ + { + "Name": "sessionKey", + "Type": "System.String" + }, + { + "Name": "idleTimeout", + "Type": "System.TimeSpan" + }, + { + "Name": "tryEstablishSession", + "Type": "System.Func" + }, + { + "Name": "isNewSessionKey", + "Type": "System.Boolean" + } + ], + "ReturnType": "Microsoft.AspNetCore.Http.ISession", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Session.ISessionStore", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "cache", + "Type": "Microsoft.Extensions.Caching.Distributed.IDistributedCache" + }, + { + "Name": "loggerFactory", + "Type": "Microsoft.Extensions.Logging.ILoggerFactory" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.ISessionStore", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "Create", + "Parameters": [ + { + "Name": "sessionKey", + "Type": "System.String" + }, + { + "Name": "idleTimeout", + "Type": "System.TimeSpan" + }, + { + "Name": "tryEstablishSession", + "Type": "System.Func" + }, + { + "Name": "isNewSessionKey", + "Type": "System.Boolean" + } + ], + "ReturnType": "Microsoft.AspNetCore.Http.ISession", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.SessionDefaults", + "Visibility": "Public", + "Kind": "Class", + "Abstract": true, + "Static": true, + "Sealed": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Field", + "Name": "CookieName", + "Parameters": [], + "ReturnType": "System.String", + "Static": true, + "ReadOnly": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Field", + "Name": "CookiePath", + "Parameters": [], + "ReturnType": "System.String", + "Static": true, + "ReadOnly": true, + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.SessionFeature", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.AspNetCore.Http.Features.ISessionFeature" + ], + "Members": [ + { + "Kind": "Method", + "Name": "get_Session", + "Parameters": [], + "ReturnType": "Microsoft.AspNetCore.Http.ISession", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.Features.ISessionFeature", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_Session", + "Parameters": [ + { + "Name": "value", + "Type": "Microsoft.AspNetCore.Http.ISession" + } + ], + "ReturnType": "System.Void", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.Features.ISessionFeature", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.SessionMiddleware", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "Invoke", + "Parameters": [ + { + "Name": "context", + "Type": "Microsoft.AspNetCore.Http.HttpContext" + } + ], + "ReturnType": "System.Threading.Tasks.Task", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "next", + "Type": "Microsoft.AspNetCore.Http.RequestDelegate" + }, + { + "Name": "loggerFactory", + "Type": "Microsoft.Extensions.Logging.ILoggerFactory" + }, + { + "Name": "dataProtectionProvider", + "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider" + }, + { + "Name": "sessionStore", + "Type": "Microsoft.AspNetCore.Session.ISessionStore" + }, + { + "Name": "options", + "Type": "Microsoft.Extensions.Options.IOptions" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + } + ], + "SourceFilters": [] +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/baseline.netcore.json b/src/Microsoft.AspNetCore.Session/baseline.netcore.json new file mode 100644 index 0000000000..4a03419d7d --- /dev/null +++ b/src/Microsoft.AspNetCore.Session/baseline.netcore.json @@ -0,0 +1,601 @@ +{ + "AssemblyIdentity": "Microsoft.AspNetCore.Session, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", + "Types": [ + { + "Name": "Microsoft.Extensions.DependencyInjection.SessionServiceCollectionExtensions", + "Visibility": "Public", + "Kind": "Class", + "Abstract": true, + "Static": true, + "Sealed": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "AddSession", + "Parameters": [ + { + "Name": "services", + "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" + } + ], + "ReturnType": "Microsoft.Extensions.DependencyInjection.IServiceCollection", + "Static": true, + "Extension": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "AddSession", + "Parameters": [ + { + "Name": "services", + "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" + }, + { + "Name": "configure", + "Type": "System.Action" + } + ], + "ReturnType": "Microsoft.Extensions.DependencyInjection.IServiceCollection", + "Static": true, + "Extension": true, + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Builder.SessionMiddlewareExtensions", + "Visibility": "Public", + "Kind": "Class", + "Abstract": true, + "Static": true, + "Sealed": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "UseSession", + "Parameters": [ + { + "Name": "app", + "Type": "Microsoft.AspNetCore.Builder.IApplicationBuilder" + } + ], + "ReturnType": "Microsoft.AspNetCore.Builder.IApplicationBuilder", + "Static": true, + "Extension": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "UseSession", + "Parameters": [ + { + "Name": "app", + "Type": "Microsoft.AspNetCore.Builder.IApplicationBuilder" + }, + { + "Name": "options", + "Type": "Microsoft.AspNetCore.Builder.SessionOptions" + } + ], + "ReturnType": "Microsoft.AspNetCore.Builder.IApplicationBuilder", + "Static": true, + "Extension": true, + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Builder.SessionOptions", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_CookieName", + "Parameters": [], + "ReturnType": "System.String", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_CookieName", + "Parameters": [ + { + "Name": "value", + "Type": "System.String" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_CookieDomain", + "Parameters": [], + "ReturnType": "System.String", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_CookieDomain", + "Parameters": [ + { + "Name": "value", + "Type": "System.String" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_CookiePath", + "Parameters": [], + "ReturnType": "System.String", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_CookiePath", + "Parameters": [ + { + "Name": "value", + "Type": "System.String" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_CookieHttpOnly", + "Parameters": [], + "ReturnType": "System.Boolean", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_CookieHttpOnly", + "Parameters": [ + { + "Name": "value", + "Type": "System.Boolean" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_IdleTimeout", + "Parameters": [], + "ReturnType": "System.TimeSpan", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_IdleTimeout", + "Parameters": [ + { + "Name": "value", + "Type": "System.TimeSpan" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.DistributedSession", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.AspNetCore.Http.ISession" + ], + "Members": [ + { + "Kind": "Method", + "Name": "get_IsAvailable", + "Parameters": [], + "ReturnType": "System.Boolean", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_Id", + "Parameters": [], + "ReturnType": "System.String", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_Keys", + "Parameters": [], + "ReturnType": "System.Collections.Generic.IEnumerable", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TryGetValue", + "Parameters": [ + { + "Name": "key", + "Type": "System.String" + }, + { + "Name": "value", + "Type": "System.Byte[]", + "Direction": "Out" + } + ], + "ReturnType": "System.Boolean", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "Set", + "Parameters": [ + { + "Name": "key", + "Type": "System.String" + }, + { + "Name": "value", + "Type": "System.Byte[]" + } + ], + "ReturnType": "System.Void", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "Remove", + "Parameters": [ + { + "Name": "key", + "Type": "System.String" + } + ], + "ReturnType": "System.Void", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "Clear", + "Parameters": [], + "ReturnType": "System.Void", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "LoadAsync", + "Parameters": [], + "ReturnType": "System.Threading.Tasks.Task", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "CommitAsync", + "Parameters": [], + "ReturnType": "System.Threading.Tasks.Task", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "cache", + "Type": "Microsoft.Extensions.Caching.Distributed.IDistributedCache" + }, + { + "Name": "sessionKey", + "Type": "System.String" + }, + { + "Name": "idleTimeout", + "Type": "System.TimeSpan" + }, + { + "Name": "tryEstablishSession", + "Type": "System.Func" + }, + { + "Name": "loggerFactory", + "Type": "Microsoft.Extensions.Logging.ILoggerFactory" + }, + { + "Name": "isNewSessionKey", + "Type": "System.Boolean" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.DistributedSessionStore", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.AspNetCore.Session.ISessionStore" + ], + "Members": [ + { + "Kind": "Method", + "Name": "Create", + "Parameters": [ + { + "Name": "sessionKey", + "Type": "System.String" + }, + { + "Name": "idleTimeout", + "Type": "System.TimeSpan" + }, + { + "Name": "tryEstablishSession", + "Type": "System.Func" + }, + { + "Name": "isNewSessionKey", + "Type": "System.Boolean" + } + ], + "ReturnType": "Microsoft.AspNetCore.Http.ISession", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Session.ISessionStore", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "cache", + "Type": "Microsoft.Extensions.Caching.Distributed.IDistributedCache" + }, + { + "Name": "loggerFactory", + "Type": "Microsoft.Extensions.Logging.ILoggerFactory" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.ISessionStore", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "Create", + "Parameters": [ + { + "Name": "sessionKey", + "Type": "System.String" + }, + { + "Name": "idleTimeout", + "Type": "System.TimeSpan" + }, + { + "Name": "tryEstablishSession", + "Type": "System.Func" + }, + { + "Name": "isNewSessionKey", + "Type": "System.Boolean" + } + ], + "ReturnType": "Microsoft.AspNetCore.Http.ISession", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.SessionDefaults", + "Visibility": "Public", + "Kind": "Class", + "Abstract": true, + "Static": true, + "Sealed": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Field", + "Name": "CookieName", + "Parameters": [], + "ReturnType": "System.String", + "Static": true, + "ReadOnly": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Field", + "Name": "CookiePath", + "Parameters": [], + "ReturnType": "System.String", + "Static": true, + "ReadOnly": true, + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.SessionFeature", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.AspNetCore.Http.Features.ISessionFeature" + ], + "Members": [ + { + "Kind": "Method", + "Name": "get_Session", + "Parameters": [], + "ReturnType": "Microsoft.AspNetCore.Http.ISession", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.Features.ISessionFeature", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_Session", + "Parameters": [ + { + "Name": "value", + "Type": "Microsoft.AspNetCore.Http.ISession" + } + ], + "ReturnType": "System.Void", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.Http.Features.ISessionFeature", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.Session.SessionMiddleware", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "Invoke", + "Parameters": [ + { + "Name": "context", + "Type": "Microsoft.AspNetCore.Http.HttpContext" + } + ], + "ReturnType": "System.Threading.Tasks.Task", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "next", + "Type": "Microsoft.AspNetCore.Http.RequestDelegate" + }, + { + "Name": "loggerFactory", + "Type": "Microsoft.Extensions.Logging.ILoggerFactory" + }, + { + "Name": "dataProtectionProvider", + "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider" + }, + { + "Name": "sessionStore", + "Type": "Microsoft.AspNetCore.Session.ISessionStore" + }, + { + "Name": "options", + "Type": "Microsoft.Extensions.Options.IOptions" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + } + ], + "SourceFilters": [] +} \ No newline at end of file From 5274f5fc392342bb6b530d9a239dd4e209c5f300 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 9 Nov 2016 11:33:33 -0800 Subject: [PATCH 177/295] Branching for 1.1.0 --- NuGet.config | 4 ++-- build.ps1 | 2 +- build.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NuGet.config b/NuGet.config index 826a1f9035..6197c93176 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + - + \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 8f2f99691a..24ca167cf6 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.1.0.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index f4208100eb..fea9ac64ad 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.1.0.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi From 9c4b3863b90f2a45de5d18edfbe9b37e60219d09 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 9 Nov 2016 14:19:43 -0800 Subject: [PATCH 178/295] Updating versions to 1.2.0-* --- samples/SessionSample/project.json | 14 +++++++------- src/Microsoft.AspNetCore.Session/project.json | 12 ++++++------ .../project.json | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index e2a784bd99..d0bd196968 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -3,13 +3,13 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-*", - "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*", - "Microsoft.AspNetCore.Session": "1.1.0-*", - "Microsoft.Extensions.Caching.Memory": "1.1.0-*", - "Microsoft.Extensions.Caching.Redis": "1.1.0-*", - "Microsoft.Extensions.Caching.SqlServer": "1.1.0-*", - "Microsoft.Extensions.Logging.Console": "1.1.0-*" + "Microsoft.AspNetCore.Server.IISIntegration": "1.2.0-*", + "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", + "Microsoft.AspNetCore.Session": "1.2.0-*", + "Microsoft.Extensions.Caching.Memory": "1.2.0-*", + "Microsoft.Extensions.Caching.Redis": "1.2.0-*", + "Microsoft.Extensions.Caching.SqlServer": "1.2.0-*", + "Microsoft.Extensions.Logging.Console": "1.2.0-*" }, "publishOptions": { "include": [ diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index fe5fbc930b..723e368ab2 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -1,5 +1,5 @@ { - "version": "1.1.0-*", + "version": "1.2.0-*", "description": "ASP.NET Core session state middleware.", "packOptions": { "repository": { @@ -13,11 +13,11 @@ ] }, "dependencies": { - "Microsoft.AspNetCore.DataProtection": "1.1.0-*", - "Microsoft.AspNetCore.Http.Abstractions": "1.1.0-*", - "Microsoft.Extensions.Caching.Abstractions": "1.1.0-*", - "Microsoft.Extensions.Logging.Abstractions": "1.1.0-*", - "Microsoft.Extensions.Options": "1.1.0-*", + "Microsoft.AspNetCore.DataProtection": "1.2.0-*", + "Microsoft.AspNetCore.Http.Abstractions": "1.2.0-*", + "Microsoft.Extensions.Caching.Abstractions": "1.2.0-*", + "Microsoft.Extensions.Logging.Abstractions": "1.2.0-*", + "Microsoft.Extensions.Options": "1.2.0-*", "NETStandard.Library": "1.6.1-*" }, "buildOptions": { diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 099a333024..0443d257bf 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -1,10 +1,10 @@ { "dependencies": { "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Session": "1.1.0-*", - "Microsoft.AspNetCore.TestHost": "1.1.0-*", - "Microsoft.Extensions.Caching.Memory": "1.1.0-*", - "Microsoft.Extensions.Logging.Testing": "1.1.0-*", + "Microsoft.AspNetCore.Session": "1.2.0-*", + "Microsoft.AspNetCore.TestHost": "1.2.0-*", + "Microsoft.Extensions.Caching.Memory": "1.2.0-*", + "Microsoft.Extensions.Logging.Testing": "1.2.0-*", "xunit": "2.2.0-*" }, "testRunner": "xunit", From 7319f3011c7bced4b2b48b835d5b99bba59e3564 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 18 Nov 2016 10:56:59 -0800 Subject: [PATCH 179/295] Clean tmp folder after unzipping KoreBuild --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index f4208100eb..4fd7ede788 100755 --- a/build.sh +++ b/build.sh @@ -38,7 +38,7 @@ if test ! -d $buildFolder; then chmod +x $buildFile # Cleanup - if test ! -d $tempFolder; then + if test -d $tempFolder; then rm -rf $tempFolder fi fi From 32e6fc6a74beee17e3f830bd7efae4710fdde160 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Wed, 23 Nov 2016 15:59:46 -0800 Subject: [PATCH 180/295] Pin global.json SDK to 1.0.0-preview2-1-003177. --- global.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index d9b4ed63ae..f45e8cc925 100644 --- a/global.json +++ b/global.json @@ -1,3 +1,8 @@ { - "projects": [ "src" ] -} + "projects": [ + "src" + ], + "sdk": { + "version": "1.0.0-preview2-1-003177" + } +} \ No newline at end of file From 4f9c1b6dd6af26b441b7299d4947b284d13cd656 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 8 Dec 2016 10:03:51 -0800 Subject: [PATCH 181/295] Update .travis.yml osx image to xcode7.3. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d7636fa329..a0be886892 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ mono: os: - linux - osx -osx_image: xcode7.1 +osx_image: xcode7.3 branches: only: - master From 9c52136f6cb6d4270f2ba7059bfac0124879976a Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Mon, 12 Dec 2016 00:39:40 -0800 Subject: [PATCH 182/295] Removed packages list in NuGetPackageVerifier.json --- NuGetPackageVerifier.json | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json index bf800fecdf..b153ab1515 100644 --- a/NuGetPackageVerifier.json +++ b/NuGetPackageVerifier.json @@ -1,13 +1,5 @@ { - "adx": { // Packages written by the ADX team and that ship on NuGet.org - "rules": [ - "AdxVerificationCompositeRule" - ], - "packages": { - "Microsoft.AspNetCore.Session": { } - } - }, - "Default": { // Rules to run for packages not listed in any other set. + "Default": { "rules": [ "DefaultCompositeRule" ] From ae24eea1a1285b139afbb6a480959a91627483eb Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 5 Dec 2016 09:03:55 -0800 Subject: [PATCH 183/295] Updating to 4.4 CoreFx packages --- global.json | 2 +- samples/SessionSample/project.json | 2 +- src/Microsoft.AspNetCore.Session/project.json | 2 +- test/Microsoft.AspNetCore.Session.Tests/project.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/global.json b/global.json index f45e8cc925..0ad1995dd2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "src" ], "sdk": { - "version": "1.0.0-preview2-1-003177" + "version": "1.0.0-preview2-1-003180" } } \ No newline at end of file diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json index d0bd196968..54e94135f4 100644 --- a/samples/SessionSample/project.json +++ b/samples/SessionSample/project.json @@ -21,7 +21,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.1.0-*", + "version": "1.2.0-*", "type": "platform" } } diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json index 723e368ab2..52c00f9014 100644 --- a/src/Microsoft.AspNetCore.Session/project.json +++ b/src/Microsoft.AspNetCore.Session/project.json @@ -18,7 +18,7 @@ "Microsoft.Extensions.Caching.Abstractions": "1.2.0-*", "Microsoft.Extensions.Logging.Abstractions": "1.2.0-*", "Microsoft.Extensions.Options": "1.2.0-*", - "NETStandard.Library": "1.6.1-*" + "NETStandard.Library": "1.6.2-*" }, "buildOptions": { "allowUnsafe": true, diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json index 0443d257bf..837cfa2601 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ b/test/Microsoft.AspNetCore.Session.Tests/project.json @@ -12,7 +12,7 @@ "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.1.0-*", + "version": "1.2.0-*", "type": "platform" } } From c95639b8868a5ddf4addc7ae1e7ee986116b2614 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 10 Jan 2017 12:17:30 -0800 Subject: [PATCH 184/295] Prevent race when validating logs by only examining logs from Session #135 --- .../SessionTests.cs | 59 ++++++++++++------- .../TestExtensions.cs | 18 ------ 2 files changed, 38 insertions(+), 39 deletions(-) delete mode 100644 test/Microsoft.AspNetCore.Session.Tests/TestExtensions.cs diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index b2a43f27d6..0f783d39ae 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -288,7 +288,9 @@ namespace Microsoft.AspNetCore.Session [Fact] public async Task SessionStart_LogsInformation() { - var sink = new TestSink(); + var sink = new TestSink( + TestSink.EnableWithTypeName, + TestSink.EnableWithTypeName); var loggerFactory = new TestLoggerFactory(sink, enabled: true); var builder = new WebHostBuilder() .Configure(app => @@ -314,9 +316,9 @@ namespace Microsoft.AspNetCore.Session response.EnsureSuccessStatusCode(); } - var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + var sessionLogMessages = sink.Writes; - Assert.Equal(2, sessionLogMessages.Length); + Assert.Equal(2, sessionLogMessages.Count); Assert.Contains("started", sessionLogMessages[0].State.ToString()); Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); Assert.Contains("stored", sessionLogMessages[1].State.ToString()); @@ -326,7 +328,9 @@ namespace Microsoft.AspNetCore.Session [Fact] public async Task ExpiredSession_LogsWarning() { - var sink = new TestSink(); + var sink = new TestSink( + TestSink.EnableWithTypeName, + TestSink.EnableWithTypeName); var loggerFactory = new TestLoggerFactory(sink, enabled: true); var builder = new WebHostBuilder() .Configure(app => @@ -370,10 +374,10 @@ namespace Microsoft.AspNetCore.Session result = await client.GetStringAsync("/second"); } - var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + var sessionLogMessages = sink.Writes; Assert.Equal("2", result); - Assert.Equal(3, sessionLogMessages.Length); + Assert.Equal(3, sessionLogMessages.Count); Assert.Contains("started", sessionLogMessages[0].State.ToString()); Assert.Contains("stored", sessionLogMessages[1].State.ToString()); Assert.Contains("expired", sessionLogMessages[2].State.ToString()); @@ -551,7 +555,9 @@ namespace Microsoft.AspNetCore.Session [Fact] public async Task SessionLogsCacheReadException() { - var sink = new TestSink(); + var sink = new TestSink( + TestSink.EnableWithTypeName, + TestSink.EnableWithTypeName); var loggerFactory = new TestLoggerFactory(sink, enabled: true); var builder = new WebHostBuilder() .Configure(app => @@ -584,9 +590,9 @@ namespace Microsoft.AspNetCore.Session response.EnsureSuccessStatusCode(); } - var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + var sessionLogMessages = sink.Writes; - Assert.Equal(1, sessionLogMessages.Length); + Assert.Equal(1, sessionLogMessages.Count); Assert.Contains("Session cache read exception", sessionLogMessages[0].State.ToString()); Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); } @@ -594,7 +600,17 @@ namespace Microsoft.AspNetCore.Session [Fact] public async Task SessionLogsCacheWriteException() { - var sink = new TestSink(); + var sink = new TestSink( + writeContext => + { + return writeContext.LoggerName.Equals(typeof(SessionMiddleware).FullName) + || writeContext.LoggerName.Equals(typeof(DistributedSession).FullName); + }, + beginScopeContext => + { + return beginScopeContext.LoggerName.Equals(typeof(SessionMiddleware).FullName) + || beginScopeContext.LoggerName.Equals(typeof(DistributedSession).FullName); + }); var loggerFactory = new TestLoggerFactory(sink, enabled: true); var builder = new WebHostBuilder() .Configure(app => @@ -623,22 +639,23 @@ namespace Microsoft.AspNetCore.Session response.EnsureSuccessStatusCode(); } - var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + var sessionLogMessage = sink.Writes.Where(message => message.LoggerName.Equals(typeof(DistributedSession).FullName, StringComparison.Ordinal)).Single(); - Assert.Equal(1, sessionLogMessages.Length); - Assert.Contains("Session started", sessionLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); + Assert.Contains("Session started", sessionLogMessage.State.ToString()); + Assert.Equal(LogLevel.Information, sessionLogMessage.LogLevel); - var sessionMiddlewareLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); - Assert.Equal(1, sessionMiddlewareLogMessages.Length); - Assert.Contains("Error closing the session.", sessionMiddlewareLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Error, sessionMiddlewareLogMessages[0].LogLevel); + var sessionMiddlewareLogMessage = sink.Writes.Where(message => message.LoggerName.Equals(typeof(SessionMiddleware).FullName, StringComparison.Ordinal)).Single(); + + Assert.Contains("Error closing the session.", sessionMiddlewareLogMessage.State.ToString()); + Assert.Equal(LogLevel.Error, sessionMiddlewareLogMessage.LogLevel); } [Fact] public async Task SessionLogsCacheRefreshException() { - var sink = new TestSink(); + var sink = new TestSink( + TestSink.EnableWithTypeName, + TestSink.EnableWithTypeName); var loggerFactory = new TestLoggerFactory(sink, enabled: true); var builder = new WebHostBuilder() .Configure(app => @@ -667,9 +684,9 @@ namespace Microsoft.AspNetCore.Session response.EnsureSuccessStatusCode(); } - var sessionLogMessages = sink.Writes.OnlyMessagesFromSource().ToArray(); + var sessionLogMessages = sink.Writes; - Assert.Equal(1, sessionLogMessages.Length); + Assert.Equal(1, sessionLogMessages.Count); Assert.Contains("Error closing the session.", sessionLogMessages[0].State.ToString()); Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); } diff --git a/test/Microsoft.AspNetCore.Session.Tests/TestExtensions.cs b/test/Microsoft.AspNetCore.Session.Tests/TestExtensions.cs deleted file mode 100644 index ddd2152589..0000000000 --- a/test/Microsoft.AspNetCore.Session.Tests/TestExtensions.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) .NET Foundation. 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.Generic; -using System.Linq; -using Microsoft.Extensions.Logging.Testing; - -namespace Microsoft.AspNetCore.Session -{ - public static class TestExtensions - { - public static IEnumerable OnlyMessagesFromSource(this IEnumerable source) - { - return source.Where(message => message.LoggerName.Equals(typeof(T).FullName, StringComparison.Ordinal)); - } - } -} From 499f3029c45045e8a1e7fa178e58ea9c3eb8533c Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 31 Jan 2017 16:13:20 -0800 Subject: [PATCH 185/295] Upgrade to VS 2017 --- NuGet.config | 5 ++- Session.sln | 15 +++----- appveyor.yml | 3 +- build.ps1 | 2 +- build.sh | 2 +- {tools => build}/Key.snk | Bin build/common.props | 24 ++++++++++++ global.json | 8 ---- samples/SessionSample/SessionSample.csproj | 20 ++++++++++ samples/SessionSample/SessionSample.xproj | 18 --------- samples/SessionSample/project.json | 36 ------------------ .../Microsoft.AspNetCore.Session.csproj | 22 +++++++++++ .../Microsoft.AspNetCore.Session.xproj | 17 --------- .../Properties/AssemblyInfo.cs | 11 ------ src/Microsoft.AspNetCore.Session/project.json | 36 ------------------ .../Microsoft.AspNetCore.Session.Tests.csproj | 20 ++++++++++ .../Microsoft.AspNetCore.Session.Tests.xproj | 20 ---------- .../project.json | 22 ----------- version.props | 7 ++++ 19 files changed, 105 insertions(+), 183 deletions(-) rename {tools => build}/Key.snk (100%) create mode 100644 build/common.props delete mode 100644 global.json create mode 100644 samples/SessionSample/SessionSample.csproj delete mode 100644 samples/SessionSample/SessionSample.xproj delete mode 100644 samples/SessionSample/project.json create mode 100644 src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj delete mode 100644 src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj delete mode 100644 src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs delete mode 100644 src/Microsoft.AspNetCore.Session/project.json create mode 100644 test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj delete mode 100644 test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj delete mode 100644 test/Microsoft.AspNetCore.Session.Tests/project.json create mode 100644 version.props diff --git a/NuGet.config b/NuGet.config index 826a1f9035..8e65695611 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,8 @@ - + + - \ No newline at end of file + diff --git a/Session.sln b/Session.sln index ea16779ff6..bcd5aa0227 100644 --- a/Session.sln +++ b/Session.sln @@ -1,24 +1,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.22625.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26127.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A189F10C-3A9C-4F81-83D0-32E5FE50DAD8}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Session", "src\Microsoft.AspNetCore.Session\Microsoft.AspNetCore.Session.xproj", "{71802736-F640-4733-9671-02D267EDD76A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Session", "src\Microsoft.AspNetCore.Session\Microsoft.AspNetCore.Session.csproj", "{71802736-F640-4733-9671-02D267EDD76A}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Session.Tests", "test\Microsoft.AspNetCore.Session.Tests\Microsoft.AspNetCore.Session.Tests.xproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Session.Tests", "test\Microsoft.AspNetCore.Session.Tests\Microsoft.AspNetCore.Session.Tests.csproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SessionSample", "samples\SessionSample\SessionSample.xproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6CB0FEE3-129E-488A-801A-6DE479AEC416}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - EndProjectSection +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SessionSample", "samples\SessionSample\SessionSample.csproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/appveyor.yml b/appveyor.yml index b9a9bcd1e6..df67923781 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,4 +10,5 @@ build_script: - build.cmd verify clone_depth: 1 test: off -deploy: off \ No newline at end of file +deploy: off +os: Visual Studio 2017 RC diff --git a/build.ps1 b/build.ps1 index 8f2f99691a..0605b59c01 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/feature/msbuild.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index 4fd7ede788..07997d6c83 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/feature/msbuild.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi diff --git a/tools/Key.snk b/build/Key.snk similarity index 100% rename from tools/Key.snk rename to build/Key.snk diff --git a/build/common.props b/build/common.props new file mode 100644 index 0000000000..e80159e773 --- /dev/null +++ b/build/common.props @@ -0,0 +1,24 @@ + + + + + Microsoft ASP.NET Core + https://github.com/aspnet/Session + git + $(MSBuildThisFileDirectory)Key.snk + true + true + 1.2.0-* + 1.6.2-* + $(VersionSuffix)-$(BuildNumber) + + + + + + + + + + + diff --git a/global.json b/global.json deleted file mode 100644 index 0ad1995dd2..0000000000 --- a/global.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "projects": [ - "src" - ], - "sdk": { - "version": "1.0.0-preview2-1-003180" - } -} \ No newline at end of file diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj new file mode 100644 index 0000000000..0b6a0c3f74 --- /dev/null +++ b/samples/SessionSample/SessionSample.csproj @@ -0,0 +1,20 @@ + + + + net451;netcoreapp1.1 + + win7-x64 + Exe + + + + + + + + + + + + + diff --git a/samples/SessionSample/SessionSample.xproj b/samples/SessionSample/SessionSample.xproj deleted file mode 100644 index 8bf0bf2374..0000000000 --- a/samples/SessionSample/SessionSample.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - fe0b9969-3bde-4a7d-be1b-47eae8dbf365 - .\obj - .\bin\ - - - 2.0 - 29562 - - - \ No newline at end of file diff --git a/samples/SessionSample/project.json b/samples/SessionSample/project.json deleted file mode 100644 index 54e94135f4..0000000000 --- a/samples/SessionSample/project.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "dependencies": { - "Microsoft.AspNetCore.Server.IISIntegration": "1.2.0-*", - "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*", - "Microsoft.AspNetCore.Session": "1.2.0-*", - "Microsoft.Extensions.Caching.Memory": "1.2.0-*", - "Microsoft.Extensions.Caching.Redis": "1.2.0-*", - "Microsoft.Extensions.Caching.SqlServer": "1.2.0-*", - "Microsoft.Extensions.Logging.Console": "1.2.0-*" - }, - "publishOptions": { - "include": [ - "web.config" - ] - }, - "frameworks": { - "net451": {}, - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.2.0-*", - "type": "platform" - } - } - } - }, - "tools": { - "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-*" - }, - "scripts": { - "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj new file mode 100644 index 0000000000..529641be39 --- /dev/null +++ b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj @@ -0,0 +1,22 @@ + + + + + + ASP.NET Core session state middleware. + net451;netstandard1.3 + $(NoWarn);CS1591 + true + true + aspnetcore;session;sessionstate + + + + + + + + + + + diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj deleted file mode 100644 index 0ddd8c8e57..0000000000 --- a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.xproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 71802736-f640-4733-9671-02d267edd76a - .\obj - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs deleted file mode 100644 index 76feceeff0..0000000000 --- a/src/Microsoft.AspNetCore.Session/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Reflection; -using System.Resources; - -[assembly: AssemblyMetadata("Serviceable", "True")] -[assembly: NeutralResourcesLanguage("en-us")] -[assembly: AssemblyCompany("Microsoft Corporation.")] -[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyProduct("Microsoft ASP.NET Core")] diff --git a/src/Microsoft.AspNetCore.Session/project.json b/src/Microsoft.AspNetCore.Session/project.json deleted file mode 100644 index 52c00f9014..0000000000 --- a/src/Microsoft.AspNetCore.Session/project.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "version": "1.2.0-*", - "description": "ASP.NET Core session state middleware.", - "packOptions": { - "repository": { - "type": "git", - "url": "git://github.com/aspnet/session" - }, - "tags": [ - "aspnetcore", - "session", - "sessionstate" - ] - }, - "dependencies": { - "Microsoft.AspNetCore.DataProtection": "1.2.0-*", - "Microsoft.AspNetCore.Http.Abstractions": "1.2.0-*", - "Microsoft.Extensions.Caching.Abstractions": "1.2.0-*", - "Microsoft.Extensions.Logging.Abstractions": "1.2.0-*", - "Microsoft.Extensions.Options": "1.2.0-*", - "NETStandard.Library": "1.6.2-*" - }, - "buildOptions": { - "allowUnsafe": true, - "warningsAsErrors": true, - "keyFile": "../../tools/Key.snk", - "nowarn": [ - "CS1591" - ], - "xmlDoc": true - }, - "frameworks": { - "net451": {}, - "netstandard1.3": {} - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj new file mode 100644 index 0000000000..e13c7afffa --- /dev/null +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -0,0 +1,20 @@ + + + + + + netcoreapp1.1 + $(TargetFrameworks);net451 + + + + + + + + + + + + + diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj deleted file mode 100644 index 934269a7aa..0000000000 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.xproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 8c131a0a-bc1a-4cf3-8b77-8813fbfe5639 - .\obj - .\bin\ - - - 2.0 - - - - - - \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Session.Tests/project.json b/test/Microsoft.AspNetCore.Session.Tests/project.json deleted file mode 100644 index 837cfa2601..0000000000 --- a/test/Microsoft.AspNetCore.Session.Tests/project.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "dependencies": { - "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.Session": "1.2.0-*", - "Microsoft.AspNetCore.TestHost": "1.2.0-*", - "Microsoft.Extensions.Caching.Memory": "1.2.0-*", - "Microsoft.Extensions.Logging.Testing": "1.2.0-*", - "xunit": "2.2.0-*" - }, - "testRunner": "xunit", - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.2.0-*", - "type": "platform" - } - } - }, - "net451": {} - } -} \ No newline at end of file diff --git a/version.props b/version.props new file mode 100644 index 0000000000..17fd5ac36d --- /dev/null +++ b/version.props @@ -0,0 +1,7 @@ + + + + 1.2.0 + preview1 + + From c42c7f7da4529ef030eee54ea47241e827f7aa05 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 1 Feb 2017 12:14:56 -0800 Subject: [PATCH 186/295] Remove usage of conditional multi-targeting This causes Visual Studio to crash. See dotnet/roslyn-project-system#1431 --- .../Microsoft.AspNetCore.Session.Tests.csproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index e13c7afffa..b76a7da590 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -3,8 +3,7 @@ - netcoreapp1.1 - $(TargetFrameworks);net451 + netcoreapp1.1;net451 From 250eeaed3b15113c5790a9d9daafe19d08cbf359 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Tue, 14 Feb 2017 13:25:21 -0800 Subject: [PATCH 187/295] Bump test projects up to .NET 4.5.2 - aspnet/Testing#248 - xUnit no longer supports .NET 4.5.1 - build tests for desktop .NET only on Windows --- .../Microsoft.AspNetCore.Session.Tests.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index b76a7da590..2b5c7d1467 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -3,7 +3,8 @@ - netcoreapp1.1;net451 + netcoreapp1.1;net452 + netcoreapp1.1 From 95b73eae15af9e9d8bf974a88d0432067e1e5612 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 14 Feb 2017 16:03:54 -0800 Subject: [PATCH 188/295] Downgrade to stable packages --- build/common.props | 3 +-- build/dependencies.props | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 build/dependencies.props diff --git a/build/common.props b/build/common.props index e80159e773..27a47a41e2 100644 --- a/build/common.props +++ b/build/common.props @@ -1,4 +1,5 @@ + @@ -8,8 +9,6 @@ $(MSBuildThisFileDirectory)Key.snk true true - 1.2.0-* - 1.6.2-* $(VersionSuffix)-$(BuildNumber) diff --git a/build/dependencies.props b/build/dependencies.props new file mode 100644 index 0000000000..e704edaec0 --- /dev/null +++ b/build/dependencies.props @@ -0,0 +1,6 @@ + + + 1.6.1 + 4.3.0 + + From 20cacab1326779929acee003d016071b2a1c8c1e Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 1 Mar 2017 18:14:14 -0800 Subject: [PATCH 189/295] Change korebuild branch and fix argument forwarding in bootstrapper --- build.ps1 | 16 ++++++++-------- build.sh | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build.ps1 b/build.ps1 index 0605b59c01..5bf0e2c113 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,6 +1,6 @@ $ErrorActionPreference = "Stop" -function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) +function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) { while($true) { @@ -19,7 +19,7 @@ function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $ret Start-Sleep -Seconds 10 } - else + else { $exception = $_.Exception throw $exception @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/feature/msbuild.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP @@ -43,18 +43,18 @@ $buildFolder = ".build" $buildFile="$buildFolder\KoreBuild.ps1" if (!(Test-Path $buildFolder)) { - Write-Host "Downloading KoreBuild from $koreBuildZip" - + Write-Host "Downloading KoreBuild from $koreBuildZip" + $tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid() New-Item -Path "$tempFolder" -Type directory | Out-Null $localZipFile="$tempFolder\korebuild.zip" - + DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6 Add-Type -AssemblyName System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) - + New-Item -Path "$buildFolder" -Type directory | Out-Null copy-item "$tempFolder\**\build\*" $buildFolder -Recurse @@ -64,4 +64,4 @@ if (!(Test-Path $buildFolder)) { } } -&"$buildFile" $args \ No newline at end of file +&"$buildFile" @args diff --git a/build.sh b/build.sh index 07997d6c83..b0bcadb579 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/feature/msbuild.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi @@ -12,12 +12,12 @@ buildFile="$buildFolder/KoreBuild.sh" if test ! -d $buildFolder; then echo "Downloading KoreBuild from $koreBuildZip" - - tempFolder="/tmp/KoreBuild-$(uuidgen)" + + tempFolder="/tmp/KoreBuild-$(uuidgen)" mkdir $tempFolder - + localZipFile="$tempFolder/korebuild.zip" - + retries=6 until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null) do @@ -29,18 +29,18 @@ if test ! -d $buildFolder; then echo "Waiting 10 seconds before retrying. Retries left: $retries" sleep 10s done - + unzip -q -d $tempFolder $localZipFile - + mkdir $buildFolder cp -r $tempFolder/**/build/** $buildFolder - + chmod +x $buildFile - + # Cleanup if test -d $tempFolder; then - rm -rf $tempFolder + rm -rf $tempFolder fi fi -$buildFile -r $repoFolder "$@" \ No newline at end of file +$buildFile -r $repoFolder "$@" From eb97978989f40eba65731e2cd7c772a4a257b94e Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 1 Mar 2017 18:25:50 -0800 Subject: [PATCH 190/295] Update AppVeyor and Travis settings --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a0be886892..af659e9ae9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,4 +29,4 @@ branches: before_install: - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi script: - - ./build.sh --quiet verify + - ./build.sh diff --git a/appveyor.yml b/appveyor.yml index df67923781..3f828ce38e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ branches: - dev - /^(.*\/)?ci-.*$/ build_script: - - build.cmd verify + - ps: .\build.ps1 clone_depth: 1 test: off deploy: off From 8e87ba74703610d73e3a889a0c57b8d73df8d269 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Thu, 9 Mar 2017 11:25:20 -0800 Subject: [PATCH 191/295] Update .travis.yml (#153) --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index af659e9ae9..b8f60ce2e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,8 +14,7 @@ env: global: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - DOTNET_CLI_TELEMETRY_OPTOUT: 1 -mono: - - 4.0.5 +mono: none os: - linux - osx From df0d4cbfa8a5f7ac0f4cd7a8197efcc999b39444 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Mon, 13 Mar 2017 20:52:05 -0700 Subject: [PATCH 192/295] Using NullLogger types from Logging.Abstractions --- test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 0f783d39ae..06aff0a31d 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -16,6 +16,7 @@ using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Testing; using Microsoft.Net.Http.Headers; using Xunit; @@ -417,7 +418,7 @@ namespace Microsoft.AspNetCore.Session }) .ConfigureServices(services => { - services.AddSingleton(typeof(ILoggerFactory), new NullLoggerFactory()); + services.AddSingleton(typeof(ILoggerFactory), NullLoggerFactory.Instance); services.AddDistributedMemoryCache(); services.AddSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20)); services.Configure(o => o.Clock = clock); From a649668dbaf847f82ba1f48461aca3cdc5c652ee Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 14 Mar 2017 13:41:35 -0700 Subject: [PATCH 193/295] Update appveyor and travis settings --- .travis.yml | 1 - appveyor.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b8f60ce2e5..e4c69a2a09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,6 @@ mono: none os: - linux - osx -osx_image: xcode7.3 branches: only: - master diff --git a/appveyor.yml b/appveyor.yml index 3f828ce38e..1041615c68 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,4 +11,4 @@ build_script: clone_depth: 1 test: off deploy: off -os: Visual Studio 2017 RC +os: Visual Studio 2017 From 6ef43e91b55aaf73e0169ad2bd1151cdb8e2487e Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 15 Mar 2017 17:50:59 -0700 Subject: [PATCH 194/295] Consolidate dependency versions to one file and remove workarounds --- build/dependencies.props | 5 ++++- samples/SessionSample/SessionSample.csproj | 20 ++++++++++--------- samples/SessionSample/web.config | 9 --------- .../Microsoft.AspNetCore.Session.csproj | 10 +++++----- .../Microsoft.AspNetCore.Session.Tests.csproj | 15 ++++++++------ 5 files changed, 29 insertions(+), 30 deletions(-) delete mode 100644 samples/SessionSample/web.config diff --git a/build/dependencies.props b/build/dependencies.props index e704edaec0..5a4c06ce33 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,6 +1,9 @@ - 1.6.1 + 1.2.0-* 4.3.0 + 1.6.1 + 15.0.0 + 2.2.0 diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj index 0b6a0c3f74..959f560f93 100644 --- a/samples/SessionSample/SessionSample.csproj +++ b/samples/SessionSample/SessionSample.csproj @@ -1,20 +1,22 @@ + + net451;netcoreapp1.1 - - win7-x64 - Exe - - - - - - + + + + + + + + + diff --git a/samples/SessionSample/web.config b/samples/SessionSample/web.config deleted file mode 100644 index f7ac679334..0000000000 --- a/samples/SessionSample/web.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj index 529641be39..3ec0f05b06 100644 --- a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj +++ b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj @@ -12,11 +12,11 @@ - - - - - + + + + + diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index 2b5c7d1467..8cd81cacbb 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -9,12 +9,15 @@ - - - - - - + + + + + + + + + From 088f47bf014cff29813502788bbab265287da29b Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 21 Mar 2017 12:17:39 -0700 Subject: [PATCH 195/295] Update Travis to macOS Sierra [skip appveyor] --- .travis.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index e4c69a2a09..2a46104677 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,6 @@ language: csharp -sudo: required +sudo: false dist: trusty -addons: - apt: - packages: - - gettext - - libcurl4-openssl-dev - - libicu-dev - - libssl-dev - - libunwind8 - - zlib1g env: global: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true @@ -18,6 +9,7 @@ mono: none os: - linux - osx +osx_image: xcode8.2 branches: only: - master From 5f86834fa7bf84e26149b93907ca80ee2406b2ce Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Tue, 21 Mar 2017 13:35:07 -0700 Subject: [PATCH 196/295] Converted samples and test projects to run on netcoreapp2.0 --- Session.sln | 18 +++++++++++++----- build/dependencies.props | 1 + samples/SessionSample/SessionSample.csproj | 4 ++-- .../Microsoft.AspNetCore.Session.Tests.csproj | 4 ++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Session.sln b/Session.sln index bcd5aa0227..4a3573960d 100644 --- a/Session.sln +++ b/Session.sln @@ -1,19 +1,26 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26127.0 +VisualStudioVersion = 15.0.26228.9 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A189F10C-3A9C-4F81-83D0-32E5FE50DAD8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Session", "src\Microsoft.AspNetCore.Session\Microsoft.AspNetCore.Session.csproj", "{71802736-F640-4733-9671-02D267EDD76A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Session", "src\Microsoft.AspNetCore.Session\Microsoft.AspNetCore.Session.csproj", "{71802736-F640-4733-9671-02D267EDD76A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Session.Tests", "test\Microsoft.AspNetCore.Session.Tests\Microsoft.AspNetCore.Session.Tests.csproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Session.Tests", "test\Microsoft.AspNetCore.Session.Tests\Microsoft.AspNetCore.Session.Tests.csproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SessionSample", "samples\SessionSample\SessionSample.csproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionSample", "samples\SessionSample\SessionSample.csproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{3B45F658-5BF1-4E07-BE9C-6F5110AC2277}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{4F21221F-2813-41B7-AAFC-E03FD52971CC}" + ProjectSection(SolutionItems) = preProject + build\common.props = build\common.props + build\dependencies.props = build\dependencies.props + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -41,5 +48,6 @@ Global {71802736-F640-4733-9671-02D267EDD76A} = {A189F10C-3A9C-4F81-83D0-32E5FE50DAD8} {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639} = {E9D63F97-6078-42AD-BFD3-F956BF921BB5} {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365} = {94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE} + {4F21221F-2813-41B7-AAFC-E03FD52971CC} = {3B45F658-5BF1-4E07-BE9C-6F5110AC2277} EndGlobalSection EndGlobal diff --git a/build/dependencies.props b/build/dependencies.props index 5a4c06ce33..12a50aa67f 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,6 +3,7 @@ 1.2.0-* 4.3.0 1.6.1 + 2.0.0-* 15.0.0 2.2.0 diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj index 959f560f93..ad357dfd20 100644 --- a/samples/SessionSample/SessionSample.csproj +++ b/samples/SessionSample/SessionSample.csproj @@ -1,9 +1,9 @@ - + - net451;netcoreapp1.1 + net451;netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index 8cd81cacbb..1f52456d80 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -3,8 +3,8 @@ - netcoreapp1.1;net452 - netcoreapp1.1 + netcoreapp2.0;net452 + netcoreapp2.0 From 8cc72b7871186356e8b14236d84416d625f16689 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 22 Mar 2017 18:08:26 -0700 Subject: [PATCH 197/295] Update to net46 --- .gitignore | 3 ++- samples/SessionSample/SessionSample.csproj | 2 +- .../Microsoft.AspNetCore.Session.csproj | 2 +- .../Microsoft.AspNetCore.Session.Tests.csproj | 4 +++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index f76d5c553d..8f09bd44ea 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,5 @@ nuget.exe project.lock.json .build/ .testPublish/ -launchSettings.json \ No newline at end of file +launchSettings.json +global.json diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj index ad357dfd20..4b12ee2e71 100644 --- a/samples/SessionSample/SessionSample.csproj +++ b/samples/SessionSample/SessionSample.csproj @@ -3,7 +3,7 @@ - net451;netcoreapp2.0 + net46;netcoreapp2.0 diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj index 3ec0f05b06..a759a4a613 100644 --- a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj +++ b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj @@ -4,7 +4,7 @@ ASP.NET Core session state middleware. - net451;netstandard1.3 + netstandard1.3 $(NoWarn);CS1591 true true diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index 1f52456d80..3ece7c4d87 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -3,8 +3,10 @@ - netcoreapp2.0;net452 + netcoreapp2.0;net46 netcoreapp2.0 + true + true From e0c373877955a9f600374c37f9f49c52d0e396c7 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 29 Mar 2017 11:30:37 -0700 Subject: [PATCH 198/295] Updating to 2.0.0 Internal.AspNetCore.Sdk --- build/common.props | 2 +- build/dependencies.props | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build/common.props b/build/common.props index 27a47a41e2..cb1fafc20f 100644 --- a/build/common.props +++ b/build/common.props @@ -13,7 +13,7 @@ - + diff --git a/build/dependencies.props b/build/dependencies.props index 12a50aa67f..8c81df7f34 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -2,9 +2,10 @@ 1.2.0-* 4.3.0 + 2.0.0-* 1.6.1 2.0.0-* 15.0.0 2.2.0 - + \ No newline at end of file From fe18a8a793c1c58c6885492ee3898f4fa01ebabf Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 3 Apr 2017 21:41:12 -0700 Subject: [PATCH 199/295] Updating versions to 2.0.0-preview1 --- build/dependencies.props | 2 +- version.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 8c81df7f34..1973fc186f 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,6 +1,6 @@ - 1.2.0-* + 2.0.0-* 4.3.0 2.0.0-* 1.6.1 diff --git a/version.props b/version.props index 17fd5ac36d..c7150e64f4 100644 --- a/version.props +++ b/version.props @@ -1,7 +1,7 @@ - 1.2.0 + 2.0.0 preview1 From db319f455c6543de9555e350d47001aa93943c89 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 25 Apr 2017 11:04:10 -0700 Subject: [PATCH 200/295] Use Bundled NETStandard.Library \ NETCoreApp versions instead of explicitly specifying one --- build/common.props | 2 +- build/dependencies.props | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/build/common.props b/build/common.props index cb1fafc20f..f5af49745b 100644 --- a/build/common.props +++ b/build/common.props @@ -17,7 +17,7 @@ - + diff --git a/build/dependencies.props b/build/dependencies.props index 1973fc186f..01387147a4 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,9 +3,7 @@ 2.0.0-* 4.3.0 2.0.0-* - 1.6.1 - 2.0.0-* 15.0.0 2.2.0 - \ No newline at end of file + From f9cb1c80e5c90a471c04cee0a1a1821a44b6b3d0 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 25 Apr 2017 22:05:37 -0700 Subject: [PATCH 201/295] Branching for 2.0.0-preview1 --- NuGet.config | 2 +- build.ps1 | 2 +- build.sh | 2 +- build/dependencies.props | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NuGet.config b/NuGet.config index 8e65695611..fa4304af9c 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + diff --git a/build.ps1 b/build.ps1 index 5bf0e2c113..225b1fe450 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0-preview1.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index b0bcadb579..702b25c636 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0-preview1.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi diff --git a/build/dependencies.props b/build/dependencies.props index 01387147a4..c7741b724b 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,6 +1,6 @@ - 2.0.0-* + 2.0.0-preview1-* 4.3.0 2.0.0-* 15.0.0 From dc24aa7abd8fb7e9e08c021b7096f297e4942dd2 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 26 Apr 2017 07:13:39 -0700 Subject: [PATCH 202/295] Updating package version to preview2 --- version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.props b/version.props index c7150e64f4..6af4f81de2 100644 --- a/version.props +++ b/version.props @@ -2,6 +2,6 @@ 2.0.0 - preview1 + preview2 From 0c7628437d5e0a538e3b5983a388a4c45cc0c491 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 1 May 2017 12:40:16 -0700 Subject: [PATCH 203/295] Use the bundled NETStandard.Library package in netstandard targeting libraries --- build/dependencies.props | 1 + 1 file changed, 1 insertion(+) diff --git a/build/dependencies.props b/build/dependencies.props index c7741b724b..3db1eba0a2 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,6 +3,7 @@ 2.0.0-preview1-* 4.3.0 2.0.0-* + $(BundledNETStandardPackageVersion) 15.0.0 2.2.0 From 9cd4bca6f5f367f815612cde7265c2c5d2e89521 Mon Sep 17 00:00:00 2001 From: John Luo Date: Fri, 5 May 2017 09:44:36 -0700 Subject: [PATCH 204/295] netcoreapp2.0 (#162) --- .gitignore | 1 + build/dependencies.props | 2 +- samples/SessionSample/SessionSample.csproj | 2 +- samples/SessionSample/Startup.cs | 6 +- .../Microsoft.AspNetCore.Session.csproj | 2 +- .../baseline.net45.json | 601 ------------------ .../Microsoft.AspNetCore.Session.Tests.csproj | 3 +- 7 files changed, 6 insertions(+), 611 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Session/baseline.net45.json diff --git a/.gitignore b/.gitignore index 8f09bd44ea..f332e76e0f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ nuget.exe *.*sdf *.ipch .vs/ +.vscode/ project.lock.json .build/ .testPublish/ diff --git a/build/dependencies.props b/build/dependencies.props index 3db1eba0a2..f66ecf394c 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -2,7 +2,7 @@ 2.0.0-preview1-* 4.3.0 - 2.0.0-* + 2.1.0-* $(BundledNETStandardPackageVersion) 15.0.0 2.2.0 diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj index 4b12ee2e71..2bd2df7c05 100644 --- a/samples/SessionSample/SessionSample.csproj +++ b/samples/SessionSample/SessionSample.csproj @@ -3,7 +3,7 @@ - net46;netcoreapp2.0 + netcoreapp2.0 diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs index 1d98147980..41fcb566c5 100644 --- a/samples/SessionSample/Startup.cs +++ b/samples/SessionSample/Startup.cs @@ -12,11 +12,6 @@ namespace SessionSample { public class Startup { - public Startup(ILoggerFactory loggerFactory) - { - loggerFactory.AddConsole(LogLevel.Debug); - } - public void ConfigureServices(IServiceCollection services) { // Adds a default in-memory implementation of IDistributedCache @@ -83,6 +78,7 @@ namespace SessionSample public static void Main(string[] args) { var host = new WebHostBuilder() + .ConfigureLogging(factory => factory.AddConsole()) .UseKestrel() .UseIISIntegration() .UseStartup() diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj index a759a4a613..4b877ca491 100644 --- a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj +++ b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj @@ -4,7 +4,7 @@ ASP.NET Core session state middleware. - netstandard1.3 + netcoreapp2.0 $(NoWarn);CS1591 true true diff --git a/src/Microsoft.AspNetCore.Session/baseline.net45.json b/src/Microsoft.AspNetCore.Session/baseline.net45.json deleted file mode 100644 index 4a03419d7d..0000000000 --- a/src/Microsoft.AspNetCore.Session/baseline.net45.json +++ /dev/null @@ -1,601 +0,0 @@ -{ - "AssemblyIdentity": "Microsoft.AspNetCore.Session, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", - "Types": [ - { - "Name": "Microsoft.Extensions.DependencyInjection.SessionServiceCollectionExtensions", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "AddSession", - "Parameters": [ - { - "Name": "services", - "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" - } - ], - "ReturnType": "Microsoft.Extensions.DependencyInjection.IServiceCollection", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "AddSession", - "Parameters": [ - { - "Name": "services", - "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" - }, - { - "Name": "configure", - "Type": "System.Action" - } - ], - "ReturnType": "Microsoft.Extensions.DependencyInjection.IServiceCollection", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.Builder.SessionMiddlewareExtensions", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "UseSession", - "Parameters": [ - { - "Name": "app", - "Type": "Microsoft.AspNetCore.Builder.IApplicationBuilder" - } - ], - "ReturnType": "Microsoft.AspNetCore.Builder.IApplicationBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "UseSession", - "Parameters": [ - { - "Name": "app", - "Type": "Microsoft.AspNetCore.Builder.IApplicationBuilder" - }, - { - "Name": "options", - "Type": "Microsoft.AspNetCore.Builder.SessionOptions" - } - ], - "ReturnType": "Microsoft.AspNetCore.Builder.IApplicationBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.Builder.SessionOptions", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_CookieName", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_CookieName", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_CookieDomain", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_CookieDomain", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_CookiePath", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_CookiePath", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_CookieHttpOnly", - "Parameters": [], - "ReturnType": "System.Boolean", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_CookieHttpOnly", - "Parameters": [ - { - "Name": "value", - "Type": "System.Boolean" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_IdleTimeout", - "Parameters": [], - "ReturnType": "System.TimeSpan", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_IdleTimeout", - "Parameters": [ - { - "Name": "value", - "Type": "System.TimeSpan" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.Session.DistributedSession", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.Http.ISession" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_IsAvailable", - "Parameters": [], - "ReturnType": "System.Boolean", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Id", - "Parameters": [], - "ReturnType": "System.String", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Keys", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IEnumerable", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TryGetValue", - "Parameters": [ - { - "Name": "key", - "Type": "System.String" - }, - { - "Name": "value", - "Type": "System.Byte[]", - "Direction": "Out" - } - ], - "ReturnType": "System.Boolean", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Set", - "Parameters": [ - { - "Name": "key", - "Type": "System.String" - }, - { - "Name": "value", - "Type": "System.Byte[]" - } - ], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Remove", - "Parameters": [ - { - "Name": "key", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Clear", - "Parameters": [], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "LoadAsync", - "Parameters": [], - "ReturnType": "System.Threading.Tasks.Task", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "CommitAsync", - "Parameters": [], - "ReturnType": "System.Threading.Tasks.Task", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.ISession", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "cache", - "Type": "Microsoft.Extensions.Caching.Distributed.IDistributedCache" - }, - { - "Name": "sessionKey", - "Type": "System.String" - }, - { - "Name": "idleTimeout", - "Type": "System.TimeSpan" - }, - { - "Name": "tryEstablishSession", - "Type": "System.Func" - }, - { - "Name": "loggerFactory", - "Type": "Microsoft.Extensions.Logging.ILoggerFactory" - }, - { - "Name": "isNewSessionKey", - "Type": "System.Boolean" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.Session.DistributedSessionStore", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.Session.ISessionStore" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Create", - "Parameters": [ - { - "Name": "sessionKey", - "Type": "System.String" - }, - { - "Name": "idleTimeout", - "Type": "System.TimeSpan" - }, - { - "Name": "tryEstablishSession", - "Type": "System.Func" - }, - { - "Name": "isNewSessionKey", - "Type": "System.Boolean" - } - ], - "ReturnType": "Microsoft.AspNetCore.Http.ISession", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Session.ISessionStore", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "cache", - "Type": "Microsoft.Extensions.Caching.Distributed.IDistributedCache" - }, - { - "Name": "loggerFactory", - "Type": "Microsoft.Extensions.Logging.ILoggerFactory" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.Session.ISessionStore", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "Create", - "Parameters": [ - { - "Name": "sessionKey", - "Type": "System.String" - }, - { - "Name": "idleTimeout", - "Type": "System.TimeSpan" - }, - { - "Name": "tryEstablishSession", - "Type": "System.Func" - }, - { - "Name": "isNewSessionKey", - "Type": "System.Boolean" - } - ], - "ReturnType": "Microsoft.AspNetCore.Http.ISession", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.Session.SessionDefaults", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Field", - "Name": "CookieName", - "Parameters": [], - "ReturnType": "System.String", - "Static": true, - "ReadOnly": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Field", - "Name": "CookiePath", - "Parameters": [], - "ReturnType": "System.String", - "Static": true, - "ReadOnly": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.Session.SessionFeature", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.Http.Features.ISessionFeature" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_Session", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.Http.ISession", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.Features.ISessionFeature", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_Session", - "Parameters": [ - { - "Name": "value", - "Type": "Microsoft.AspNetCore.Http.ISession" - } - ], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.Http.Features.ISessionFeature", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.Session.SessionMiddleware", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "Invoke", - "Parameters": [ - { - "Name": "context", - "Type": "Microsoft.AspNetCore.Http.HttpContext" - } - ], - "ReturnType": "System.Threading.Tasks.Task", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "next", - "Type": "Microsoft.AspNetCore.Http.RequestDelegate" - }, - { - "Name": "loggerFactory", - "Type": "Microsoft.Extensions.Logging.ILoggerFactory" - }, - { - "Name": "dataProtectionProvider", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider" - }, - { - "Name": "sessionStore", - "Type": "Microsoft.AspNetCore.Session.ISessionStore" - }, - { - "Name": "options", - "Type": "Microsoft.Extensions.Options.IOptions" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - } - ], - "SourceFilters": [] -} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index 3ece7c4d87..626533e4da 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -3,8 +3,7 @@ - netcoreapp2.0;net46 - netcoreapp2.0 + netcoreapp2.0 true true From 243ee6924c2b48c040694b3d5698425b82dfab45 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Wed, 10 May 2017 11:48:11 -0700 Subject: [PATCH 205/295] Remove unnecessary package references (#164) --- build/dependencies.props | 1 - 1 file changed, 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index 09cfb1fe04..a894b64255 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,7 +1,6 @@ 2.0.0-* - 4.3.0 2.1.0-* $(BundledNETStandardPackageVersion) 15.0.0 From c3ca9cf3342eb66d966ee681c193bfd22b6b701a Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 12 May 2017 14:03:59 -0700 Subject: [PATCH 206/295] Upgrade test framework versions --- build/dependencies.props | 4 ++-- test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index a894b64255..2a28acf6a6 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,7 +3,7 @@ 2.0.0-* 2.1.0-* $(BundledNETStandardPackageVersion) - 15.0.0 - 2.2.0 + 15.3.0-* + 2.3.0-beta2-* diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 06aff0a31d..cc37bcd49c 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -568,7 +568,7 @@ namespace Microsoft.AspNetCore.Session { byte[] value; Assert.False(context.Session.TryGetValue("key", out value)); - Assert.Equal(null, value); + Assert.Null(value); Assert.Equal(string.Empty, context.Session.Id); Assert.False(context.Session.Keys.Any()); return Task.FromResult(0); @@ -751,4 +751,4 @@ namespace Microsoft.AspNetCore.Session } } } -} \ No newline at end of file +} From 9687be6c7112b1d2617ae9099f1542b9c7e15afc Mon Sep 17 00:00:00 2001 From: John Luo Date: Mon, 22 May 2017 15:39:14 -0700 Subject: [PATCH 207/295] React to IDistributedCache interface change --- test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index cc37bcd49c..49d45457e8 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -728,9 +728,9 @@ namespace Microsoft.AspNetCore.Session } return _cache.Get(key); } - public Task GetAsync(string key) => _cache.GetAsync(key); + public Task GetAsync(string key, CancellationToken token = default(CancellationToken)) => _cache.GetAsync(key); public void Refresh(string key) => _cache.Refresh(key); - public Task RefreshAsync(string key) + public Task RefreshAsync(string key, CancellationToken token = default(CancellationToken)) { if (DisableRefreshAsync) { @@ -739,9 +739,9 @@ namespace Microsoft.AspNetCore.Session return _cache.RefreshAsync(key); } public void Remove(string key) => _cache.Remove(key); - public Task RemoveAsync(string key) => _cache.RemoveAsync(key); + public Task RemoveAsync(string key, CancellationToken token = default(CancellationToken)) => _cache.RemoveAsync(key); public void Set(string key, byte[] value, DistributedCacheEntryOptions options) => _cache.Set(key, value, options); - public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options) + public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default(CancellationToken)) { if (DisableSetAsync) { From 4ab7a19dc23d504deeff045174a25e7e3e84595e Mon Sep 17 00:00:00 2001 From: Cesar Blum Silveira Date: Tue, 23 May 2017 10:00:29 -0700 Subject: [PATCH 208/295] Target netstandard2.0. --- build/common.props | 4 ++-- build/dependencies.props | 2 +- samples/SessionSample/SessionSample.csproj | 6 +++++- .../Microsoft.AspNetCore.Session.csproj | 2 +- .../Microsoft.AspNetCore.Session.Tests.csproj | 3 ++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/build/common.props b/build/common.props index f5af49745b..146f2f99f6 100644 --- a/build/common.props +++ b/build/common.props @@ -16,8 +16,8 @@ - - + + diff --git a/build/dependencies.props b/build/dependencies.props index 2a28acf6a6..858f8e55f4 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -2,7 +2,7 @@ 2.0.0-* 2.1.0-* - $(BundledNETStandardPackageVersion) + 2.0.0-* 15.3.0-* 2.3.0-beta2-* diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj index 2bd2df7c05..57ec5afbb4 100644 --- a/samples/SessionSample/SessionSample.csproj +++ b/samples/SessionSample/SessionSample.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0 + netcoreapp2.0;net461 @@ -19,4 +19,8 @@ + + + + diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj index 4b877ca491..1f86c5d1d8 100644 --- a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj +++ b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj @@ -4,7 +4,7 @@ ASP.NET Core session state middleware. - netcoreapp2.0 + netstandard2.0 $(NoWarn);CS1591 true true diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index 626533e4da..026ee2707d 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -3,7 +3,8 @@ - netcoreapp2.0 + netcoreapp2.0;net461 + netcoreapp2.0 true true From e48eef8347b75de07e395d7f06a649a5f001654d Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 23 May 2017 10:05:31 -0700 Subject: [PATCH 209/295] Add privateassets=all to NS.Library.NETFramework reference --- build/common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common.props b/build/common.props index 146f2f99f6..057fb3e431 100644 --- a/build/common.props +++ b/build/common.props @@ -17,7 +17,7 @@ - + From 87d063b2b5d5d4fcdef3ca3159c943fe5dc0637e Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Fri, 26 May 2017 12:44:55 -0700 Subject: [PATCH 210/295] Updated to use the latest shared runtime --- build/dependencies.props | 1 + 1 file changed, 1 insertion(+) diff --git a/build/dependencies.props b/build/dependencies.props index 858f8e55f4..4b6d757d0e 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,6 +3,7 @@ 2.0.0-* 2.1.0-* 2.0.0-* + 2.0.0-* 15.3.0-* 2.3.0-beta2-* From b8997751851a176bc08f9161985c26802ebffca4 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 30 May 2017 20:52:15 -0700 Subject: [PATCH 211/295] Add configurable SameSite cookie option --- src/Microsoft.AspNetCore.Session/SessionMiddleware.cs | 1 + src/Microsoft.AspNetCore.Session/SessionOptions.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs index a9160e4a67..8dda333a7d 100644 --- a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs @@ -153,6 +153,7 @@ namespace Microsoft.AspNetCore.Session var cookieOptions = new CookieOptions { Domain = _options.CookieDomain, + SameSite = _options.SameSiteMode, HttpOnly = _options.CookieHttpOnly, Path = _options.CookiePath ?? SessionDefaults.CookiePath, }; diff --git a/src/Microsoft.AspNetCore.Session/SessionOptions.cs b/src/Microsoft.AspNetCore.Session/SessionOptions.cs index a025b60932..b4f0a7aa2a 100644 --- a/src/Microsoft.AspNetCore.Session/SessionOptions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionOptions.cs @@ -36,6 +36,12 @@ namespace Microsoft.AspNetCore.Builder /// public bool CookieHttpOnly { get; set; } = true; + /// + /// Determines if the browser should allow the cookie to be attached to same-site or cross-site requests. The + /// default is Lax, which means the cookie is allowed to be attached to same-site and safe cross-site requests. + /// + public SameSiteMode SameSiteMode { get; set; } = SameSiteMode.Lax; + /// /// Determines if the cookie should only be transmitted on HTTPS requests. /// From a6036808714e74c4c00f487735dbf0d931d0000a Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 31 May 2017 19:37:26 -0700 Subject: [PATCH 212/295] Branching for rel/2.0.0-preview2 --- NuGet.config | 7 ++++--- build/dependencies.props | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/NuGet.config b/NuGet.config index 8e65695611..c4bc056c4d 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,8 +1,9 @@ - + - + + - + \ No newline at end of file diff --git a/build/dependencies.props b/build/dependencies.props index 4b6d757d0e..f81fa63cb0 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,6 +1,6 @@ - 2.0.0-* + 2.0.0-preview2-* 2.1.0-* 2.0.0-* 2.0.0-* From c8486de72a5cb183926ef8a58be6ac4f8d590397 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 31 May 2017 19:53:35 -0700 Subject: [PATCH 213/295] Updating build scripts to point to 2.0.0-preview2 KoreBuild --- build.ps1 | 2 +- build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 5bf0e2c113..3a2476b2b4 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0-preview2.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index b0bcadb579..a40bdb87b1 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0-preview2.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi From dac143fb95d126dcd34ff5e000c54221519981cc Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 1 Jun 2017 10:47:50 -0700 Subject: [PATCH 214/295] Updating versions to preview3 --- NuGet.config | 3 ++- version.props | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NuGet.config b/NuGet.config index 8e65695611..4e8a1f6de1 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,6 +1,7 @@ - + + diff --git a/version.props b/version.props index 6af4f81de2..193a5999d8 100644 --- a/version.props +++ b/version.props @@ -2,6 +2,6 @@ 2.0.0 - preview2 + preview3 From c8826a5d4d1bd4080191074c25d03e08bab64daf Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 26 Jun 2017 09:42:26 -0700 Subject: [PATCH 215/295] Adding libunwind8 to .travis.yml [skip appveyor] --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2a46104677..b10be14215 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,10 @@ os: - linux - osx osx_image: xcode8.2 +addons: + apt: + packages: + - libunwind8 branches: only: - master From 2b68dc95bf5f746b4b7e92a4fb6ad7bf343bb497 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 29 Jun 2017 08:51:48 -0700 Subject: [PATCH 216/295] Add NETStandardImplicitPackageVersion --- build/dependencies.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index 4b6d757d0e..88671e1345 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,7 +1,8 @@ - + 2.0.0-* 2.1.0-* + 2.0.0-* 2.0.0-* 2.0.0-* 15.3.0-* From dece939aabc94df3ec364e43956e332af032cdf7 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 29 Jun 2017 17:38:44 -0700 Subject: [PATCH 217/295] Add CookieBuilder property to SessionOptions and obsolete duplicated properties --- Session.sln | 15 +- .../SessionMiddleware.cs | 20 +-- .../SessionOptions.cs | 136 +++++++++++++----- .../SessionTests.cs | 7 +- 4 files changed, 126 insertions(+), 52 deletions(-) diff --git a/Session.sln b/Session.sln index 4a3573960d..9399810d4e 100644 --- a/Session.sln +++ b/Session.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26228.9 +VisualStudioVersion = 15.0.26621.2 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" EndProject @@ -15,6 +15,16 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionSample", "samples\SessionSample\SessionSample.csproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{3B45F658-5BF1-4E07-BE9C-6F5110AC2277}" + ProjectSection(SolutionItems) = preProject + .gitattributes = .gitattributes + .gitignore = .gitignore + .travis.yml = .travis.yml + appveyor.yml = appveyor.yml + NuGet.config = NuGet.config + NuGetPackageVerifier.json = NuGetPackageVerifier.json + README.md = README.md + version.props = version.props + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{4F21221F-2813-41B7-AAFC-E03FD52971CC}" ProjectSection(SolutionItems) = preProject @@ -50,4 +60,7 @@ Global {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365} = {94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE} {4F21221F-2813-41B7-AAFC-E03FD52971CC} = {3B45F658-5BF1-4E07-BE9C-6F5110AC2277} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6AE224B9-B604-4E47-9617-9D114DAE9BE5} + EndGlobalSection EndGlobal diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs index 8dda333a7d..ac234d8a68 100644 --- a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs @@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Session { var isNewSessionKey = false; Func tryEstablishSession = ReturnTrue; - var cookieValue = context.Request.Cookies[_options.CookieName]; + var cookieValue = context.Request.Cookies[_options.Cookie.Name]; var sessionKey = CookieProtection.Unprotect(_dataProtector, cookieValue, _logger); if (string.IsNullOrWhiteSpace(sessionKey) || sessionKey.Length != SessionKeyLength) { @@ -150,23 +150,9 @@ namespace Microsoft.AspNetCore.Session private void SetCookie() { - var cookieOptions = new CookieOptions - { - Domain = _options.CookieDomain, - SameSite = _options.SameSiteMode, - HttpOnly = _options.CookieHttpOnly, - Path = _options.CookiePath ?? SessionDefaults.CookiePath, - }; - if (_options.CookieSecure == CookieSecurePolicy.SameAsRequest) - { - cookieOptions.Secure = _context.Request.IsHttps; - } - else - { - cookieOptions.Secure = _options.CookieSecure == CookieSecurePolicy.Always; - } + var cookieOptions = _options.Cookie.Build(_context); - _context.Response.Cookies.Append(_options.CookieName, _cookieValue, cookieOptions); + _context.Response.Cookies.Append(_options.Cookie.Name, _cookieValue, cookieOptions); _context.Response.Headers["Cache-Control"] = "no-cache"; _context.Response.Headers["Pragma"] = "no-cache"; diff --git a/src/Microsoft.AspNetCore.Session/SessionOptions.cs b/src/Microsoft.AspNetCore.Session/SessionOptions.cs index b4f0a7aa2a..b280bec54d 100644 --- a/src/Microsoft.AspNetCore.Session/SessionOptions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionOptions.cs @@ -12,45 +12,117 @@ namespace Microsoft.AspNetCore.Builder /// public class SessionOptions { - /// - /// Determines the cookie name used to persist the session ID. - /// Defaults to . - /// - public string CookieName { get; set; } = SessionDefaults.CookieName; + private CookieBuilder _cookieBuilder = new SessionCookieBuilder(); /// - /// Determines the domain used to create the cookie. Is not provided by default. + /// Determines the settings used to create the cookie. + /// + /// defaults to . + /// defaults to . + /// defaults to . + /// defaults to true + /// /// - public string CookieDomain { get; set; } - - /// - /// Determines the path used to create the cookie. - /// Defaults to . - /// - public string CookiePath { get; set; } = SessionDefaults.CookiePath; - - /// - /// Determines if the browser should allow the cookie to be accessed by client-side JavaScript. The - /// default is true, which means the cookie will only be passed to HTTP requests and is not made available - /// to script on the page. - /// - public bool CookieHttpOnly { get; set; } = true; - - /// - /// Determines if the browser should allow the cookie to be attached to same-site or cross-site requests. The - /// default is Lax, which means the cookie is allowed to be attached to same-site and safe cross-site requests. - /// - public SameSiteMode SameSiteMode { get; set; } = SameSiteMode.Lax; - - /// - /// Determines if the cookie should only be transmitted on HTTPS requests. - /// - public CookieSecurePolicy CookieSecure { get; set; } = CookieSecurePolicy.None; + public CookieBuilder Cookie + { + get => _cookieBuilder; + set => _cookieBuilder = value ?? throw new ArgumentNullException(nameof(value)); + } /// /// The IdleTimeout indicates how long the session can be idle before its contents are abandoned. Each session access /// resets the timeout. Note this only applies to the content of the session, not the cookie. /// public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromMinutes(20); + + #region Obsolete API + /// + /// + /// This property is obsolete and will be removed in a future version. The recommended alternative is on . + /// + /// + /// Determines the cookie name used to persist the session ID. + /// + /// + [Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.Name) + ".")] + public string CookieName { get => Cookie.Name; set => Cookie.Name = value; } + + /// + /// + /// This property is obsolete and will be removed in a future version. The recommended alternative is on . + /// + /// + /// Determines the domain used to create the cookie. Is not provided by default. + /// + /// + [Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.Domain) + ".")] + public string CookieDomain { get => Cookie.Domain; set => Cookie.Domain = value; } + + /// + /// + /// This property is obsolete and will be removed in a future version. The recommended alternative is on . + /// + /// + /// Determines the path used to create the cookie. + /// Defaults to . + /// + /// + [Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.Path) + ".")] + public string CookiePath { get => Cookie.Path; set => Cookie.Path = value; } + + /// + /// + /// This property is obsolete and will be removed in a future version. The recommended alternative is on . + /// + /// + /// Determines if the browser should allow the cookie to be accessed by client-side JavaScript. The + /// default is true, which means the cookie will only be passed to HTTP requests and is not made available + /// to script on the page. + /// + /// + [Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.HttpOnly) + ".")] + public bool CookieHttpOnly { get => Cookie.HttpOnly; set => Cookie.HttpOnly = value; } + + /// + /// + /// This property is obsolete and will be removed in a future version. The recommended alternative is on . + /// + /// + /// Determines if the browser should allow the cookie to be attached to same-site or cross-site requests. The + /// default is Lax, which means the cookie is allowed to be attached to same-site and safe cross-site requests. + /// + /// + [Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.SameSite) + ".")] + public SameSiteMode SameSiteMode { get => Cookie.SameSite; set => Cookie.SameSite = value; } + + /// + /// + /// This property is obsolete and will be removed in a future version. The recommended alternative is on . + /// + /// + /// Determines if the cookie should only be transmitted on HTTPS requests. + /// + /// + [Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.SecurePolicy) + ".")] + public CookieSecurePolicy CookieSecure { get => Cookie.SecurePolicy; set => Cookie.SecurePolicy = value; } + #endregion + + private class SessionCookieBuilder : CookieBuilder + { + public SessionCookieBuilder() + { + Name = SessionDefaults.CookieName; + Path = SessionDefaults.CookiePath; + SecurePolicy = CookieSecurePolicy.None; + SameSite = SameSiteMode.Lax; + HttpOnly = true; + } + + public override TimeSpan? Expiration + { + get => null; + set => throw new InvalidOperationException(nameof(Expiration) + " cannot be set for the cookie defined by " + nameof(SessionOptions)); + } + } } -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 49d45457e8..8f34def5c0 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -105,8 +105,11 @@ namespace Microsoft.AspNetCore.Session { app.UseSession(new SessionOptions { - CookieName = "TestCookie", - CookieSecure = cookieSecurePolicy + Cookie = + { + Name = "TestCookie", + SecurePolicy = cookieSecurePolicy + } }); app.Run(context => { From a449fd4719b51e73592f3983fdbb8eb25ea2018e Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 3 Jul 2017 14:08:09 -0700 Subject: [PATCH 218/295] Update LICENSE.txt text --- LICENSE.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 0bdc1962b6..7b2956ecee 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,10 +1,12 @@ -Copyright (c) .NET Foundation. All rights reserved. +Copyright (c) .NET Foundation and Contributors + +All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use -these files except in compliance with the License. You may obtain a copy of the +this file except in compliance with the License. You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR From 6f4f34a0bf3bd5506a07bf7cde0e3a1d31baa6b0 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 5 Jul 2017 09:40:55 -0700 Subject: [PATCH 219/295] Remove SessionOptions.SameSideMode (#176) --- src/Microsoft.AspNetCore.Session/SessionOptions.cs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/SessionOptions.cs b/src/Microsoft.AspNetCore.Session/SessionOptions.cs index b280bec54d..569dd5c18e 100644 --- a/src/Microsoft.AspNetCore.Session/SessionOptions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionOptions.cs @@ -83,18 +83,6 @@ namespace Microsoft.AspNetCore.Builder [Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.HttpOnly) + ".")] public bool CookieHttpOnly { get => Cookie.HttpOnly; set => Cookie.HttpOnly = value; } - /// - /// - /// This property is obsolete and will be removed in a future version. The recommended alternative is on . - /// - /// - /// Determines if the browser should allow the cookie to be attached to same-site or cross-site requests. The - /// default is Lax, which means the cookie is allowed to be attached to same-site and safe cross-site requests. - /// - /// - [Obsolete("This property is obsolete and will be removed in a future version. The recommended alternative is " + nameof(Cookie) + "." + nameof(CookieBuilder.SameSite) + ".")] - public SameSiteMode SameSiteMode { get => Cookie.SameSite; set => Cookie.SameSite = value; } - /// /// /// This property is obsolete and will be removed in a future version. The recommended alternative is on . From 1a1e4c309f6eb57afca265f49062949b34482af9 Mon Sep 17 00:00:00 2001 From: Chris R Date: Wed, 28 Jun 2017 15:44:43 -0700 Subject: [PATCH 220/295] #167 Add cancellation tokens and defualt timeouts for Load/CommitAsync. --- .../DistributedSession.cs | 82 +++++++++++-------- .../DistributedSessionStore.cs | 4 +- .../ISessionStore.cs | 2 +- .../SessionMiddleware.cs | 5 +- .../SessionOptions.cs | 7 ++ .../breakingchanges.netcore.json | 32 ++++++++ 6 files changed, 93 insertions(+), 39 deletions(-) create mode 100644 src/Microsoft.AspNetCore.Session/breakingchanges.netcore.json diff --git a/src/Microsoft.AspNetCore.Session/DistributedSession.cs b/src/Microsoft.AspNetCore.Session/DistributedSession.cs index 6025423ad1..1f9fa7fa87 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSession.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSession.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Cryptography; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Caching.Distributed; @@ -24,6 +25,7 @@ namespace Microsoft.AspNetCore.Session private readonly IDistributedCache _cache; private readonly string _sessionKey; private readonly TimeSpan _idleTimeout; + private readonly TimeSpan _ioTimeout; private readonly Func _tryEstablishSession; private readonly ILogger _logger; private IDictionary _store; @@ -38,6 +40,7 @@ namespace Microsoft.AspNetCore.Session IDistributedCache cache, string sessionKey, TimeSpan idleTimeout, + TimeSpan ioTimeout, Func tryEstablishSession, ILoggerFactory loggerFactory, bool isNewSessionKey) @@ -65,6 +68,7 @@ namespace Microsoft.AspNetCore.Session _cache = cache; _sessionKey = sessionKey; _idleTimeout = idleTimeout; + _ioTimeout = ioTimeout; _tryEstablishSession = tryEstablishSession; _store = new Dictionary(); _logger = loggerFactory.CreateLogger(); @@ -194,58 +198,68 @@ namespace Microsoft.AspNetCore.Session } // This will throw if called directly and a failure occurs. The user is expected to handle the failures. - public async Task LoadAsync() + public async Task LoadAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); if (!_loaded) { - var data = await _cache.GetAsync(_sessionKey); - if (data != null) + using (var timeout = new CancellationTokenSource(_ioTimeout)) { - Deserialize(new MemoryStream(data)); - } - else if (!_isNewSessionKey) - { - _logger.AccessingExpiredSession(_sessionKey); + var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, cancellationToken); + var data = await _cache.GetAsync(_sessionKey, cts.Token); + if (data != null) + { + Deserialize(new MemoryStream(data)); + } + else if (!_isNewSessionKey) + { + _logger.AccessingExpiredSession(_sessionKey); + } } _isAvailable = true; _loaded = true; } } - public async Task CommitAsync() + public async Task CommitAsync(CancellationToken cancellationToken = default(CancellationToken)) { - if (_isModified) + cancellationToken.ThrowIfCancellationRequested(); + using (var timeout = new CancellationTokenSource(_ioTimeout)) { - if (_logger.IsEnabled(LogLevel.Information)) + var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, cancellationToken); + if (_isModified) { - try + if (_logger.IsEnabled(LogLevel.Information)) { - var data = await _cache.GetAsync(_sessionKey); - if (data == null) + try { - _logger.SessionStarted(_sessionKey, Id); + var data = await _cache.GetAsync(_sessionKey, cts.Token); + if (data == null) + { + _logger.SessionStarted(_sessionKey, Id); + } + } + catch (Exception exception) + { + _logger.SessionCacheReadException(_sessionKey, exception); } } - catch (Exception exception) - { - _logger.SessionCacheReadException(_sessionKey, exception); - } + + var stream = new MemoryStream(); + Serialize(stream); + + await _cache.SetAsync( + _sessionKey, + stream.ToArray(), + new DistributedCacheEntryOptions().SetSlidingExpiration(_idleTimeout), + cts.Token); + _isModified = false; + _logger.SessionStored(_sessionKey, Id, _store.Count); + } + else + { + await _cache.RefreshAsync(_sessionKey, cts.Token); } - - var stream = new MemoryStream(); - Serialize(stream); - - await _cache.SetAsync( - _sessionKey, - stream.ToArray(), - new DistributedCacheEntryOptions().SetSlidingExpiration(_idleTimeout)); - - _isModified = false; - _logger.SessionStored(_sessionKey, Id, _store.Count); - } - else - { - await _cache.RefreshAsync(_sessionKey); } } diff --git a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs index 180599ba18..49050af588 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs @@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Session _loggerFactory = loggerFactory; } - public ISession Create(string sessionKey, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey) + public ISession Create(string sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func tryEstablishSession, bool isNewSessionKey) { if (string.IsNullOrEmpty(sessionKey)) { @@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Session throw new ArgumentNullException(nameof(tryEstablishSession)); } - return new DistributedSession(_cache, sessionKey, idleTimeout, tryEstablishSession, _loggerFactory, isNewSessionKey); + return new DistributedSession(_cache, sessionKey, idleTimeout, ioTimeout, tryEstablishSession, _loggerFactory, isNewSessionKey); } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/ISessionStore.cs b/src/Microsoft.AspNetCore.Session/ISessionStore.cs index 8831a60f5a..247ba2307f 100644 --- a/src/Microsoft.AspNetCore.Session/ISessionStore.cs +++ b/src/Microsoft.AspNetCore.Session/ISessionStore.cs @@ -8,6 +8,6 @@ namespace Microsoft.AspNetCore.Session { public interface ISessionStore { - ISession Create(string sessionKey, TimeSpan idleTimeout, Func tryEstablishSession, bool isNewSessionKey); + ISession Create(string sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func tryEstablishSession, bool isNewSessionKey); } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs index ac234d8a68..2dbc0531c9 100644 --- a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs @@ -3,6 +3,7 @@ using System; using System.Security.Cryptography; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; @@ -98,7 +99,7 @@ namespace Microsoft.AspNetCore.Session } var feature = new SessionFeature(); - feature.Session = _sessionStore.Create(sessionKey, _options.IdleTimeout, tryEstablishSession, isNewSessionKey); + feature.Session = _sessionStore.Create(sessionKey, _options.IdleTimeout, _options.IOTimeout, tryEstablishSession, isNewSessionKey); context.Features.Set(feature); try @@ -113,7 +114,7 @@ namespace Microsoft.AspNetCore.Session { try { - await feature.Session.CommitAsync(); + await feature.Session.CommitAsync(context.RequestAborted); } catch (Exception ex) { diff --git a/src/Microsoft.AspNetCore.Session/SessionOptions.cs b/src/Microsoft.AspNetCore.Session/SessionOptions.cs index 569dd5c18e..9c9856f481 100644 --- a/src/Microsoft.AspNetCore.Session/SessionOptions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionOptions.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Threading; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Session; @@ -35,6 +36,12 @@ namespace Microsoft.AspNetCore.Builder /// public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromMinutes(20); + /// + /// The maximim amount of time allowed to load a session from the store or to commit it back to the store. + /// Note this may only apply to asynchronous operations. This timeout can be disabled using . + /// + public TimeSpan IOTimeout { get; set; } = TimeSpan.FromMinutes(1); + #region Obsolete API /// /// diff --git a/src/Microsoft.AspNetCore.Session/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Session/breakingchanges.netcore.json new file mode 100644 index 0000000000..3b5489de5a --- /dev/null +++ b/src/Microsoft.AspNetCore.Session/breakingchanges.netcore.json @@ -0,0 +1,32 @@ +[ + { + "TypeId": "public interface Microsoft.AspNetCore.Session.ISessionStore", + "MemberId": "Microsoft.AspNetCore.Http.ISession Create(System.String sessionKey, System.TimeSpan idleTimeout, System.Func tryEstablishSession, System.Boolean isNewSessionKey)", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Session.DistributedSession : Microsoft.AspNetCore.Http.ISession", + "MemberId": "public .ctor(Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, System.String sessionKey, System.TimeSpan idleTimeout, System.Func tryEstablishSession, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Boolean isNewSessionKey)", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Session.DistributedSession : Microsoft.AspNetCore.Http.ISession", + "MemberId": "public System.Threading.Tasks.Task CommitAsync()", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Session.DistributedSession : Microsoft.AspNetCore.Http.ISession", + "MemberId": "public System.Threading.Tasks.Task LoadAsync()", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Session.DistributedSessionStore : Microsoft.AspNetCore.Session.ISessionStore", + "MemberId": "public Microsoft.AspNetCore.Http.ISession Create(System.String sessionKey, System.TimeSpan idleTimeout, System.Func tryEstablishSession, System.Boolean isNewSessionKey)", + "Kind": "Removal" + }, + { + "TypeId": "public interface Microsoft.AspNetCore.Session.ISessionStore", + "MemberId": "Microsoft.AspNetCore.Http.ISession Create(System.String sessionKey, System.TimeSpan idleTimeout, System.TimeSpan ioTimeout, System.Func tryEstablishSession, System.Boolean isNewSessionKey)", + "Kind": "Addition" + } +] \ No newline at end of file From eb68e620df87fb3934d7de1d7522a0a9432bdc13 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 6 Jul 2017 10:39:25 -0700 Subject: [PATCH 221/295] React to aspnet/BuildTools#293 [ci skip] --- build/dependencies.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index 88671e1345..2a9564357e 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,7 +1,7 @@  2.0.0-* - 2.1.0-* + 2.0.1-* 2.0.0-* 2.0.0-* 2.0.0-* From 6b1b7a5bfcb127f43875ff6cb8c234a176a8a97d Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Thu, 6 Jul 2017 12:28:12 -0700 Subject: [PATCH 222/295] Set "TreatWarningsAsErrors" before NuGet restore * Ensures our build stays clean of NuGet warnings --- build/common.props | 1 + 1 file changed, 1 insertion(+) diff --git a/build/common.props b/build/common.props index 057fb3e431..56a313e0db 100644 --- a/build/common.props +++ b/build/common.props @@ -10,6 +10,7 @@ true true $(VersionSuffix)-$(BuildNumber) + true From 58896f94056d0f7d2174c7d88d2afd1d1ae19bd8 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 6 Jul 2017 15:08:54 -0700 Subject: [PATCH 223/295] Update version suffix for 2.0.0 RTM release --- version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.props b/version.props index 193a5999d8..eba6b16756 100644 --- a/version.props +++ b/version.props @@ -2,6 +2,6 @@ 2.0.0 - preview3 + rtm From 54c22b5dc551f7c6db29a02d3101b653a3f231ec Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Thu, 6 Jul 2017 15:39:00 -0700 Subject: [PATCH 224/295] Remove NETStandard.Library.NETFramework --- build/common.props | 4 ---- samples/SessionSample/SessionSample.csproj | 4 ---- 2 files changed, 8 deletions(-) diff --git a/build/common.props b/build/common.props index 56a313e0db..df05cb23bd 100644 --- a/build/common.props +++ b/build/common.props @@ -17,8 +17,4 @@ - - - - diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj index 57ec5afbb4..adb1c8a3f5 100644 --- a/samples/SessionSample/SessionSample.csproj +++ b/samples/SessionSample/SessionSample.csproj @@ -19,8 +19,4 @@ - - - - From a19694e28744fbe31cfe84a23d0c03e0ada19266 Mon Sep 17 00:00:00 2001 From: John Luo Date: Fri, 7 Jul 2017 20:39:51 -0700 Subject: [PATCH 225/295] React to caching API updates --- test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 8f34def5c0..5f28c79b08 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -18,6 +18,7 @@ using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Testing; +using Microsoft.Extensions.Options; using Microsoft.Net.Http.Headers; using Xunit; @@ -720,7 +721,7 @@ namespace Microsoft.AspNetCore.Session public UnreliableCache(IMemoryCache memoryCache) { - _cache = new MemoryDistributedCache(memoryCache); + _cache = new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions())); } public byte[] Get(string key) From d084699cd852770544006e737b014ea48eb69ec9 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 10 Jul 2017 11:46:23 -0700 Subject: [PATCH 226/295] Branching for 2.0.0 rtm --- NuGet.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index 4e8a1f6de1..37f0d27ea0 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,7 +2,7 @@ - + From 7e25d2bd98e891ed01eebd29a66dfdde5ba1486e Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 10 Jul 2017 11:58:01 -0700 Subject: [PATCH 227/295] Updating KoreBuild branch --- build.ps1 | 2 +- build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 5bf0e2c113..1785334385 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index b0bcadb579..5e27ed8efb 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi From afbe673b895c922a2633534f750466ff3d70dbb5 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 7 Jul 2017 14:58:12 -0700 Subject: [PATCH 228/295] Skip first time experience on Appveyor --- appveyor.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1041615c68..31efd8196f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -init: +init: - git config --global core.autocrlf true branches: only: @@ -9,6 +9,10 @@ branches: build_script: - ps: .\build.ps1 clone_depth: 1 +environment: + global: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: 1 test: off deploy: off os: Visual Studio 2017 From 74d2d9ae338dc3710ea5102b74b2475800766fe7 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 21 Jul 2017 13:03:01 -0700 Subject: [PATCH 229/295] 2.0.0-rtm to 2.1.0-preview1 --- version.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.props b/version.props index eba6b16756..1ea46af42a 100644 --- a/version.props +++ b/version.props @@ -1,7 +1,7 @@ - 2.0.0 - rtm + 2.1.0 + preview1 From 7371b19bc95769bd9d6722becdcaaddd695eb829 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Mon, 24 Jul 2017 17:58:58 -0700 Subject: [PATCH 230/295] Set AspNetCoreVersion --- build/dependencies.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 2a9564357e..e4e708d655 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,6 +1,6 @@ - + - 2.0.0-* + 2.1.0-* 2.0.1-* 2.0.0-* 2.0.0-* From a9766ece0a53a5b461db3d5d4a3f885180e0106d Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 25 Jul 2017 15:14:59 -0700 Subject: [PATCH 231/295] Updating to InternalAspNetCoreSdkVersion 2.1.1-* --- build/dependencies.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index e4e708d655..7a9758238c 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,7 +1,7 @@ 2.1.0-* - 2.0.1-* + 2.1.1-* 2.0.0-* 2.0.0-* 2.0.0-* From bae460620cee4f22c6557c718429f234b3f697d5 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 25 Jul 2017 16:34:58 -0700 Subject: [PATCH 232/295] Update bootstrappers to use the compiled version of KoreBuild [ci skip] --- .gitattributes | 4 +- .gitignore | 1 + Session.sln | 2 +- build.cmd | 2 +- build.ps1 | 218 +++++++++++++++++++++++++--------- build.sh | 224 +++++++++++++++++++++++++++++------ build/common.props | 2 +- version.props => version.xml | 3 +- 8 files changed, 359 insertions(+), 97 deletions(-) rename version.props => version.xml (55%) diff --git a/.gitattributes b/.gitattributes index 1e333226db..d0a46d6049 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,7 +13,7 @@ *.png binary *.gif binary -*.cs text=auto diff=csharp +*.cs text=auto diff=csharp *.vb text=auto *.resx text=auto *.c text=auto @@ -48,4 +48,4 @@ *.fsproj text=auto *.dbproj text=auto *.sln text=auto eol=crlf -*.sh eod=lf \ No newline at end of file +*.sh eol=lf diff --git a/.gitignore b/.gitignore index f332e76e0f..a266b414e8 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ project.lock.json .testPublish/ launchSettings.json global.json +korebuild-lock.txt diff --git a/Session.sln b/Session.sln index 9399810d4e..1ea569a371 100644 --- a/Session.sln +++ b/Session.sln @@ -23,7 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt NuGet.config = NuGet.config NuGetPackageVerifier.json = NuGetPackageVerifier.json README.md = README.md - version.props = version.props + version.xml = version.xml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{4F21221F-2813-41B7-AAFC-E03FD52971CC}" diff --git a/build.cmd b/build.cmd index 7d4894cb4a..b6c8d24864 100644 --- a/build.cmd +++ b/build.cmd @@ -1,2 +1,2 @@ @ECHO OFF -PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" \ No newline at end of file +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" diff --git a/build.ps1 b/build.ps1 index 5bf0e2c113..d5eb4d5cf2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,67 +1,177 @@ -$ErrorActionPreference = "Stop" +#!/usr/bin/env powershell +#requires -version 4 -function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) -{ - while($true) - { - try - { - Invoke-WebRequest $url -OutFile $downloadLocation - break - } - catch - { - $exceptionMessage = $_.Exception.Message - Write-Host "Failed to download '$url': $exceptionMessage" - if ($retries -gt 0) { - $retries-- - Write-Host "Waiting 10 seconds before retrying. Retries left: $retries" - Start-Sleep -Seconds 10 +<# +.SYNOPSIS +Build this repository +.DESCRIPTION +Downloads korebuild if required. Then builds the repository. + +.PARAMETER Path +The folder to build. Defaults to the folder containing this script. + +.PARAMETER Channel +The channel of KoreBuild to download. Overrides the value from the config file. + +.PARAMETER DotNetHome +The directory where .NET Core tools will be stored. + +.PARAMETER ToolsSource +The base url where build tools can be downloaded. Overrides the value from the config file. + +.PARAMETER Update +Updates KoreBuild to the latest version even if a lock file is present. + +.PARAMETER ConfigFile +The path to the configuration file that stores values. Defaults to version.xml. + +.PARAMETER MSBuildArgs +Arguments to be passed to MSBuild + +.NOTES +This function will create a file $PSScriptRoot/korebuild-lock.txt. This lock file can be committed to source, but does not have to be. +When the lockfile is not present, KoreBuild will create one using latest available version from $Channel. + +The $ConfigFile is expected to be an XML file. It is optional, and the configuration values in it are optional as well. + +.EXAMPLE +Example config file: +```xml + + + + dev + https://aspnetcore.blob.core.windows.net/buildtools + + +``` +#> +[CmdletBinding(PositionalBinding = $false)] +param( + [string]$Path = $PSScriptRoot, + [Alias('c')] + [string]$Channel, + [Alias('d')] + [string]$DotNetHome, + [Alias('s')] + [string]$ToolsSource, + [Alias('u')] + [switch]$Update, + [string]$ConfigFile = (Join-Path $PSScriptRoot 'version.xml'), + [Parameter(ValueFromRemainingArguments = $true)] + [string[]]$MSBuildArgs +) + +Set-StrictMode -Version 2 +$ErrorActionPreference = 'Stop' + +# +# Functions +# + +function Get-KoreBuild { + + $lockFile = Join-Path $Path 'korebuild-lock.txt' + + if (!(Test-Path $lockFile) -or $Update) { + Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile + } + + $version = Get-Content $lockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1 + if (!$version) { + Write-Error "Failed to parse version from $lockFile. Expected a line that begins with 'version:'" + } + $version = $version.TrimStart('version:').Trim() + $korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version) + + if (!(Test-Path $korebuildPath)) { + Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version" + New-Item -ItemType Directory -Path $korebuildPath | Out-Null + $remotePath = "$ToolsSource/korebuild/artifacts/$version/korebuild.$version.zip" + + try { + $tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip" + Get-RemoteFile $remotePath $tmpfile + if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) { + # Use built-in commands where possible as they are cross-plat compatible + Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath } - else - { - $exception = $_.Exception - throw $exception + else { + # Fallback to old approach for old installations of PowerShell + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($tmpfile, $korebuildPath) } } + catch { + Remove-Item -Recurse -Force $korebuildPath -ErrorAction Ignore + throw + } + finally { + Remove-Item $tmpfile -ErrorAction Ignore + } } + + return $korebuildPath } -cd $PSScriptRoot - -$repoFolder = $PSScriptRoot -$env:REPO_FOLDER = $repoFolder - -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" -if ($env:KOREBUILD_ZIP) -{ - $koreBuildZip=$env:KOREBUILD_ZIP +function Join-Paths([string]$path, [string[]]$childPaths) { + $childPaths | ForEach-Object { $path = Join-Path $path $_ } + return $path } -$buildFolder = ".build" -$buildFile="$buildFolder\KoreBuild.ps1" - -if (!(Test-Path $buildFolder)) { - Write-Host "Downloading KoreBuild from $koreBuildZip" - - $tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid() - New-Item -Path "$tempFolder" -Type directory | Out-Null - - $localZipFile="$tempFolder\korebuild.zip" - - DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6 - - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) - - New-Item -Path "$buildFolder" -Type directory | Out-Null - copy-item "$tempFolder\**\build\*" $buildFolder -Recurse - - # Cleanup - if (Test-Path $tempFolder) { - Remove-Item -Recurse -Force $tempFolder +function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { + if ($RemotePath -notlike 'http*') { + Copy-Item $RemotePath $LocalPath + return } + + $retries = 10 + while ($retries -gt 0) { + $retries -= 1 + try { + Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath + return + } + catch { + Write-Verbose "Request failed. $retries retries remaining" + } + } + + Write-Error "Download failed: '$RemotePath'." } -&"$buildFile" @args +# +# Main +# + +# Load configuration or set defaults + +if (Test-Path $ConfigFile) { + [xml] $config = Get-Content $ConfigFile + if (!($Channel)) { [string] $Channel = Select-Xml -Xml $config -XPath '/Project/PropertyGroup/KoreBuildChannel' } + if (!($ToolsSource)) { [string] $ToolsSource = Select-Xml -Xml $config -XPath '/Project/PropertyGroup/KoreBuildToolsSource' } +} + +if (!$DotNetHome) { + $DotNetHome = if ($env:DOTNET_HOME) { $env:DOTNET_HOME } ` + elseif ($env:USERPROFILE) { Join-Path $env:USERPROFILE '.dotnet'} ` + elseif ($env:HOME) {Join-Path $env:HOME '.dotnet'}` + else { Join-Path $PSScriptRoot '.dotnet'} +} + +if (!$Channel) { $Channel = 'dev' } +if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' } + +# Execute + +$korebuildPath = Get-KoreBuild +Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1') + +try { + Install-Tools $ToolsSource $DotNetHome + Invoke-RepositoryBuild $Path @MSBuildArgs +} +finally { + Remove-Module 'KoreBuild' -ErrorAction Ignore +} diff --git a/build.sh b/build.sh index b0bcadb579..ab590e62f1 100755 --- a/build.sh +++ b/build.sh @@ -1,46 +1,196 @@ #!/usr/bin/env bash -repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" -if [ ! -z $KOREBUILD_ZIP ]; then - koreBuildZip=$KOREBUILD_ZIP -fi +set -euo pipefail -buildFolder=".build" -buildFile="$buildFolder/KoreBuild.sh" +# +# variables +# -if test ! -d $buildFolder; then - echo "Downloading KoreBuild from $koreBuildZip" +RESET="\033[0m" +RED="\033[0;31m" +MAGENTA="\033[0;95m" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +[ -z "${DOTNET_HOME:-}"] && DOTNET_HOME="$HOME/.dotnet" +config_file="$DIR/version.xml" +verbose=false +update=false +repo_path="$DIR" +channel='' +tools_source='' - tempFolder="/tmp/KoreBuild-$(uuidgen)" - mkdir $tempFolder +# +# Functions +# +__usage() { + echo "Usage: $(basename ${BASH_SOURCE[0]}) [options] [[--] ...]" + echo "" + echo "Arguments:" + echo " ... Arguments passed to MSBuild. Variable number of arguments allowed." + echo "" + echo "Options:" + echo " --verbose Show verbose output." + echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." + echo " --config-file TThe path to the configuration file that stores values. Defaults to version.xml." + echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." + echo " --path The directory to build. Defaults to the directory containing the script." + echo " -s|--tools-source The base url where build tools can be downloaded. Overrides the value from the config file." + echo " -u|--update Update to the latest KoreBuild even if the lock file is present." + echo "" + echo "Description:" + echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." + echo " When the lockfile is not present, KoreBuild will create one using latest available version from \$channel." - localZipFile="$tempFolder/korebuild.zip" - - retries=6 - until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null) - do - echo "Failed to download '$koreBuildZip'" - if [ "$retries" -le 0 ]; then - exit 1 - fi - retries=$((retries - 1)) - echo "Waiting 10 seconds before retrying. Retries left: $retries" - sleep 10s - done - - unzip -q -d $tempFolder $localZipFile - - mkdir $buildFolder - cp -r $tempFolder/**/build/** $buildFolder - - chmod +x $buildFile - - # Cleanup - if test -d $tempFolder; then - rm -rf $tempFolder + if [[ "${1:-}" != '--no-exit' ]]; then + exit 2 fi +} + +get_korebuild() { + local lock_file="$repo_path/korebuild-lock.txt" + if [ ! -f $lock_file ] || [ "$update" = true ]; then + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" $lock_file + fi + local version="$(grep 'version:*' -m 1 $lock_file)" + if [[ "$version" == '' ]]; then + __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" + return 1 + fi + version="$(echo ${version#version:} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" + + { + if [ ! -d "$korebuild_path" ]; then + mkdir -p "$korebuild_path" + local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" + tmpfile="$(mktemp)" + echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" + if __get_remote_file $remote_path $tmpfile; then + unzip -q -d "$korebuild_path" $tmpfile + fi + rm $tmpfile || true + fi + + source "$korebuild_path/KoreBuild.sh" + } || { + if [ -d "$korebuild_path" ]; then + echo "Cleaning up after failed installation" + rm -rf "$korebuild_path" || true + fi + return 1 + } +} + +__error() { + echo -e "${RED}$@${RESET}" 1>&2 +} + +__machine_has() { + hash "$1" > /dev/null 2>&1 + return $? +} + +__get_remote_file() { + local remote_path=$1 + local local_path=$2 + + if [[ "$remote_path" != 'http'* ]]; then + cp $remote_path $local_path + return 0 + fi + + failed=false + if __machine_has wget; then + wget --tries 10 --quiet -O $local_path $remote_path || failed=true + fi + + if [ "$failed" = true ] && __machine_has curl; then + failed=false + curl --retry 10 -sSL -f --create-dirs -o $local_path $remote_path || failed=true + fi + + if [ "$failed" = true ]; then + __error "Download failed: $remote_path" 1>&2 + return 1 + fi +} + +__read_dom () { local IFS=\> ; read -d \< ENTITY CONTENT ;} + +# +# main +# + +while [[ $# > 0 ]]; do + case $1 in + -\?|-h|--help) + __usage --no-exit + exit 0 + ;; + -c|--channel|-Channel) + shift + channel=${1:-} + [ -z "$channel" ] && __usage + ;; + --config-file|-ConfigFile) + shift + config_file="${1:-}" + [ -z "$config_file" ] && __usage + ;; + -d|--dotnet-home|-DotNetHome) + shift + DOTNET_HOME=${1:-} + [ -z "$DOTNET_HOME" ] && __usage + ;; + --path|-Path) + shift + repo_path="${1:-}" + [ -z "$repo_path" ] && __usage + ;; + -s|--tools-source|-ToolsSource) + shift + tools_source="${1:-}" + [ -z "$tools_source" ] && __usage + ;; + -u|--update|-Update) + update=true + ;; + --verbose|-Verbose) + verbose=true + ;; + --) + shift + break + ;; + *) + break + ;; + esac + shift +done + +if ! __machine_has unzip; then + __error 'Missing required command: unzip' + exit 1 fi -$buildFile -r $repoFolder "$@" +if ! __machine_has curl && ! __machine_has wget; then + __error 'Missing required command. Either wget or curl is required.' + exit 1 +fi + +if [ -f $config_file ]; then + comment=false + while __read_dom; do + if [ "$comment" = true ]; then [[ $CONTENT == *'-->'* ]] && comment=false ; continue; fi + if [[ $ENTITY == '!--'* ]]; then comment=true; continue; fi + if [ -z "$channel" ] && [[ $ENTITY == "KoreBuildChannel" ]]; then channel=$CONTENT; fi + if [ -z "$tools_source" ] && [[ $ENTITY == "KoreBuildToolsSource" ]]; then tools_source=$CONTENT; fi + done < $config_file +fi + +[ -z "$channel" ] && channel='dev' +[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' + +get_korebuild +install_tools "$tools_source" "$DOTNET_HOME" +invoke_repository_build "$repo_path" $@ diff --git a/build/common.props b/build/common.props index df05cb23bd..7614043a0f 100644 --- a/build/common.props +++ b/build/common.props @@ -1,6 +1,6 @@ - + Microsoft ASP.NET Core diff --git a/version.props b/version.xml similarity index 55% rename from version.props rename to version.xml index 1ea46af42a..3c05022b7d 100644 --- a/version.props +++ b/version.xml @@ -1,6 +1,7 @@ - + + dev 2.1.0 preview1 From a5572a6d39d41dc72a8477618f24700223ed798d Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 26 Jul 2017 10:29:12 -0700 Subject: [PATCH 233/295] Fix syntax warning when running build.sh on older versions of bash [ci skip] --- build.sh | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/build.sh b/build.sh index ab590e62f1..5568c6182a 100755 --- a/build.sh +++ b/build.sh @@ -10,7 +10,7 @@ RESET="\033[0m" RED="\033[0;31m" MAGENTA="\033[0;95m" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -[ -z "${DOTNET_HOME:-}"] && DOTNET_HOME="$HOME/.dotnet" +[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet" config_file="$DIR/version.xml" verbose=false update=false @@ -22,7 +22,7 @@ tools_source='' # Functions # __usage() { - echo "Usage: $(basename ${BASH_SOURCE[0]}) [options] [[--] ...]" + echo "Usage: $(basename "${BASH_SOURCE[0]}") [options] [[--] ...]" echo "" echo "Arguments:" echo " ... Arguments passed to MSBuild. Variable number of arguments allowed." @@ -46,16 +46,17 @@ __usage() { } get_korebuild() { + local version local lock_file="$repo_path/korebuild-lock.txt" - if [ ! -f $lock_file ] || [ "$update" = true ]; then - __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" $lock_file + if [ ! -f "$lock_file" ] || [ "$update" = true ]; then + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" fi - local version="$(grep 'version:*' -m 1 $lock_file)" + version="$(grep 'version:*' -m 1 "$lock_file")" if [[ "$version" == '' ]]; then __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" return 1 fi - version="$(echo ${version#version:} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" { @@ -64,10 +65,10 @@ get_korebuild() { local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" tmpfile="$(mktemp)" echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" - if __get_remote_file $remote_path $tmpfile; then - unzip -q -d "$korebuild_path" $tmpfile + if __get_remote_file "$remote_path" "$tmpfile"; then + unzip -q -d "$korebuild_path" "$tmpfile" fi - rm $tmpfile || true + rm "$tmpfile" || true fi source "$korebuild_path/KoreBuild.sh" @@ -81,7 +82,7 @@ get_korebuild() { } __error() { - echo -e "${RED}$@${RESET}" 1>&2 + echo -e "${RED}$*${RESET}" 1>&2 } __machine_has() { @@ -94,18 +95,18 @@ __get_remote_file() { local local_path=$2 if [[ "$remote_path" != 'http'* ]]; then - cp $remote_path $local_path + cp "$remote_path" "$local_path" return 0 fi failed=false if __machine_has wget; then - wget --tries 10 --quiet -O $local_path $remote_path || failed=true + wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true fi if [ "$failed" = true ] && __machine_has curl; then failed=false - curl --retry 10 -sSL -f --create-dirs -o $local_path $remote_path || failed=true + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true fi if [ "$failed" = true ]; then @@ -114,13 +115,13 @@ __get_remote_file() { fi } -__read_dom () { local IFS=\> ; read -d \< ENTITY CONTENT ;} +__read_dom () { local IFS=\> ; read -r -d \< ENTITY CONTENT ;} # # main # -while [[ $# > 0 ]]; do +while [[ $# -gt 0 ]]; do case $1 in -\?|-h|--help) __usage --no-exit @@ -128,7 +129,7 @@ while [[ $# > 0 ]]; do ;; -c|--channel|-Channel) shift - channel=${1:-} + channel="${1:-}" [ -z "$channel" ] && __usage ;; --config-file|-ConfigFile) @@ -138,7 +139,7 @@ while [[ $# > 0 ]]; do ;; -d|--dotnet-home|-DotNetHome) shift - DOTNET_HOME=${1:-} + DOTNET_HOME="${1:-}" [ -z "$DOTNET_HOME" ] && __usage ;; --path|-Path) @@ -178,14 +179,14 @@ if ! __machine_has curl && ! __machine_has wget; then exit 1 fi -if [ -f $config_file ]; then +if [ -f "$config_file" ]; then comment=false while __read_dom; do if [ "$comment" = true ]; then [[ $CONTENT == *'-->'* ]] && comment=false ; continue; fi if [[ $ENTITY == '!--'* ]]; then comment=true; continue; fi if [ -z "$channel" ] && [[ $ENTITY == "KoreBuildChannel" ]]; then channel=$CONTENT; fi if [ -z "$tools_source" ] && [[ $ENTITY == "KoreBuildToolsSource" ]]; then tools_source=$CONTENT; fi - done < $config_file + done < "$config_file" fi [ -z "$channel" ] && channel='dev' @@ -193,4 +194,4 @@ fi get_korebuild install_tools "$tools_source" "$DOTNET_HOME" -invoke_repository_build "$repo_path" $@ +invoke_repository_build "$repo_path" "$@" From 2ed72e56fa552fc7a2bfd78f3d67a4178b43fee7 Mon Sep 17 00:00:00 2001 From: John Luo Date: Wed, 2 Aug 2017 12:44:48 -0700 Subject: [PATCH 234/295] Update __get_remote_file logic --- build.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 5568c6182a..8eace4c20d 100755 --- a/build.sh +++ b/build.sh @@ -99,17 +99,16 @@ __get_remote_file() { return 0 fi - failed=false + local succeeded=false if __machine_has wget; then - wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true + wget --tries 10 --quiet -O "$local_path" "$remote_path" && succeeded=true fi - if [ "$failed" = true ] && __machine_has curl; then - failed=false - curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true + if [ "$succeeded" = false ] && __machine_has curl; then + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" && succeeded=true fi - if [ "$failed" = true ]; then + if [ "$succeeded" = false ]; then __error "Download failed: $remote_path" 1>&2 return 1 fi From 044527e33c45da71b730c9e3a69707bb82b98e49 Mon Sep 17 00:00:00 2001 From: John Luo Date: Wed, 2 Aug 2017 14:34:04 -0700 Subject: [PATCH 235/295] Ensure fallback to curl after failed wget --- build.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 8eace4c20d..11cdbe5504 100755 --- a/build.sh +++ b/build.sh @@ -99,16 +99,19 @@ __get_remote_file() { return 0 fi - local succeeded=false + local failed=false if __machine_has wget; then - wget --tries 10 --quiet -O "$local_path" "$remote_path" && succeeded=true + wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true + else + failed=true fi - if [ "$succeeded" = false ] && __machine_has curl; then - curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" && succeeded=true + if [ "$failed" = true ] && __machine_has curl; then + failed=false + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true fi - if [ "$succeeded" = false ]; then + if [ "$failed" = true ]; then __error "Download failed: $remote_path" 1>&2 return 1 fi From 52569185f27cdcb3dac86dc5d36a71e936b56a93 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 22 Aug 2017 18:16:54 -0700 Subject: [PATCH 236/295] Upgrade to xunit 2.3.0-beta4 Includes a few changes as required by the new analyzers --- build/dependencies.props | 4 ++-- .../SessionTests.cs | 20 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 7a9758238c..7dde6b27b6 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -5,7 +5,7 @@ 2.0.0-* 2.0.0-* 2.0.0-* - 15.3.0-* - 2.3.0-beta2-* + 15.3.0 + 2.3.0-beta4-build3742 diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 5f28c79b08..58ccdcd8d6 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -51,8 +51,7 @@ namespace Microsoft.AspNetCore.Session var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); - IEnumerable values; - Assert.False(response.Headers.TryGetValues("Set-Cookie", out values)); + Assert.False(response.Headers.TryGetValues("Set-Cookie", out var _)); } } @@ -82,9 +81,8 @@ namespace Microsoft.AspNetCore.Session var client = server.CreateClient(); var response = await client.GetAsync(string.Empty); response.EnsureSuccessStatusCode(); - IEnumerable values; - Assert.True(response.Headers.TryGetValues("Set-Cookie", out values)); - Assert.Equal(1, values.Count()); + Assert.True(response.Headers.TryGetValues("Set-Cookie", out var values)); + Assert.Single(values); Assert.True(!string.IsNullOrWhiteSpace(values.First())); } } @@ -131,9 +129,8 @@ namespace Microsoft.AspNetCore.Session var client = server.CreateClient(); var response = await client.GetAsync(requestUri); response.EnsureSuccessStatusCode(); - IEnumerable values; - Assert.True(response.Headers.TryGetValues("Set-Cookie", out values)); - Assert.Equal(1, values.Count()); + Assert.True(response.Headers.TryGetValues("Set-Cookie", out var values)); + Assert.Single(values); if (shouldBeSecureOnly) { Assert.Contains("; secure", values.First()); @@ -570,8 +567,7 @@ namespace Microsoft.AspNetCore.Session app.UseSession(); app.Run(context => { - byte[] value; - Assert.False(context.Session.TryGetValue("key", out value)); + Assert.False(context.Session.TryGetValue("key", out var value)); Assert.Null(value); Assert.Equal(string.Empty, context.Session.Id); Assert.False(context.Session.Keys.Any()); @@ -597,7 +593,7 @@ namespace Microsoft.AspNetCore.Session var sessionLogMessages = sink.Writes; - Assert.Equal(1, sessionLogMessages.Count); + Assert.Single(sessionLogMessages); Assert.Contains("Session cache read exception", sessionLogMessages[0].State.ToString()); Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); } @@ -691,7 +687,7 @@ namespace Microsoft.AspNetCore.Session var sessionLogMessages = sink.Writes; - Assert.Equal(1, sessionLogMessages.Count); + Assert.Single(sessionLogMessages); Assert.Contains("Error closing the session.", sessionLogMessages[0].State.ToString()); Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); } From 8530f91507cd424942b41d5284b7fc5a5e56e1f2 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 28 Aug 2017 15:36:20 -0700 Subject: [PATCH 237/295] Use Directory.Build.props/targets --- appveyor.yml => .appveyor.yml | 0 build/common.props => Directory.Build.props | 12 ++++-------- Directory.Build.targets | 2 ++ Session.sln | 10 +++++++++- samples/SessionSample/SessionSample.csproj | 2 -- src/Directory.Build.props | 7 +++++++ .../Microsoft.AspNetCore.Session.csproj | 2 -- test/Directory.Build.props | 7 +++++++ .../Microsoft.AspNetCore.Session.Tests.csproj | 2 -- 9 files changed, 29 insertions(+), 15 deletions(-) rename appveyor.yml => .appveyor.yml (100%) rename build/common.props => Directory.Build.props (59%) create mode 100644 Directory.Build.targets create mode 100644 src/Directory.Build.props create mode 100644 test/Directory.Build.props diff --git a/appveyor.yml b/.appveyor.yml similarity index 100% rename from appveyor.yml rename to .appveyor.yml diff --git a/build/common.props b/Directory.Build.props similarity index 59% rename from build/common.props rename to Directory.Build.props index 7614043a0f..1b3d01cefb 100644 --- a/build/common.props +++ b/Directory.Build.props @@ -1,20 +1,16 @@ - - - + + + Microsoft ASP.NET Core https://github.com/aspnet/Session git - $(MSBuildThisFileDirectory)Key.snk + $(MSBuildThisFileDirectory)build\Key.snk true true $(VersionSuffix)-$(BuildNumber) true - - - - diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000000..f75adf7e4d --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,2 @@ + + diff --git a/Session.sln b/Session.sln index 1ea569a371..bbed68a678 100644 --- a/Session.sln +++ b/Session.sln @@ -3,8 +3,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 15.0.26621.2 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" + ProjectSection(SolutionItems) = preProject + test\Directory.Build.props = test\Directory.Build.props + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A189F10C-3A9C-4F81-83D0-32E5FE50DAD8}" + ProjectSection(SolutionItems) = preProject + src\Directory.Build.props = src\Directory.Build.props + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Session", "src\Microsoft.AspNetCore.Session\Microsoft.AspNetCore.Session.csproj", "{71802736-F640-4733-9671-02D267EDD76A}" EndProject @@ -16,10 +22,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionSample", "samples\Se EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{3B45F658-5BF1-4E07-BE9C-6F5110AC2277}" ProjectSection(SolutionItems) = preProject + .appveyor.yml = .appveyor.yml .gitattributes = .gitattributes .gitignore = .gitignore .travis.yml = .travis.yml - appveyor.yml = appveyor.yml + Directory.Build.props = Directory.Build.props + Directory.Build.targets = Directory.Build.targets NuGet.config = NuGet.config NuGetPackageVerifier.json = NuGetPackageVerifier.json README.md = README.md diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj index adb1c8a3f5..dff7a3b26c 100644 --- a/samples/SessionSample/SessionSample.csproj +++ b/samples/SessionSample/SessionSample.csproj @@ -1,7 +1,5 @@  - - netcoreapp2.0;net461 diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000000..d704a37df9 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj index 1f86c5d1d8..60a221e2cd 100644 --- a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj +++ b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj @@ -1,7 +1,5 @@  - - ASP.NET Core session state middleware. netstandard2.0 diff --git a/test/Directory.Build.props b/test/Directory.Build.props new file mode 100644 index 0000000000..d704a37df9 --- /dev/null +++ b/test/Directory.Build.props @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index 026ee2707d..41b694a675 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -1,7 +1,5 @@  - - netcoreapp2.0;net461 netcoreapp2.0 From f63354713f4b529eb0112a530b7f91061fe8e312 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 28 Aug 2017 15:38:43 -0700 Subject: [PATCH 238/295] Use PackageLineup to manage PackageReference versions --- Directory.Build.props | 1 - Directory.Build.targets | 14 +++++++++++++- NuGet.config | 1 - build/dependencies.props | 11 ----------- build/repo.props | 6 ++++++ samples/SessionSample/SessionSample.csproj | 12 ++++++------ src/Directory.Build.props | 2 +- .../Microsoft.AspNetCore.Session.csproj | 10 +++++----- test/Directory.Build.props | 2 +- .../Microsoft.AspNetCore.Session.Tests.csproj | 12 ++++++------ 10 files changed, 38 insertions(+), 33 deletions(-) delete mode 100644 build/dependencies.props create mode 100644 build/repo.props diff --git a/Directory.Build.props b/Directory.Build.props index 1b3d01cefb..6ce4a74c9b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,4 @@  - diff --git a/Directory.Build.targets b/Directory.Build.targets index f75adf7e4d..bc118fd907 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,2 +1,14 @@ - + + + + <_BootstrapperFile Condition=" $([MSBuild]::IsOSUnixLike()) ">build.sh + <_BootstrapperFile Condition="! $([MSBuild]::IsOSUnixLike()) ">build.cmd + <_BootstrapperError> + Package references have not been pinned. Run './$(_BootstrapperFile) /t:Pin'. + Also, you can run './$(_BootstrapperFile) /t:Restore' which will pin *and* restore packages. '$(_BootstrapperFile)' can be found in '$(MSBuildThisFileDirectory)'. + + + + + diff --git a/NuGet.config b/NuGet.config index 4e8a1f6de1..20060c934e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,7 +3,6 @@ - diff --git a/build/dependencies.props b/build/dependencies.props deleted file mode 100644 index 7dde6b27b6..0000000000 --- a/build/dependencies.props +++ /dev/null @@ -1,11 +0,0 @@ - - - 2.1.0-* - 2.1.1-* - 2.0.0-* - 2.0.0-* - 2.0.0-* - 15.3.0 - 2.3.0-beta4-build3742 - - diff --git a/build/repo.props b/build/repo.props new file mode 100644 index 0000000000..13fe1c296a --- /dev/null +++ b/build/repo.props @@ -0,0 +1,6 @@ + + + + + + diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj index dff7a3b26c..bda14213e6 100644 --- a/samples/SessionSample/SessionSample.csproj +++ b/samples/SessionSample/SessionSample.csproj @@ -9,12 +9,12 @@ - - - - - - + + + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d704a37df9..9d9a3de33a 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,6 +2,6 @@ - + diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj index 60a221e2cd..c70952b298 100644 --- a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj +++ b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj @@ -10,11 +10,11 @@ - - - - - + + + + + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index d704a37df9..9d9a3de33a 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -2,6 +2,6 @@ - + diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index 41b694a675..26e421c10e 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From 0f71fde18ae2bddeb5a33058615eff804ff5578d Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Thu, 21 Sep 2017 17:59:17 -0700 Subject: [PATCH 239/295] Increase Minimum Version of Visual Studio to 15.3.0 --- Session.sln | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Session.sln b/Session.sln index bbed68a678..d8d95dc295 100644 --- a/Session.sln +++ b/Session.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26621.2 -MinimumVisualStudioVersion = 10.0.40219.1 +MinimumVisualStudioVersion = 15.0.26730.03 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" ProjectSection(SolutionItems) = preProject test\Directory.Build.props = test\Directory.Build.props From be6b099f6ce45bc1308f2135dbd1bfe295e20a98 Mon Sep 17 00:00:00 2001 From: "Chris Ross (ASP.NET)" Date: Thu, 28 Sep 2017 12:21:31 -0700 Subject: [PATCH 240/295] #189 Reduce noise for load and commit logs. --- .../DistributedSession.cs | 76 +++-- .../LoggingExtensions.cs | 52 +++- .../SessionMiddleware.cs | 4 + .../SessionTests.cs | 285 +++++++++++++++++- 4 files changed, 392 insertions(+), 25 deletions(-) diff --git a/src/Microsoft.AspNetCore.Session/DistributedSession.cs b/src/Microsoft.AspNetCore.Session/DistributedSession.cs index 1f9fa7fa87..76ab3f3cf5 100644 --- a/src/Microsoft.AspNetCore.Session/DistributedSession.cs +++ b/src/Microsoft.AspNetCore.Session/DistributedSession.cs @@ -198,22 +198,34 @@ namespace Microsoft.AspNetCore.Session } // This will throw if called directly and a failure occurs. The user is expected to handle the failures. - public async Task LoadAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task LoadAsync(CancellationToken cancellationToken = default) { - cancellationToken.ThrowIfCancellationRequested(); if (!_loaded) { using (var timeout = new CancellationTokenSource(_ioTimeout)) { var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, cancellationToken); - var data = await _cache.GetAsync(_sessionKey, cts.Token); - if (data != null) + try { - Deserialize(new MemoryStream(data)); + cts.Token.ThrowIfCancellationRequested(); + var data = await _cache.GetAsync(_sessionKey, cts.Token); + if (data != null) + { + Deserialize(new MemoryStream(data)); + } + else if (!_isNewSessionKey) + { + _logger.AccessingExpiredSession(_sessionKey); + } } - else if (!_isNewSessionKey) + catch (OperationCanceledException oex) { - _logger.AccessingExpiredSession(_sessionKey); + if (timeout.Token.IsCancellationRequested) + { + _logger.SessionLoadingTimeout(); + throw new OperationCanceledException("Timed out loading the session.", oex, timeout.Token); + } + throw; } } _isAvailable = true; @@ -221,9 +233,8 @@ namespace Microsoft.AspNetCore.Session } } - public async Task CommitAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task CommitAsync(CancellationToken cancellationToken = default) { - cancellationToken.ThrowIfCancellationRequested(); using (var timeout = new CancellationTokenSource(_ioTimeout)) { var cts = CancellationTokenSource.CreateLinkedTokenSource(timeout.Token, cancellationToken); @@ -231,14 +242,20 @@ namespace Microsoft.AspNetCore.Session { if (_logger.IsEnabled(LogLevel.Information)) { + // This operation is only so we can log if the session already existed. + // Log and ignore failures. try { + cts.Token.ThrowIfCancellationRequested(); var data = await _cache.GetAsync(_sessionKey, cts.Token); if (data == null) { _logger.SessionStarted(_sessionKey, Id); } } + catch (OperationCanceledException) + { + } catch (Exception exception) { _logger.SessionCacheReadException(_sessionKey, exception); @@ -248,17 +265,42 @@ namespace Microsoft.AspNetCore.Session var stream = new MemoryStream(); Serialize(stream); - await _cache.SetAsync( - _sessionKey, - stream.ToArray(), - new DistributedCacheEntryOptions().SetSlidingExpiration(_idleTimeout), - cts.Token); - _isModified = false; - _logger.SessionStored(_sessionKey, Id, _store.Count); + try + { + cts.Token.ThrowIfCancellationRequested(); + await _cache.SetAsync( + _sessionKey, + stream.ToArray(), + new DistributedCacheEntryOptions().SetSlidingExpiration(_idleTimeout), + cts.Token); + _isModified = false; + _logger.SessionStored(_sessionKey, Id, _store.Count); + } + catch (OperationCanceledException oex) + { + if (timeout.Token.IsCancellationRequested) + { + _logger.SessionCommitTimeout(); + throw new OperationCanceledException("Timed out committing the session.", oex, timeout.Token); + } + throw; + } } else { - await _cache.RefreshAsync(_sessionKey, cts.Token); + try + { + await _cache.RefreshAsync(_sessionKey, cts.Token); + } + catch (OperationCanceledException oex) + { + if (timeout.Token.IsCancellationRequested) + { + _logger.SessionRefreshTimeout(); + throw new OperationCanceledException("Timed out refreshing the session.", oex, timeout.Token); + } + throw; + } } } } diff --git a/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs b/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs index c6780a7dfc..2552ac20de 100644 --- a/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs @@ -14,6 +14,11 @@ namespace Microsoft.Extensions.Logging private static Action _sessionStored; private static Action _sessionCacheReadException; private static Action _errorUnprotectingCookie; + private static Action _sessionLoadingTimeout; + private static Action _sessionCommitTimeout; + private static Action _sessionCommitCanceled; + private static Action _sessionRefreshTimeout; + private static Action _sessionRefreshCanceled; static LoggingExtensions() { @@ -23,7 +28,7 @@ namespace Microsoft.Extensions.Logging formatString: "Error closing the session."); _accessingExpiredSession = LoggerMessage.Define( eventId: 2, - logLevel: LogLevel.Warning, + logLevel: LogLevel.Information, formatString: "Accessing expired session, Key:{sessionKey}"); _sessionStarted = LoggerMessage.Define( eventId: 3, @@ -45,6 +50,26 @@ namespace Microsoft.Extensions.Logging eventId: 7, logLevel: LogLevel.Warning, formatString: "Error unprotecting the session cookie."); + _sessionLoadingTimeout = LoggerMessage.Define( + eventId: 8, + logLevel: LogLevel.Warning, + formatString: "Loading the session timed out."); + _sessionCommitTimeout = LoggerMessage.Define( + eventId: 9, + logLevel: LogLevel.Warning, + formatString: "Committing the session timed out."); + _sessionCommitCanceled = LoggerMessage.Define( + eventId: 10, + logLevel: LogLevel.Information, + formatString: "Committing the session was canceled."); + _sessionRefreshTimeout = LoggerMessage.Define( + eventId: 11, + logLevel: LogLevel.Warning, + formatString: "Refreshing the session timed out."); + _sessionRefreshCanceled = LoggerMessage.Define( + eventId: 12, + logLevel: LogLevel.Information, + formatString: "Refreshing the session was canceled."); } public static void ErrorClosingTheSession(this ILogger logger, Exception exception) @@ -81,5 +106,30 @@ namespace Microsoft.Extensions.Logging { _errorUnprotectingCookie(logger, exception); } + + public static void SessionLoadingTimeout(this ILogger logger) + { + _sessionLoadingTimeout(logger, null); + } + + public static void SessionCommitTimeout(this ILogger logger) + { + _sessionCommitTimeout(logger, null); + } + + public static void SessionCommitCanceled(this ILogger logger) + { + _sessionCommitCanceled(logger, null); + } + + public static void SessionRefreshTimeout(this ILogger logger) + { + _sessionRefreshTimeout(logger, null); + } + + public static void SessionRefreshCanceled(this ILogger logger) + { + _sessionRefreshCanceled(logger, null); + } } } diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs index 2dbc0531c9..bd74afa9cb 100644 --- a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs @@ -116,6 +116,10 @@ namespace Microsoft.AspNetCore.Session { await feature.Session.CommitAsync(context.RequestAborted); } + catch (OperationCanceledException) + { + _logger.SessionCommitCanceled(); + } catch (Exception ex) { _logger.ErrorClosingTheSession(ex); diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 58ccdcd8d6..429e141294 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -328,7 +328,7 @@ namespace Microsoft.AspNetCore.Session } [Fact] - public async Task ExpiredSession_LogsWarning() + public async Task ExpiredSession_LogsInfo() { var sink = new TestSink( TestSink.EnableWithTypeName, @@ -385,7 +385,7 @@ namespace Microsoft.AspNetCore.Session Assert.Contains("expired", sessionLogMessages[2].State.ToString()); Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); Assert.Equal(LogLevel.Debug, sessionLogMessages[1].LogLevel); - Assert.Equal(LogLevel.Warning, sessionLogMessages[2].LogLevel); + Assert.Equal(LogLevel.Information, sessionLogMessages[2].LogLevel); } [Fact] @@ -599,7 +599,133 @@ namespace Microsoft.AspNetCore.Session } [Fact] - public async Task SessionLogsCacheWriteException() + public async Task SessionLogsCacheLoadAsyncException() + { + var sink = new TestSink( + TestSink.EnableWithTypeName, + TestSink.EnableWithTypeName); + var loggerFactory = new TestLoggerFactory(sink, enabled: true); + var builder = new WebHostBuilder() + .Configure(app => + { + app.UseSession(); + app.Run(async context => + { + await Assert.ThrowsAsync(() => context.Session.LoadAsync()); + Assert.False(context.Session.IsAvailable); + Assert.Equal(string.Empty, context.Session.Id); + Assert.False(context.Session.Keys.Any()); + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); + services.AddSingleton(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) + { + DisableGet = true + }); + services.AddSession(); + }); + + using (var server = new TestServer(builder)) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + response.EnsureSuccessStatusCode(); + } + + var sessionLogMessages = sink.Writes; + + Assert.Single(sessionLogMessages); + Assert.Contains("Session cache read exception", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); + } + + [Fact] + public async Task SessionLogsCacheLoadAsyncTimeoutException() + { + var sink = new TestSink( + TestSink.EnableWithTypeName, + TestSink.EnableWithTypeName); + var loggerFactory = new TestLoggerFactory(sink, enabled: true); + var builder = new WebHostBuilder() + .Configure(app => + { + app.UseSession(new SessionOptions() + { + IOTimeout = TimeSpan.FromSeconds(0.5) + }); + app.Run(async context => + { + await Assert.ThrowsAsync(() => context.Session.LoadAsync()); + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); + services.AddSingleton(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) + { + DelayGetAsync = true + }); + services.AddSession(); + }); + + using (var server = new TestServer(builder)) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + response.EnsureSuccessStatusCode(); + } + + var sessionLogMessages = sink.Writes; + + Assert.Single(sessionLogMessages); + Assert.Contains("Loading the session timed out.", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Warning, sessionLogMessages[0].LogLevel); + } + + [Fact] + public async Task SessionLoadAsyncCanceledException() + { + var sink = new TestSink( + TestSink.EnableWithTypeName, + TestSink.EnableWithTypeName); + var loggerFactory = new TestLoggerFactory(sink, enabled: true); + var builder = new WebHostBuilder() + .Configure(app => + { + app.UseSession(); + app.Run(async context => + { + var cts = new CancellationTokenSource(); + var token = cts.Token; + cts.Cancel(); + await Assert.ThrowsAsync(() => context.Session.LoadAsync(token)); + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); + services.AddSingleton(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) + { + DelayGetAsync = true + }); + services.AddSession(); + }); + + using (var server = new TestServer(builder)) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + response.EnsureSuccessStatusCode(); + } + + var sessionLogMessages = sink.Writes; + Assert.Empty(sessionLogMessages); + } + + [Fact] + public async Task SessionLogsCacheCommitException() { var sink = new TestSink( writeContext => @@ -651,6 +777,119 @@ namespace Microsoft.AspNetCore.Session Assert.Equal(LogLevel.Error, sessionMiddlewareLogMessage.LogLevel); } + [Fact] + public async Task SessionLogsCacheCommitTimeoutException() + { + var sink = new TestSink( + writeContext => + { + return writeContext.LoggerName.Equals(typeof(SessionMiddleware).FullName) + || writeContext.LoggerName.Equals(typeof(DistributedSession).FullName); + }, + beginScopeContext => + { + return beginScopeContext.LoggerName.Equals(typeof(SessionMiddleware).FullName) + || beginScopeContext.LoggerName.Equals(typeof(DistributedSession).FullName); + }); + var loggerFactory = new TestLoggerFactory(sink, enabled: true); + var builder = new WebHostBuilder() + .Configure(app => + { + app.UseSession(new SessionOptions() + { + IOTimeout = TimeSpan.FromSeconds(0.5) + }); + app.Run(context => + { + context.Session.SetInt32("key", 0); + return Task.FromResult(0); + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); + services.AddSingleton(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) + { + DelaySetAsync = true + }); + services.AddSession(); + }); + + using (var server = new TestServer(builder)) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + response.EnsureSuccessStatusCode(); + } + + var sessionLogMessages = sink.Writes.Where(message => message.LoggerName.Equals(typeof(DistributedSession).FullName, StringComparison.Ordinal)).ToList(); + + Assert.Contains("Session started", sessionLogMessages[0].State.ToString()); + Assert.Equal(LogLevel.Information, sessionLogMessages[0].LogLevel); + + Assert.Contains("Committing the session timed out.", sessionLogMessages[1].State.ToString()); + Assert.Equal(LogLevel.Warning, sessionLogMessages[1].LogLevel); + + var sessionMiddlewareLogs = sink.Writes.Where(message => message.LoggerName.Equals(typeof(SessionMiddleware).FullName, StringComparison.Ordinal)).ToList(); + + Assert.Contains("Committing the session was canceled.", sessionMiddlewareLogs[0].State.ToString()); + Assert.Equal(LogLevel.Information, sessionMiddlewareLogs[0].LogLevel); + } + + [Fact] + public async Task SessionLogsCacheCommitCanceledException() + { + var sink = new TestSink( + writeContext => + { + return writeContext.LoggerName.Equals(typeof(SessionMiddleware).FullName) + || writeContext.LoggerName.Equals(typeof(DistributedSession).FullName); + }, + beginScopeContext => + { + return beginScopeContext.LoggerName.Equals(typeof(SessionMiddleware).FullName) + || beginScopeContext.LoggerName.Equals(typeof(DistributedSession).FullName); + }); + var loggerFactory = new TestLoggerFactory(sink, enabled: true); + var builder = new WebHostBuilder() + .Configure(app => + { + app.UseSession(); + app.Run(async context => + { + context.Session.SetInt32("key", 0); + var cts = new CancellationTokenSource(); + var token = cts.Token; + cts.Cancel(); + await Assert.ThrowsAsync(() => context.Session.CommitAsync(token)); + context.RequestAborted = token; + }); + }) + .ConfigureServices(services => + { + services.AddSingleton(typeof(ILoggerFactory), loggerFactory); + services.AddSingleton(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) + { + DelaySetAsync = true + }); + services.AddSession(); + }); + + using (var server = new TestServer(builder)) + { + var client = server.CreateClient(); + var response = await client.GetAsync(string.Empty); + response.EnsureSuccessStatusCode(); + } + + Assert.Empty(sink.Writes.Where(message => message.LoggerName.Equals(typeof(DistributedSession).FullName, StringComparison.Ordinal))); + + var sessionMiddlewareLogs = sink.Writes.Where(message => message.LoggerName.Equals(typeof(SessionMiddleware).FullName, StringComparison.Ordinal)).ToList(); + + Assert.Contains("Committing the session was canceled.", sessionMiddlewareLogs[0].State.ToString()); + Assert.Equal(LogLevel.Information, sessionMiddlewareLogs[0].LogLevel); + } + [Fact] public async Task SessionLogsCacheRefreshException() { @@ -714,6 +953,9 @@ namespace Microsoft.AspNetCore.Session public bool DisableGet { get; set; } public bool DisableSetAsync { get; set; } public bool DisableRefreshAsync { get; set; } + public bool DelayGetAsync { get; set; } + public bool DelaySetAsync { get; set; } + public bool DelayRefreshAsync { get; set; } public UnreliableCache(IMemoryCache memoryCache) { @@ -728,25 +970,54 @@ namespace Microsoft.AspNetCore.Session } return _cache.Get(key); } - public Task GetAsync(string key, CancellationToken token = default(CancellationToken)) => _cache.GetAsync(key); + + public Task GetAsync(string key, CancellationToken token = default) + { + if (DisableGet) + { + throw new InvalidOperationException(); + } + if (DelayGetAsync) + { + token.WaitHandle.WaitOne(TimeSpan.FromSeconds(10)); + token.ThrowIfCancellationRequested(); + } + return _cache.GetAsync(key, token); + } + public void Refresh(string key) => _cache.Refresh(key); - public Task RefreshAsync(string key, CancellationToken token = default(CancellationToken)) + + public Task RefreshAsync(string key, CancellationToken token = default) { if (DisableRefreshAsync) { throw new InvalidOperationException(); } + if (DelayRefreshAsync) + { + token.WaitHandle.WaitOne(TimeSpan.FromSeconds(10)); + token.ThrowIfCancellationRequested(); + } return _cache.RefreshAsync(key); } + public void Remove(string key) => _cache.Remove(key); - public Task RemoveAsync(string key, CancellationToken token = default(CancellationToken)) => _cache.RemoveAsync(key); + + public Task RemoveAsync(string key, CancellationToken token = default) => _cache.RemoveAsync(key); + public void Set(string key, byte[] value, DistributedCacheEntryOptions options) => _cache.Set(key, value, options); - public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default(CancellationToken)) + + public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default) { if (DisableSetAsync) { throw new InvalidOperationException(); } + if (DelaySetAsync) + { + token.WaitHandle.WaitOne(TimeSpan.FromSeconds(10)); + token.ThrowIfCancellationRequested(); + } return _cache.SetAsync(key, value, options); } } From 8216ec9ad9d57031116893577b93bf063c8937d6 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 20 Sep 2017 13:23:48 -0700 Subject: [PATCH 241/295] Update bootstrappers --- .appveyor.yml | 4 +- build.cmd | 2 +- build.sh | 197 +------------------------------------- run.cmd | 2 + build.ps1 => run.ps1 | 56 +++++++---- run.sh | 223 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 266 insertions(+), 218 deletions(-) create mode 100644 run.cmd rename build.ps1 => run.ps1 (73%) create mode 100755 run.sh diff --git a/.appveyor.yml b/.appveyor.yml index 31efd8196f..46038786c9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,4 +1,4 @@ -init: +init: - git config --global core.autocrlf true branches: only: @@ -7,7 +7,7 @@ branches: - dev - /^(.*\/)?ci-.*$/ build_script: - - ps: .\build.ps1 + - ps: .\run.ps1 default-build clone_depth: 1 environment: global: diff --git a/build.cmd b/build.cmd index b6c8d24864..c0050bda12 100644 --- a/build.cmd +++ b/build.cmd @@ -1,2 +1,2 @@ @ECHO OFF -PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' default-build %*; exit $LASTEXITCODE" diff --git a/build.sh b/build.sh index 11cdbe5504..98a4b22765 100755 --- a/build.sh +++ b/build.sh @@ -1,199 +1,8 @@ #!/usr/bin/env bash set -euo pipefail - -# -# variables -# - -RESET="\033[0m" -RED="\033[0;31m" -MAGENTA="\033[0;95m" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet" -config_file="$DIR/version.xml" -verbose=false -update=false -repo_path="$DIR" -channel='' -tools_source='' -# -# Functions -# -__usage() { - echo "Usage: $(basename "${BASH_SOURCE[0]}") [options] [[--] ...]" - echo "" - echo "Arguments:" - echo " ... Arguments passed to MSBuild. Variable number of arguments allowed." - echo "" - echo "Options:" - echo " --verbose Show verbose output." - echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." - echo " --config-file TThe path to the configuration file that stores values. Defaults to version.xml." - echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." - echo " --path The directory to build. Defaults to the directory containing the script." - echo " -s|--tools-source The base url where build tools can be downloaded. Overrides the value from the config file." - echo " -u|--update Update to the latest KoreBuild even if the lock file is present." - echo "" - echo "Description:" - echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." - echo " When the lockfile is not present, KoreBuild will create one using latest available version from \$channel." - - if [[ "${1:-}" != '--no-exit' ]]; then - exit 2 - fi -} - -get_korebuild() { - local version - local lock_file="$repo_path/korebuild-lock.txt" - if [ ! -f "$lock_file" ] || [ "$update" = true ]; then - __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" - fi - version="$(grep 'version:*' -m 1 "$lock_file")" - if [[ "$version" == '' ]]; then - __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" - return 1 - fi - version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" - local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" - - { - if [ ! -d "$korebuild_path" ]; then - mkdir -p "$korebuild_path" - local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" - tmpfile="$(mktemp)" - echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" - if __get_remote_file "$remote_path" "$tmpfile"; then - unzip -q -d "$korebuild_path" "$tmpfile" - fi - rm "$tmpfile" || true - fi - - source "$korebuild_path/KoreBuild.sh" - } || { - if [ -d "$korebuild_path" ]; then - echo "Cleaning up after failed installation" - rm -rf "$korebuild_path" || true - fi - return 1 - } -} - -__error() { - echo -e "${RED}$*${RESET}" 1>&2 -} - -__machine_has() { - hash "$1" > /dev/null 2>&1 - return $? -} - -__get_remote_file() { - local remote_path=$1 - local local_path=$2 - - if [[ "$remote_path" != 'http'* ]]; then - cp "$remote_path" "$local_path" - return 0 - fi - - local failed=false - if __machine_has wget; then - wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true - else - failed=true - fi - - if [ "$failed" = true ] && __machine_has curl; then - failed=false - curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true - fi - - if [ "$failed" = true ]; then - __error "Download failed: $remote_path" 1>&2 - return 1 - fi -} - -__read_dom () { local IFS=\> ; read -r -d \< ENTITY CONTENT ;} - -# -# main -# - -while [[ $# -gt 0 ]]; do - case $1 in - -\?|-h|--help) - __usage --no-exit - exit 0 - ;; - -c|--channel|-Channel) - shift - channel="${1:-}" - [ -z "$channel" ] && __usage - ;; - --config-file|-ConfigFile) - shift - config_file="${1:-}" - [ -z "$config_file" ] && __usage - ;; - -d|--dotnet-home|-DotNetHome) - shift - DOTNET_HOME="${1:-}" - [ -z "$DOTNET_HOME" ] && __usage - ;; - --path|-Path) - shift - repo_path="${1:-}" - [ -z "$repo_path" ] && __usage - ;; - -s|--tools-source|-ToolsSource) - shift - tools_source="${1:-}" - [ -z "$tools_source" ] && __usage - ;; - -u|--update|-Update) - update=true - ;; - --verbose|-Verbose) - verbose=true - ;; - --) - shift - break - ;; - *) - break - ;; - esac - shift -done - -if ! __machine_has unzip; then - __error 'Missing required command: unzip' - exit 1 -fi - -if ! __machine_has curl && ! __machine_has wget; then - __error 'Missing required command. Either wget or curl is required.' - exit 1 -fi - -if [ -f "$config_file" ]; then - comment=false - while __read_dom; do - if [ "$comment" = true ]; then [[ $CONTENT == *'-->'* ]] && comment=false ; continue; fi - if [[ $ENTITY == '!--'* ]]; then comment=true; continue; fi - if [ -z "$channel" ] && [[ $ENTITY == "KoreBuildChannel" ]]; then channel=$CONTENT; fi - if [ -z "$tools_source" ] && [[ $ENTITY == "KoreBuildToolsSource" ]]; then tools_source=$CONTENT; fi - done < "$config_file" -fi - -[ -z "$channel" ] && channel='dev' -[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' - -get_korebuild -install_tools "$tools_source" "$DOTNET_HOME" -invoke_repository_build "$repo_path" "$@" +# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs) +chmod +x "$DIR/run.sh"; sync +"$DIR/run.sh" default-build "$@" diff --git a/run.cmd b/run.cmd new file mode 100644 index 0000000000..d52d5c7e68 --- /dev/null +++ b/run.cmd @@ -0,0 +1,2 @@ +@ECHO OFF +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' %*; exit $LASTEXITCODE" diff --git a/build.ps1 b/run.ps1 similarity index 73% rename from build.ps1 rename to run.ps1 index d5eb4d5cf2..49c2899856 100644 --- a/build.ps1 +++ b/run.ps1 @@ -3,10 +3,13 @@ <# .SYNOPSIS -Build this repository +Executes KoreBuild commands. .DESCRIPTION -Downloads korebuild if required. Then builds the repository. +Downloads korebuild if required. Then executes the KoreBuild command. To see available commands, execute with `-Command help`. + +.PARAMETER Command +The KoreBuild command to run. .PARAMETER Path The folder to build. Defaults to the folder containing this script. @@ -24,31 +27,32 @@ The base url where build tools can be downloaded. Overrides the value from the c Updates KoreBuild to the latest version even if a lock file is present. .PARAMETER ConfigFile -The path to the configuration file that stores values. Defaults to version.xml. +The path to the configuration file that stores values. Defaults to korebuild.json. -.PARAMETER MSBuildArgs -Arguments to be passed to MSBuild +.PARAMETER Arguments +Arguments to be passed to the command .NOTES This function will create a file $PSScriptRoot/korebuild-lock.txt. This lock file can be committed to source, but does not have to be. When the lockfile is not present, KoreBuild will create one using latest available version from $Channel. -The $ConfigFile is expected to be an XML file. It is optional, and the configuration values in it are optional as well. +The $ConfigFile is expected to be an JSON file. It is optional, and the configuration values in it are optional as well. Any options set +in the file are overridden by command line parameters. .EXAMPLE Example config file: -```xml - - - - dev - https://aspnetcore.blob.core.windows.net/buildtools - - +```json +{ + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", + "channel": "dev", + "toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools" +} ``` #> [CmdletBinding(PositionalBinding = $false)] param( + [Parameter(Mandatory=$true, Position = 0)] + [string]$Command, [string]$Path = $PSScriptRoot, [Alias('c')] [string]$Channel, @@ -58,9 +62,9 @@ param( [string]$ToolsSource, [Alias('u')] [switch]$Update, - [string]$ConfigFile = (Join-Path $PSScriptRoot 'version.xml'), + [string]$ConfigFile, [Parameter(ValueFromRemainingArguments = $true)] - [string[]]$MSBuildArgs + [string[]]$Arguments ) Set-StrictMode -Version 2 @@ -147,10 +151,20 @@ function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { # Load configuration or set defaults +$Path = Resolve-Path $Path +if (!$ConfigFile) { $ConfigFile = Join-Path $Path 'korebuild.json' } + if (Test-Path $ConfigFile) { - [xml] $config = Get-Content $ConfigFile - if (!($Channel)) { [string] $Channel = Select-Xml -Xml $config -XPath '/Project/PropertyGroup/KoreBuildChannel' } - if (!($ToolsSource)) { [string] $ToolsSource = Select-Xml -Xml $config -XPath '/Project/PropertyGroup/KoreBuildToolsSource' } + try { + $config = Get-Content -Raw -Encoding UTF8 -Path $ConfigFile | ConvertFrom-Json + if ($config) { + if (!($Channel) -and (Get-Member -Name 'channel' -InputObject $config)) { [string] $Channel = $config.channel } + if (!($ToolsSource) -and (Get-Member -Name 'toolsSource' -InputObject $config)) { [string] $ToolsSource = $config.toolsSource} + } + } catch { + Write-Warning "$ConfigFile could not be read. Its settings will be ignored." + Write-Warning $Error[0] + } } if (!$DotNetHome) { @@ -169,8 +183,8 @@ $korebuildPath = Get-KoreBuild Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1') try { - Install-Tools $ToolsSource $DotNetHome - Invoke-RepositoryBuild $Path @MSBuildArgs + Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $Path -ConfigFile $ConfigFile + Invoke-KoreBuildCommand $Command @Arguments } finally { Remove-Module 'KoreBuild' -ErrorAction Ignore diff --git a/run.sh b/run.sh new file mode 100755 index 0000000000..c278423acc --- /dev/null +++ b/run.sh @@ -0,0 +1,223 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# +# variables +# + +RESET="\033[0m" +RED="\033[0;31m" +YELLOW="\033[0;33m" +MAGENTA="\033[0;95m" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet" +verbose=false +update=false +repo_path="$DIR" +channel='' +tools_source='' + +# +# Functions +# +__usage() { + echo "Usage: $(basename "${BASH_SOURCE[0]}") command [options] [[--] ...]" + echo "" + echo "Arguments:" + echo " command The command to be run." + echo " ... Arguments passed to the command. Variable number of arguments allowed." + echo "" + echo "Options:" + echo " --verbose Show verbose output." + echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." + echo " --config-file The path to the configuration file that stores values. Defaults to korebuild.json." + echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." + echo " --path The directory to build. Defaults to the directory containing the script." + echo " -s|--tools-source|-ToolsSource The base url where build tools can be downloaded. Overrides the value from the config file." + echo " -u|--update Update to the latest KoreBuild even if the lock file is present." + echo "" + echo "Description:" + echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." + echo " When the lockfile is not present, KoreBuild will create one using latest available version from \$channel." + + if [[ "${1:-}" != '--no-exit' ]]; then + exit 2 + fi +} + +get_korebuild() { + local version + local lock_file="$repo_path/korebuild-lock.txt" + if [ ! -f "$lock_file" ] || [ "$update" = true ]; then + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" + fi + version="$(grep 'version:*' -m 1 "$lock_file")" + if [[ "$version" == '' ]]; then + __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" + return 1 + fi + version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" + + { + if [ ! -d "$korebuild_path" ]; then + mkdir -p "$korebuild_path" + local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" + tmpfile="$(mktemp)" + echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" + if __get_remote_file "$remote_path" "$tmpfile"; then + unzip -q -d "$korebuild_path" "$tmpfile" + fi + rm "$tmpfile" || true + fi + + source "$korebuild_path/KoreBuild.sh" + } || { + if [ -d "$korebuild_path" ]; then + echo "Cleaning up after failed installation" + rm -rf "$korebuild_path" || true + fi + return 1 + } +} + +__error() { + echo -e "${RED}error: $*${RESET}" 1>&2 +} + +__warn() { + echo -e "${YELLOW}warning: $*${RESET}" +} + +__machine_has() { + hash "$1" > /dev/null 2>&1 + return $? +} + +__get_remote_file() { + local remote_path=$1 + local local_path=$2 + + if [[ "$remote_path" != 'http'* ]]; then + cp "$remote_path" "$local_path" + return 0 + fi + + local failed=false + if __machine_has wget; then + wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true + else + failed=true + fi + + if [ "$failed" = true ] && __machine_has curl; then + failed=false + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true + fi + + if [ "$failed" = true ]; then + __error "Download failed: $remote_path" 1>&2 + return 1 + fi +} + +# +# main +# + +command="${1:-}" +shift + +while [[ $# -gt 0 ]]; do + case $1 in + -\?|-h|--help) + __usage --no-exit + exit 0 + ;; + -c|--channel|-Channel) + shift + channel="${1:-}" + [ -z "$channel" ] && __usage + ;; + --config-file|-ConfigFile) + shift + config_file="${1:-}" + [ -z "$config_file" ] && __usage + if [ ! -f "$config_file" ]; then + __error "Invalid value for --config-file. $config_file does not exist." + exit 1 + fi + ;; + -d|--dotnet-home|-DotNetHome) + shift + DOTNET_HOME="${1:-}" + [ -z "$DOTNET_HOME" ] && __usage + ;; + --path|-Path) + shift + repo_path="${1:-}" + [ -z "$repo_path" ] && __usage + ;; + -s|--tools-source|-ToolsSource) + shift + tools_source="${1:-}" + [ -z "$tools_source" ] && __usage + ;; + -u|--update|-Update) + update=true + ;; + --verbose|-Verbose) + verbose=true + ;; + --) + shift + break + ;; + *) + break + ;; + esac + shift +done + +if ! __machine_has unzip; then + __error 'Missing required command: unzip' + exit 1 +fi + +if ! __machine_has curl && ! __machine_has wget; then + __error 'Missing required command. Either wget or curl is required.' + exit 1 +fi + +[ -z "${config_file:-}" ] && config_file="$repo_path/korebuild.json" +if [ -f "$config_file" ]; then + if __machine_has jq ; then + if jq '.' "$config_file" >/dev/null ; then + config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")" + config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")" + else + __warn "$config_file is invalid JSON. Its settings will be ignored." + fi + elif __machine_has python ; then + if python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'))" >/dev/null ; then + config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")" + config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")" + else + __warn "$config_file is invalid JSON. Its settings will be ignored." + fi + else + __warn 'Missing required command: jq or pyton. Could not parse the JSON file. Its settings will be ignored.' + fi + + [ ! -z "${config_channel:-}" ] && channel="$config_channel" + [ ! -z "${config_tools_source:-}" ] && tools_source="$config_tools_source" +fi + +[ -z "$channel" ] && channel='dev' +[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' + +get_korebuild +set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$repo_path" "$config_file" +invoke_korebuild_command "$command" "$@" From a29e7cf687fef67e403f9909632e61fce4a7dbaa Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Mon, 16 Oct 2017 12:52:57 -0700 Subject: [PATCH 242/295] Add RepositoryRoot --- Directory.Build.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 6ce4a74c9b..90f0d4e96b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,10 +1,11 @@ - + Microsoft ASP.NET Core https://github.com/aspnet/Session git + $(MSBuildThisFileDirectory) $(MSBuildThisFileDirectory)build\Key.snk true true From f7f89cdf8f313346841974a827d12b0f899c4d96 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 1 Nov 2017 16:45:58 -0700 Subject: [PATCH 243/295] Pin tool and package versions to make builds more repeatable Part of aspnet/Universe#575 --- .gitignore | 1 - Directory.Build.props | 6 ++--- Directory.Build.targets | 17 +++--------- NuGet.config | 1 + build/dependencies.props | 26 +++++++++++++++++++ build/repo.props | 9 ++++--- korebuild-lock.txt | 2 ++ korebuild.json | 4 +++ samples/SessionSample/SessionSample.csproj | 12 ++++----- src/Directory.Build.props | 2 +- .../Microsoft.AspNetCore.Session.csproj | 10 +++---- test/Directory.Build.props | 2 +- .../Microsoft.AspNetCore.Session.Tests.csproj | 12 ++++----- version.props | 10 +++++++ version.xml | 8 ------ 15 files changed, 74 insertions(+), 48 deletions(-) create mode 100644 build/dependencies.props create mode 100644 korebuild-lock.txt create mode 100644 korebuild.json create mode 100644 version.props delete mode 100644 version.xml diff --git a/.gitignore b/.gitignore index a266b414e8..f332e76e0f 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,3 @@ project.lock.json .testPublish/ launchSettings.json global.json -korebuild-lock.txt diff --git a/Directory.Build.props b/Directory.Build.props index 90f0d4e96b..8e3fa70ef4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,6 @@ - - + + + Microsoft ASP.NET Core @@ -9,7 +10,6 @@ $(MSBuildThisFileDirectory)build\Key.snk true true - $(VersionSuffix)-$(BuildNumber) true diff --git a/Directory.Build.targets b/Directory.Build.targets index bc118fd907..e83ff95e39 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,14 +1,5 @@ - - - - <_BootstrapperFile Condition=" $([MSBuild]::IsOSUnixLike()) ">build.sh - <_BootstrapperFile Condition="! $([MSBuild]::IsOSUnixLike()) ">build.cmd - <_BootstrapperError> - Package references have not been pinned. Run './$(_BootstrapperFile) /t:Pin'. - Also, you can run './$(_BootstrapperFile) /t:Restore' which will pin *and* restore packages. '$(_BootstrapperFile)' can be found in '$(MSBuildThisFileDirectory)'. - - - - - + + + $(MicrosoftNETCoreApp20PackageVersion) + diff --git a/NuGet.config b/NuGet.config index 20060c934e..4e8a1f6de1 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,6 +3,7 @@ + diff --git a/build/dependencies.props b/build/dependencies.props new file mode 100644 index 0000000000..2f11580ad0 --- /dev/null +++ b/build/dependencies.props @@ -0,0 +1,26 @@ + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + 2.1.0-preview1-15550 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.1.0-preview1-27498 + 2.0.0 + 15.3.0 + 2.3.0 + 2.3.0 + + + diff --git a/build/repo.props b/build/repo.props index 13fe1c296a..b55e651b87 100644 --- a/build/repo.props +++ b/build/repo.props @@ -1,6 +1,7 @@  - - - - + + + Internal.AspNetCore.Universe.Lineup + https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json + diff --git a/korebuild-lock.txt b/korebuild-lock.txt new file mode 100644 index 0000000000..36d8056037 --- /dev/null +++ b/korebuild-lock.txt @@ -0,0 +1,2 @@ +version:2.1.0-preview1-15550 +commithash:0dd080d0d87b4d1966ec0af9961dc8bacc04f84f diff --git a/korebuild.json b/korebuild.json new file mode 100644 index 0000000000..bd5d51a51b --- /dev/null +++ b/korebuild.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", + "channel": "dev" +} diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj index bda14213e6..45d8e2aeb9 100644 --- a/samples/SessionSample/SessionSample.csproj +++ b/samples/SessionSample/SessionSample.csproj @@ -9,12 +9,12 @@ - - - - - - + + + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 9d9a3de33a..1e0980f663 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,6 +2,6 @@ - + diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj index c70952b298..3da00b9032 100644 --- a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj +++ b/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj @@ -10,11 +10,11 @@ - - - - - + + + + + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 9d9a3de33a..1e0980f663 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -2,6 +2,6 @@ - + diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index 26e421c10e..0c5c3ed1cd 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + diff --git a/version.props b/version.props new file mode 100644 index 0000000000..5c4a7c32d1 --- /dev/null +++ b/version.props @@ -0,0 +1,10 @@ + + + 2.1.0 + preview1 + $(VersionPrefix) + $(VersionPrefix)-$(VersionSuffix)-final + t000 + $(VersionSuffix)-$(BuildNumber) + + diff --git a/version.xml b/version.xml deleted file mode 100644 index 3c05022b7d..0000000000 --- a/version.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - dev - 2.1.0 - preview1 - - From d4cea8fcf55eead49af2ebf5a204448b587c2741 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 16 Nov 2017 10:00:38 -0800 Subject: [PATCH 244/295] Update samples and tests to target netcoreapp2.1 --- Directory.Build.props | 4 ++++ korebuild-lock.txt | 4 ++-- samples/SessionSample/SessionSample.csproj | 2 +- test/Directory.Build.props | 7 +++++++ .../Microsoft.AspNetCore.Session.Tests.csproj | 3 +-- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 8e3fa70ef4..6f86c453d9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,4 +1,8 @@  + + diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 36d8056037..5cdc53f7d7 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15550 -commithash:0dd080d0d87b4d1966ec0af9961dc8bacc04f84f +version:2.1.0-preview1-15568 +commithash:82f311cb5d46ba3ff64b6c27ea6e7300e6c57299 diff --git a/samples/SessionSample/SessionSample.csproj b/samples/SessionSample/SessionSample.csproj index 45d8e2aeb9..67abefae09 100644 --- a/samples/SessionSample/SessionSample.csproj +++ b/samples/SessionSample/SessionSample.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;net461 + netcoreapp2.1;net461 diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 1e0980f663..270e1fa209 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -1,6 +1,13 @@  + + netcoreapp2.1 + $(DeveloperBuildTestTfms) + netcoreapp2.1;netcoreapp2.0 + $(StandardTestTfms);net461 + + diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj index 0c5c3ed1cd..9dc11b9d2f 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ b/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj @@ -1,8 +1,7 @@  - netcoreapp2.0;net461 - netcoreapp2.0 + $(StandardTestTfms) true true From 5c945a87e6c0ce0ce46485c795b2111cf8787a64 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 17 Nov 2017 13:00:26 -0800 Subject: [PATCH 245/295] Use MicrosoftNETCoreApp21PackageVersion to determine the runtime framework in netcoreapp2.1 --- Directory.Build.targets | 1 + build/dependencies.props | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index e83ff95e39..894b1d0cf8 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,5 +1,6 @@  $(MicrosoftNETCoreApp20PackageVersion) + $(MicrosoftNETCoreApp21PackageVersion) diff --git a/build/dependencies.props b/build/dependencies.props index 2f11580ad0..11c97146ef 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,4 +1,4 @@ - + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) @@ -18,6 +18,7 @@ 2.1.0-preview1-27498 2.1.0-preview1-27498 2.0.0 + 2.1.0-preview1-25907-02 15.3.0 2.3.0 2.3.0 From 91412f2d2070ebe9b64d52bb2f7b46c78e4b0cd5 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 20 Nov 2017 12:18:38 -0800 Subject: [PATCH 246/295] Use MSBuild to set NuGet feeds instead of NuGet.config --- Directory.Build.props | 1 + NuGet.config | 4 +--- build/sources.props | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 build/sources.props diff --git a/Directory.Build.props b/Directory.Build.props index 6f86c453d9..c2790fd6a6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,6 +5,7 @@ + Microsoft ASP.NET Core diff --git a/NuGet.config b/NuGet.config index 4e8a1f6de1..e32bddfd51 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,8 +2,6 @@ - - - + diff --git a/build/sources.props b/build/sources.props new file mode 100644 index 0000000000..c03f3ddb60 --- /dev/null +++ b/build/sources.props @@ -0,0 +1,16 @@ + + + + + $(DotNetRestoreSources) + + $(RestoreSources); + https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json; + https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; + + + $(RestoreSources); + https://api.nuget.org/v3/index.json; + + + From 2b7fc1f93a4850248b813229f1bf0ae27c7c578e Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 21 Nov 2017 15:49:00 -0800 Subject: [PATCH 247/295] Replace aspnetcore-ci-dev feed with aspnetcore-dev --- build/dependencies.props | 30 +++++++++++++++--------------- build/repo.props | 2 +- build/sources.props | 2 +- korebuild-lock.txt | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 11c97146ef..89649eb816 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,22 +1,22 @@ - + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15550 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 - 2.1.0-preview1-27498 + 2.1.0-preview1-15576 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 + 2.1.0-preview1-27644 2.0.0 2.1.0-preview1-25907-02 15.3.0 diff --git a/build/repo.props b/build/repo.props index b55e651b87..07c5f08325 100644 --- a/build/repo.props +++ b/build/repo.props @@ -2,6 +2,6 @@ Internal.AspNetCore.Universe.Lineup - https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json + https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json diff --git a/build/sources.props b/build/sources.props index c03f3ddb60..9feff29d09 100644 --- a/build/sources.props +++ b/build/sources.props @@ -5,7 +5,7 @@ $(DotNetRestoreSources) $(RestoreSources); - https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json; + https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json; https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 5cdc53f7d7..1a99066b7c 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15568 -commithash:82f311cb5d46ba3ff64b6c27ea6e7300e6c57299 +version:2.1.0-preview1-15576 +commithash:2f3856d2ba4f659fcb9253215b83946a06794a27 From 0f8eadd175b93399e757ce97e87e295aff126b7b Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 29 Nov 2017 14:09:30 -0800 Subject: [PATCH 248/295] Specify runtime versions to install --- build/repo.props | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/repo.props b/build/repo.props index 07c5f08325..78b0ce5879 100644 --- a/build/repo.props +++ b/build/repo.props @@ -1,7 +1,14 @@  + + Internal.AspNetCore.Universe.Lineup https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json + + + + + From d96c60ea3ca2fb00cc1d997c41e2da2cc9e5a0f1 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 1 Dec 2017 10:27:30 -0800 Subject: [PATCH 249/295] Update bootstrappers --- run.ps1 | 17 +++++++++++------ run.sh | 30 +++++++++++++++++++----------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/run.ps1 b/run.ps1 index 49c2899856..27dcf848f8 100644 --- a/run.ps1 +++ b/run.ps1 @@ -29,6 +29,9 @@ Updates KoreBuild to the latest version even if a lock file is present. .PARAMETER ConfigFile The path to the configuration file that stores values. Defaults to korebuild.json. +.PARAMETER ToolsSourceSuffix +The Suffix to append to the end of the ToolsSource. Useful for query strings in blob stores. + .PARAMETER Arguments Arguments to be passed to the command @@ -51,7 +54,7 @@ Example config file: #> [CmdletBinding(PositionalBinding = $false)] param( - [Parameter(Mandatory=$true, Position = 0)] + [Parameter(Mandatory = $true, Position = 0)] [string]$Command, [string]$Path = $PSScriptRoot, [Alias('c')] @@ -63,6 +66,7 @@ param( [Alias('u')] [switch]$Update, [string]$ConfigFile, + [string]$ToolsSourceSuffix, [Parameter(ValueFromRemainingArguments = $true)] [string[]]$Arguments ) @@ -79,7 +83,7 @@ function Get-KoreBuild { $lockFile = Join-Path $Path 'korebuild-lock.txt' if (!(Test-Path $lockFile) -or $Update) { - Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile + Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile $ToolsSourceSuffix } $version = Get-Content $lockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1 @@ -96,7 +100,7 @@ function Get-KoreBuild { try { $tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip" - Get-RemoteFile $remotePath $tmpfile + Get-RemoteFile $remotePath $tmpfile $ToolsSourceSuffix if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) { # Use built-in commands where possible as they are cross-plat compatible Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath @@ -124,7 +128,7 @@ function Join-Paths([string]$path, [string[]]$childPaths) { return $path } -function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { +function Get-RemoteFile([string]$RemotePath, [string]$LocalPath, [string]$RemoteSuffix) { if ($RemotePath -notlike 'http*') { Copy-Item $RemotePath $LocalPath return @@ -134,7 +138,7 @@ function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { while ($retries -gt 0) { $retries -= 1 try { - Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath + Invoke-WebRequest -UseBasicParsing -Uri $($RemotePath + $RemoteSuffix) -OutFile $LocalPath return } catch { @@ -161,7 +165,8 @@ if (Test-Path $ConfigFile) { if (!($Channel) -and (Get-Member -Name 'channel' -InputObject $config)) { [string] $Channel = $config.channel } if (!($ToolsSource) -and (Get-Member -Name 'toolsSource' -InputObject $config)) { [string] $ToolsSource = $config.toolsSource} } - } catch { + } + catch { Write-Warning "$ConfigFile could not be read. Its settings will be ignored." Write-Warning $Error[0] } diff --git a/run.sh b/run.sh index c278423acc..834961fc3a 100755 --- a/run.sh +++ b/run.sh @@ -17,6 +17,7 @@ update=false repo_path="$DIR" channel='' tools_source='' +tools_source_suffix='' # # Functions @@ -29,13 +30,14 @@ __usage() { echo " ... Arguments passed to the command. Variable number of arguments allowed." echo "" echo "Options:" - echo " --verbose Show verbose output." - echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." - echo " --config-file The path to the configuration file that stores values. Defaults to korebuild.json." - echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." - echo " --path The directory to build. Defaults to the directory containing the script." - echo " -s|--tools-source|-ToolsSource The base url where build tools can be downloaded. Overrides the value from the config file." - echo " -u|--update Update to the latest KoreBuild even if the lock file is present." + echo " --verbose Show verbose output." + echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." + echo " --config-file The path to the configuration file that stores values. Defaults to korebuild.json." + echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." + echo " --path The directory to build. Defaults to the directory containing the script." + echo " -s|--tools-source|-ToolsSource The base url where build tools can be downloaded. Overrides the value from the config file." + echo " --tools-source-suffix|-ToolsSourceSuffix The suffix to append to tools-source. Useful for query strings." + echo " -u|--update Update to the latest KoreBuild even if the lock file is present." echo "" echo "Description:" echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." @@ -50,7 +52,7 @@ get_korebuild() { local version local lock_file="$repo_path/korebuild-lock.txt" if [ ! -f "$lock_file" ] || [ "$update" = true ]; then - __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" "$tools_source_suffix" fi version="$(grep 'version:*' -m 1 "$lock_file")" if [[ "$version" == '' ]]; then @@ -66,7 +68,7 @@ get_korebuild() { local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" tmpfile="$(mktemp)" echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" - if __get_remote_file "$remote_path" "$tmpfile"; then + if __get_remote_file "$remote_path" "$tmpfile" "$tools_source_suffix"; then unzip -q -d "$korebuild_path" "$tmpfile" fi rm "$tmpfile" || true @@ -98,6 +100,7 @@ __machine_has() { __get_remote_file() { local remote_path=$1 local local_path=$2 + local remote_path_suffix=$3 if [[ "$remote_path" != 'http'* ]]; then cp "$remote_path" "$local_path" @@ -106,14 +109,14 @@ __get_remote_file() { local failed=false if __machine_has wget; then - wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true + wget --tries 10 --quiet -O "$local_path" "${remote_path}${remote_path_suffix}" || failed=true else failed=true fi if [ "$failed" = true ] && __machine_has curl; then failed=false - curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "${remote_path}${remote_path_suffix}" || failed=true fi if [ "$failed" = true ]; then @@ -164,6 +167,11 @@ while [[ $# -gt 0 ]]; do tools_source="${1:-}" [ -z "$tools_source" ] && __usage ;; + --tools-source-suffix|-ToolsSourceSuffix) + shift + tools_source_suffix="${1:-}" + [ -z "$tools_source_suffix" ] && __usage + ;; -u|--update|-Update) update=true ;; From 955bd076517907326b1e1969a2540d72d019e054 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 10 Dec 2017 13:53:44 -0800 Subject: [PATCH 250/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 34 +++++++++++++++++----------------- korebuild-lock.txt | 4 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 89649eb816..4b27c855d9 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,25 +3,25 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15576 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 - 2.1.0-preview1-27644 + 2.1.0-preview1-15618 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 + 2.1.0-preview1-27773 2.0.0 - 2.1.0-preview1-25907-02 + 2.1.0-preview1-25915-01 15.3.0 - 2.3.0 - 2.3.0 + 2.3.1 + 2.3.1 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 1a99066b7c..e7cce93009 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15576 -commithash:2f3856d2ba4f659fcb9253215b83946a06794a27 +version:2.1.0-preview1-15618 +commithash:00ce1383114015fe89b221146036e59e6bc11219 From 49e6920a7caa096997432240777af609e78acb9d Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Wed, 13 Dec 2017 21:47:25 +0000 Subject: [PATCH 251/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 4b27c855d9..02a54d8037 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15618 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 - 2.1.0-preview1-27773 + 2.1.0-preview1-15626 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 + 2.1.0-preview1-27807 2.0.0 - 2.1.0-preview1-25915-01 + 2.1.0-preview1-26008-01 15.3.0 2.3.1 2.3.1 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index e7cce93009..8d52a6128c 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15618 -commithash:00ce1383114015fe89b221146036e59e6bc11219 +version:2.1.0-preview1-15626 +commithash:fd6410e9c90c428bc01238372303ad09cb9ec889 From 7c36b192d7a169e0d232475a937bca7aabb24caa Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Mon, 18 Dec 2017 18:01:23 -0800 Subject: [PATCH 252/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 02a54d8037..13c7acdaee 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,21 +4,21 @@ 2.1.0-preview1-15626 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 - 2.1.0-preview1-27807 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 + 2.1.0-preview1-27849 2.0.0 - 2.1.0-preview1-26008-01 + 2.1.0-preview1-26016-05 15.3.0 2.3.1 2.3.1 From bddb50b7f216a82517c23f7980f6cf0c01d4b97e Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 31 Dec 2017 22:03:41 +0000 Subject: [PATCH 253/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 28 ++++++++++++++-------------- korebuild-lock.txt | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 13c7acdaee..299bad9726 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,20 +3,20 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15626 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 - 2.1.0-preview1-27849 + 2.1.0-preview1-15651 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 + 2.1.0-preview1-27942 2.0.0 2.1.0-preview1-26016-05 15.3.0 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 8d52a6128c..7c2e97aa79 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15626 -commithash:fd6410e9c90c428bc01238372303ad09cb9ec889 +version:2.1.0-preview1-15651 +commithash:ebf2365121c2c6a6a0fbfa9b0f37bb5effc89323 From a49c9f51e7646fd85fb456cf9c53a0c1650a017b Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Tue, 2 Jan 2018 14:28:36 -0800 Subject: [PATCH 254/295] Create ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..101a084f0a --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,3 @@ +THIS ISSUE TRACKER IS CLOSED - please log new issues here: https://github.com/aspnet/Home/issues + +For information about this change, see https://github.com/aspnet/Announcements/issues/283 From b68a9c62c78c46b23bc6f845b17b31a460b4ba5e Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Thu, 4 Jan 2018 02:11:24 +0000 Subject: [PATCH 255/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 299bad9726..5b8808e996 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,19 +4,19 @@ 2.1.0-preview1-15651 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 - 2.1.0-preview1-27942 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 + 2.1.0-preview1-27965 2.0.0 2.1.0-preview1-26016-05 15.3.0 From 0652fbcfa8b4b924ccb74c2c9a921ec8811b772a Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sat, 6 Jan 2018 15:36:49 -0800 Subject: [PATCH 256/295] Update dependencies.props [auto-updated: dependencies] --- korebuild-lock.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 7c2e97aa79..2146d006d7 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15651 -commithash:ebf2365121c2c6a6a0fbfa9b0f37bb5effc89323 +version:2.1.0-preview1-15661 +commithash:c9349d4c8a495d3085d9b879214d80f2f45e2193 From d34600a1d3e6f734671afa0e600777475a328fab Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 23 Jan 2018 15:32:58 -0800 Subject: [PATCH 257/295] Branching for 2.1.0-preview1 --- build/dependencies.props | 30 +++++++++++++++--------------- build/repo.props | 4 ++-- build/sources.props | 4 ++-- korebuild-lock.txt | 4 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 5b8808e996..9cd3f89e6b 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15651 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 + 2.1.0-preview1-15679 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 + 2.1.0-preview1-28153 2.0.0 - 2.1.0-preview1-26016-05 + 2.1.0-preview1-26115-03 15.3.0 2.3.1 2.3.1 diff --git a/build/repo.props b/build/repo.props index 78b0ce5879..d94ff7d00d 100644 --- a/build/repo.props +++ b/build/repo.props @@ -1,10 +1,10 @@ - + Internal.AspNetCore.Universe.Lineup - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json + https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json diff --git a/build/sources.props b/build/sources.props index 9feff29d09..5d66393335 100644 --- a/build/sources.props +++ b/build/sources.props @@ -1,11 +1,11 @@ - + $(DotNetRestoreSources) $(RestoreSources); - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json; + https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json; https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 2146d006d7..a474bc0e35 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15661 -commithash:c9349d4c8a495d3085d9b879214d80f2f45e2193 +version:2.1.0-preview1-15679 +commithash:5347461137cb45a77ddcc0b55b2478092de43338 From bedf5a55f787b58f4b21f51fd758a4621e1fed97 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 24 Jan 2018 15:00:29 -0800 Subject: [PATCH 258/295] Updating version to preview2 --- version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.props b/version.props index 5c4a7c32d1..370d5ababd 100644 --- a/version.props +++ b/version.props @@ -1,7 +1,7 @@ 2.1.0 - preview1 + preview2 $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final t000 From 6d15dcf1ca4a9f34d7d70dd6de08fde11b0a6cdd Mon Sep 17 00:00:00 2001 From: "Chris Ross (ASP.NET)" Date: Fri, 26 Jan 2018 12:16:25 -0800 Subject: [PATCH 259/295] Use TryAdd for ISessionStore service #2755 --- .../SessionServiceCollectionExtensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs index 48424e48cd..628390fbe3 100644 --- a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs @@ -4,6 +4,7 @@ using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Session; +using Microsoft.Extensions.DependencyInjection.Extensions; namespace Microsoft.Extensions.DependencyInjection { @@ -24,7 +25,7 @@ namespace Microsoft.Extensions.DependencyInjection throw new ArgumentNullException(nameof(services)); } - services.AddTransient(); + services.TryAddTransient(); services.AddDataProtection(); return services; } From 6e122c45b4319437892ece588625badf111069ca Mon Sep 17 00:00:00 2001 From: "Chris Ross (ASP.NET)" Date: Mon, 29 Jan 2018 12:50:17 -0800 Subject: [PATCH 260/295] Mark cookie as non-essential. Home#2393 --- src/Microsoft.AspNetCore.Session/SessionOptions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Microsoft.AspNetCore.Session/SessionOptions.cs b/src/Microsoft.AspNetCore.Session/SessionOptions.cs index 9c9856f481..4d456b0f60 100644 --- a/src/Microsoft.AspNetCore.Session/SessionOptions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionOptions.cs @@ -22,6 +22,7 @@ namespace Microsoft.AspNetCore.Builder /// defaults to . /// defaults to . /// defaults to true + /// defaults to false /// /// public CookieBuilder Cookie @@ -111,6 +112,8 @@ namespace Microsoft.AspNetCore.Builder SecurePolicy = CookieSecurePolicy.None; SameSite = SameSiteMode.Lax; HttpOnly = true; + // Session is considered non-essential as it's designed for ephemeral data. + IsEssential = false; } public override TimeSpan? Expiration From 130b3e7e5850f2ca67183c982492556fd1ece471 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 31 Jan 2018 15:01:13 -0800 Subject: [PATCH 261/295] Update dependencies.props to 2.1.0-preview-28193, build tools to 2.1.0-preview1-1010 [ci skip] Scripted changes: - updated travis and appveyor.yml files to only build dev, ci, and release branches - updated dependencies.props - updated korebuild-lock.txt - updated korebuild.json to release/2.1 channel --- .appveyor.yml | 15 +++++++-------- .travis.yml | 23 ++++++++++++----------- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- korebuild.json | 4 ++-- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 46038786c9..4eea96ab69 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,18 +1,17 @@ init: - - git config --global core.autocrlf true +- git config --global core.autocrlf true branches: only: - - master - - release - - dev - - /^(.*\/)?ci-.*$/ + - dev + - /^release\/.*$/ + - /^(.*\/)?ci-.*$/ build_script: - - ps: .\run.ps1 default-build +- ps: .\run.ps1 default-build clone_depth: 1 environment: global: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: 1 -test: off -deploy: off +test: 'off' +deploy: 'off' os: Visual Studio 2017 diff --git a/.travis.yml b/.travis.yml index b10be14215..64bdbb4441 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,24 +3,25 @@ sudo: false dist: trusty env: global: - - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - - DOTNET_CLI_TELEMETRY_OPTOUT: 1 + - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + - DOTNET_CLI_TELEMETRY_OPTOUT: 1 mono: none os: - - linux - - osx +- linux +- osx osx_image: xcode8.2 addons: apt: packages: - - libunwind8 + - libunwind8 branches: only: - - master - - release - - dev - - /^(.*\/)?ci-.*$/ + - dev + - /^release\/.*$/ + - /^(.*\/)?ci-.*$/ before_install: - - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi +- if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s + /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib + /usr/local/lib/; fi script: - - ./build.sh +- ./build.sh diff --git a/build/dependencies.props b/build/dependencies.props index 9cd3f89e6b..825770ab94 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15679 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 + 2.1.0-preview1-1010 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 2.0.0 - 2.1.0-preview1-26115-03 + 2.1.0-preview1-26122-01 15.3.0 2.3.1 2.3.1 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index a474bc0e35..851bfbf203 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15679 -commithash:5347461137cb45a77ddcc0b55b2478092de43338 +version:2.1.0-preview1-1010 +commithash:75ca924dfbd673c38841025b04c4dcd93b84f56d diff --git a/korebuild.json b/korebuild.json index bd5d51a51b..678d8bb948 100644 --- a/korebuild.json +++ b/korebuild.json @@ -1,4 +1,4 @@ { - "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", - "channel": "dev" + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/release/2.1/tools/korebuild.schema.json", + "channel": "release/2.1" } From 9bb126eaa2d0c7234dc0e41d0f0bde1e4bb4f892 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Thu, 1 Feb 2018 04:35:42 +0000 Subject: [PATCH 262/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 5b8808e996..4e2771dffe 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview1-15651 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 - 2.1.0-preview1-27965 + 2.1.0-preview2-15692 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 + 2.1.0-preview2-28215 2.0.0 - 2.1.0-preview1-26016-05 + 2.1.0-preview2-26130-04 15.3.0 2.3.1 2.3.1 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 2146d006d7..232cb858c2 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15661 -commithash:c9349d4c8a495d3085d9b879214d80f2f45e2193 +version:2.1.0-preview2-15692 +commithash:5d9f445ce3f8492451a6f461df7e739bbed6a7f8 From 182c610c30406480603d66bdb28d5d45c1d67554 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sat, 3 Feb 2018 03:04:06 +0000 Subject: [PATCH 263/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 28 ++++++++++++++-------------- korebuild-lock.txt | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 4e2771dffe..807a4b78e2 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,20 +3,20 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview2-15692 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 - 2.1.0-preview2-28215 + 2.1.0-preview2-15694 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 + 2.1.0-preview2-30020 2.0.0 2.1.0-preview2-26130-04 15.3.0 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 232cb858c2..6f294ef0e6 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview2-15692 -commithash:5d9f445ce3f8492451a6f461df7e739bbed6a7f8 +version:2.1.0-preview2-15694 +commithash:f61af02b48e89592c9aadb7ebaebe84228666c3b From c0d524e19199b7a63d2fede5fcb0946ee4202b4e Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Fri, 9 Feb 2018 12:01:20 -0800 Subject: [PATCH 264/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 28 ++++++++++++++-------------- korebuild-lock.txt | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 807a4b78e2..9cece0f70d 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,20 +3,20 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview2-15694 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 - 2.1.0-preview2-30020 + 2.1.0-preview2-15698 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 + 2.1.0-preview2-30066 2.0.0 2.1.0-preview2-26130-04 15.3.0 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 6f294ef0e6..3e2b56b91b 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview2-15694 -commithash:f61af02b48e89592c9aadb7ebaebe84228666c3b +version:2.1.0-preview2-15698 +commithash:7216e5068cb1957e09d45fcbe58a744dd5c2de73 From 9a1191e22eb2d3b91c90ca98d8b8f95b9d17c239 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 11 Feb 2018 12:41:55 -0800 Subject: [PATCH 265/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 9cece0f70d..7231d85b72 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,24 +4,24 @@ 2.1.0-preview2-15698 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 - 2.1.0-preview2-30066 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 + 2.1.0-preview2-30077 2.0.0 2.1.0-preview2-26130-04 15.3.0 2.3.1 - 2.3.1 + 2.4.0-beta.1.build3945 From 8efcaf89f315b115891deedc241dd98b54c289e6 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 18 Feb 2018 12:32:27 -0800 Subject: [PATCH 266/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 28 ++++++++++++++-------------- korebuild-lock.txt | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 7231d85b72..017c2534be 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,20 +3,20 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview2-15698 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 - 2.1.0-preview2-30077 + 2.1.0-preview2-15707 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 + 2.1.0-preview2-30131 2.0.0 2.1.0-preview2-26130-04 15.3.0 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 3e2b56b91b..89d0ad3d15 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview2-15698 -commithash:7216e5068cb1957e09d45fcbe58a744dd5c2de73 +version:2.1.0-preview2-15707 +commithash:e74e53f129ab34332947fea7ac7b7591b027cb22 From 0d6ecce8c5f27283357d328d1e3a1b3c96ba98d9 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 21 Feb 2018 18:27:15 -0800 Subject: [PATCH 267/295] Use FeatureBranchVersionSuffix when generating VersionSuffix --- version.props | 1 + 1 file changed, 1 insertion(+) diff --git a/version.props b/version.props index 370d5ababd..65c8a07e37 100644 --- a/version.props +++ b/version.props @@ -5,6 +5,7 @@ $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final t000 + $(VersionSuffix)-$([System.Text.RegularExpressions.Regex]::Replace('$(FeatureBranchVersionSuffix)', '[^\w-]', '-')) $(VersionSuffix)-$(BuildNumber) From 1cb0c861ee653a62b371019ae3ecaabf48f988a9 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Mon, 26 Feb 2018 11:16:24 -0800 Subject: [PATCH 268/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 017c2534be..c9ffee7155 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,23 +3,23 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview2-15707 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 - 2.1.0-preview2-30131 + 2.1.0-preview2-15721 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 + 2.1.0-preview2-30187 2.0.0 2.1.0-preview2-26130-04 - 15.3.0 + 15.6.0 2.3.1 2.4.0-beta.1.build3945 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 89d0ad3d15..e6c7fddffa 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview2-15707 -commithash:e74e53f129ab34332947fea7ac7b7591b027cb22 +version:2.1.0-preview2-15721 +commithash:f9bb4be59e39938ec59a6975257e26099b0d03c1 From 2c1aabaa25a940ce6152f9f1f95d2c2d8f9967c7 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 6 Mar 2018 10:06:12 -0800 Subject: [PATCH 269/295] Use dotnet-core feed in repos --- build/sources.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/sources.props b/build/sources.props index 9feff29d09..9215df9751 100644 --- a/build/sources.props +++ b/build/sources.props @@ -1,10 +1,11 @@ - + $(DotNetRestoreSources) $(RestoreSources); + https://dotnet.myget.org/F/dotnet-core/api/v3/index.json; https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json; https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; From b9584c3067d8787f2d5df39142ceaf043cc0c970 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 6 Mar 2018 10:06:12 -0800 Subject: [PATCH 270/295] Prepend FeatureBranchVersionPrefix if FeatureBranchVersionSuffix is specified --- version.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/version.props b/version.props index 65c8a07e37..a11ea1ed52 100644 --- a/version.props +++ b/version.props @@ -5,7 +5,8 @@ $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final t000 - $(VersionSuffix)-$([System.Text.RegularExpressions.Regex]::Replace('$(FeatureBranchVersionSuffix)', '[^\w-]', '-')) + a- + $(FeatureBranchVersionPrefix)$(VersionSuffix)-$([System.Text.RegularExpressions.Regex]::Replace('$(FeatureBranchVersionSuffix)', '[^\w-]', '-')) $(VersionSuffix)-$(BuildNumber) From c1962bae887ce176ce5f7b94f8bacbea9439aae2 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Thu, 8 Mar 2018 13:15:02 -0800 Subject: [PATCH 271/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index c9ffee7155..1cbc4ac316 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview2-15721 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 - 2.1.0-preview2-30187 + 2.1.0-preview2-15728 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 + 2.1.0-preview2-30272 2.0.0 - 2.1.0-preview2-26130-04 + 2.1.0-preview2-26225-03 15.6.0 2.3.1 2.4.0-beta.1.build3945 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index e6c7fddffa..138d848db1 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview2-15721 -commithash:f9bb4be59e39938ec59a6975257e26099b0d03c1 +version:2.1.0-preview2-15728 +commithash:393377068ddcf51dfee0536536d455f57a828b06 From dedabd235bd74832ede5290f31422a14cb975986 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 16 Mar 2018 11:17:10 -0700 Subject: [PATCH 272/295] Branching for 2.1.0-preview2 --- build/dependencies.props | 30 +++++++++++++++--------------- build/repo.props | 4 ++-- build/sources.props | 2 +- korebuild-lock.txt | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 1cbc4ac316..f9e76c3d5c 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview2-15728 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 + 2.1.0-preview2-15742 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 + 2.1.0-preview2-30355 2.0.0 - 2.1.0-preview2-26225-03 + 2.1.0-preview2-26314-02 15.6.0 2.3.1 2.4.0-beta.1.build3945 diff --git a/build/repo.props b/build/repo.props index 78b0ce5879..d94ff7d00d 100644 --- a/build/repo.props +++ b/build/repo.props @@ -1,10 +1,10 @@ - + Internal.AspNetCore.Universe.Lineup - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json + https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json diff --git a/build/sources.props b/build/sources.props index 9215df9751..36045f12b5 100644 --- a/build/sources.props +++ b/build/sources.props @@ -6,7 +6,7 @@ $(RestoreSources); https://dotnet.myget.org/F/dotnet-core/api/v3/index.json; - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json; + https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json; https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 138d848db1..e40ef6651b 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview2-15728 -commithash:393377068ddcf51dfee0536536d455f57a828b06 +version:2.1.0-preview2-15742 +commithash:21fbb0f2c3fe4a9216e2d59632b98cfd7d685962 From 0e45212927bb32ab023bc280563badcef5dfaa6c Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 16 Mar 2018 11:28:24 -0700 Subject: [PATCH 273/295] Update version prefix to preview3 --- version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.props b/version.props index a11ea1ed52..24f2b00a0a 100644 --- a/version.props +++ b/version.props @@ -1,7 +1,7 @@ 2.1.0 - preview2 + preview3 $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final t000 From 4fde2bd6822fdf0f5487be9d3d7b7cb8038cf2a5 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 16 Mar 2018 12:34:06 -0700 Subject: [PATCH 274/295] Update KoreBuild channel --- korebuild.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/korebuild.json b/korebuild.json index bd5d51a51b..678d8bb948 100644 --- a/korebuild.json +++ b/korebuild.json @@ -1,4 +1,4 @@ { - "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", - "channel": "dev" + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/release/2.1/tools/korebuild.schema.json", + "channel": "release/2.1" } From f38ebee489a8a73c4ea21c3a0fb111277b91ea1f Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 14 Mar 2018 15:35:26 -0700 Subject: [PATCH 275/295] Set 2.0 baselines --- build/dependencies.props | 2 +- korebuild-lock.txt | 4 +- .../baseline.netcore.json | 104 ++++++++++++++++-- .../breakingchanges.netcore.json | 32 ------ 4 files changed, 98 insertions(+), 44 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Session/breakingchanges.netcore.json diff --git a/build/dependencies.props b/build/dependencies.props index f9e76c3d5c..fac843e97f 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,7 +3,7 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview2-15742 + 2.1.0-preview2-15744 2.1.0-preview2-30355 2.1.0-preview2-30355 2.1.0-preview2-30355 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index e40ef6651b..f531e7b0f7 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview2-15742 -commithash:21fbb0f2c3fe4a9216e2d59632b98cfd7d685962 +version:2.1.0-preview2-15744 +commithash:9e15cb6062ab5b9790d3fa699e018543a6950713 diff --git a/src/Microsoft.AspNetCore.Session/baseline.netcore.json b/src/Microsoft.AspNetCore.Session/baseline.netcore.json index 4a03419d7d..b8f0411f46 100644 --- a/src/Microsoft.AspNetCore.Session/baseline.netcore.json +++ b/src/Microsoft.AspNetCore.Session/baseline.netcore.json @@ -1,5 +1,5 @@ { - "AssemblyIdentity": "Microsoft.AspNetCore.Session, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", + "AssemblyIdentity": "Microsoft.AspNetCore.Session, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", "Types": [ { "Name": "Microsoft.Extensions.DependencyInjection.SessionServiceCollectionExtensions", @@ -99,6 +99,69 @@ "Kind": "Class", "ImplementedInterfaces": [], "Members": [ + { + "Kind": "Method", + "Name": "get_Cookie", + "Parameters": [], + "ReturnType": "Microsoft.AspNetCore.Http.CookieBuilder", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_Cookie", + "Parameters": [ + { + "Name": "value", + "Type": "Microsoft.AspNetCore.Http.CookieBuilder" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_IdleTimeout", + "Parameters": [], + "ReturnType": "System.TimeSpan", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_IdleTimeout", + "Parameters": [ + { + "Name": "value", + "Type": "System.TimeSpan" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_IOTimeout", + "Parameters": [], + "ReturnType": "System.TimeSpan", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_IOTimeout", + "Parameters": [ + { + "Name": "value", + "Type": "System.TimeSpan" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, { "Kind": "Method", "Name": "get_CookieName", @@ -185,19 +248,19 @@ }, { "Kind": "Method", - "Name": "get_IdleTimeout", + "Name": "get_CookieSecure", "Parameters": [], - "ReturnType": "System.TimeSpan", + "ReturnType": "Microsoft.AspNetCore.Http.CookieSecurePolicy", "Visibility": "Public", "GenericParameter": [] }, { "Kind": "Method", - "Name": "set_IdleTimeout", + "Name": "set_CookieSecure", "Parameters": [ { "Name": "value", - "Type": "System.TimeSpan" + "Type": "Microsoft.AspNetCore.Http.CookieSecurePolicy" } ], "ReturnType": "System.Void", @@ -326,7 +389,13 @@ { "Kind": "Method", "Name": "LoadAsync", - "Parameters": [], + "Parameters": [ + { + "Name": "cancellationToken", + "Type": "System.Threading.CancellationToken", + "DefaultValue": "default(System.Threading.CancellationToken)" + } + ], "ReturnType": "System.Threading.Tasks.Task", "Sealed": true, "Virtual": true, @@ -337,7 +406,13 @@ { "Kind": "Method", "Name": "CommitAsync", - "Parameters": [], + "Parameters": [ + { + "Name": "cancellationToken", + "Type": "System.Threading.CancellationToken", + "DefaultValue": "default(System.Threading.CancellationToken)" + } + ], "ReturnType": "System.Threading.Tasks.Task", "Sealed": true, "Virtual": true, @@ -361,6 +436,10 @@ "Name": "idleTimeout", "Type": "System.TimeSpan" }, + { + "Name": "ioTimeout", + "Type": "System.TimeSpan" + }, { "Name": "tryEstablishSession", "Type": "System.Func" @@ -400,6 +479,10 @@ "Name": "idleTimeout", "Type": "System.TimeSpan" }, + { + "Name": "ioTimeout", + "Type": "System.TimeSpan" + }, { "Name": "tryEstablishSession", "Type": "System.Func" @@ -454,6 +537,10 @@ "Name": "idleTimeout", "Type": "System.TimeSpan" }, + { + "Name": "ioTimeout", + "Type": "System.TimeSpan" + }, { "Name": "tryEstablishSession", "Type": "System.Func" @@ -596,6 +683,5 @@ ], "GenericParameters": [] } - ], - "SourceFilters": [] + ] } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Session/breakingchanges.netcore.json deleted file mode 100644 index 3b5489de5a..0000000000 --- a/src/Microsoft.AspNetCore.Session/breakingchanges.netcore.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "TypeId": "public interface Microsoft.AspNetCore.Session.ISessionStore", - "MemberId": "Microsoft.AspNetCore.Http.ISession Create(System.String sessionKey, System.TimeSpan idleTimeout, System.Func tryEstablishSession, System.Boolean isNewSessionKey)", - "Kind": "Removal" - }, - { - "TypeId": "public class Microsoft.AspNetCore.Session.DistributedSession : Microsoft.AspNetCore.Http.ISession", - "MemberId": "public .ctor(Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, System.String sessionKey, System.TimeSpan idleTimeout, System.Func tryEstablishSession, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Boolean isNewSessionKey)", - "Kind": "Removal" - }, - { - "TypeId": "public class Microsoft.AspNetCore.Session.DistributedSession : Microsoft.AspNetCore.Http.ISession", - "MemberId": "public System.Threading.Tasks.Task CommitAsync()", - "Kind": "Removal" - }, - { - "TypeId": "public class Microsoft.AspNetCore.Session.DistributedSession : Microsoft.AspNetCore.Http.ISession", - "MemberId": "public System.Threading.Tasks.Task LoadAsync()", - "Kind": "Removal" - }, - { - "TypeId": "public class Microsoft.AspNetCore.Session.DistributedSessionStore : Microsoft.AspNetCore.Session.ISessionStore", - "MemberId": "public Microsoft.AspNetCore.Http.ISession Create(System.String sessionKey, System.TimeSpan idleTimeout, System.Func tryEstablishSession, System.Boolean isNewSessionKey)", - "Kind": "Removal" - }, - { - "TypeId": "public interface Microsoft.AspNetCore.Session.ISessionStore", - "MemberId": "Microsoft.AspNetCore.Http.ISession Create(System.String sessionKey, System.TimeSpan idleTimeout, System.TimeSpan ioTimeout, System.Func tryEstablishSession, System.Boolean isNewSessionKey)", - "Kind": "Addition" - } -] \ No newline at end of file From e7da2bd40114a3ab5b5b0c6a928c39e159045170 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 25 Mar 2018 15:55:19 -0700 Subject: [PATCH 276/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 32 ++++++++++++++++---------------- korebuild-lock.txt | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 1cbc4ac316..5d589eddfc 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,23 +3,23 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview2-15728 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 - 2.1.0-preview2-30272 + 2.1.0-preview3-17001 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 + 2.1.0-preview3-32037 2.0.0 - 2.1.0-preview2-26225-03 - 15.6.0 + 2.1.0-preview2-26314-02 + 15.6.1 2.3.1 2.4.0-beta.1.build3945 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 138d848db1..3a326c7d58 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview2-15728 -commithash:393377068ddcf51dfee0536536d455f57a828b06 +version:2.1.0-preview3-17001 +commithash:dda68c56abf0d3b911fe6a2315872c446b314585 From b77b9b10dad00b78dab0437a3a2f95b042c951dc Mon Sep 17 00:00:00 2001 From: "Nate McMaster (automated)" Date: Wed, 28 Mar 2018 11:04:07 -0700 Subject: [PATCH 277/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 32 ++++++++++++++++---------------- korebuild-lock.txt | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index fac843e97f..a7175958b2 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,23 +3,23 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview2-15744 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 - 2.1.0-preview2-30355 + 2.1.0-preview2-15749 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 + 2.1.0-preview2-30478 2.0.0 - 2.1.0-preview2-26314-02 - 15.6.0 + 2.1.0-preview2-26326-03 + 15.6.1 2.3.1 2.4.0-beta.1.build3945 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index f531e7b0f7..b8e036fe2c 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview2-15744 -commithash:9e15cb6062ab5b9790d3fa699e018543a6950713 +version:2.1.0-preview2-15749 +commithash:5544c9ab20fa5e24b9e155d8958a3c3b6f5f9df9 From e293017a7f0109e3bf6c3f6ecdfd6187dff88b3a Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 3 Apr 2018 22:42:36 +0000 Subject: [PATCH 278/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 5d589eddfc..76205f4650 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview3-17001 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 - 2.1.0-preview3-32037 + 2.1.0-preview3-17002 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 + 2.1.0-preview3-32110 2.0.0 - 2.1.0-preview2-26314-02 + 2.1.0-preview3-26331-01 15.6.1 2.3.1 2.4.0-beta.1.build3945 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 3a326c7d58..b3af0b8bce 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview3-17001 -commithash:dda68c56abf0d3b911fe6a2315872c446b314585 +version:2.1.0-preview3-17002 +commithash:b8e4e6ab104adc94c0719bb74229870e9b584a7f From 14dbcd9fbb2c51d7d530e1ade93daf936860110e Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Wed, 4 Apr 2018 13:42:57 -0700 Subject: [PATCH 279/295] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 61c48b1491..976f9f21cf 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ Travis: [![Travis](https://travis-ci.org/aspnet/Session.svg?branch=dev)](https Contains libraries for session state middleware for ASP.NET Core. +For ASP.NET 4.x session state, please go to https://github.com/aspnet/AspNetSessionState. + This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [Home](https://github.com/aspnet/home) repo. - - - From a5e67d606b1a2a2c9c0413039172f7056a5ddf75 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 12 Apr 2018 17:11:18 -0700 Subject: [PATCH 280/295] Update usage of TestSink --- .../SessionTests.cs | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs index 429e141294..f98a018bc5 100644 --- a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs +++ b/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs @@ -318,7 +318,7 @@ namespace Microsoft.AspNetCore.Session response.EnsureSuccessStatusCode(); } - var sessionLogMessages = sink.Writes; + var sessionLogMessages = sink.Writes.ToList(); Assert.Equal(2, sessionLogMessages.Count); Assert.Contains("started", sessionLogMessages[0].State.ToString()); @@ -376,7 +376,7 @@ namespace Microsoft.AspNetCore.Session result = await client.GetStringAsync("/second"); } - var sessionLogMessages = sink.Writes; + var sessionLogMessages = sink.Writes.ToList(); Assert.Equal("2", result); Assert.Equal(3, sessionLogMessages.Count); @@ -591,11 +591,9 @@ namespace Microsoft.AspNetCore.Session response.EnsureSuccessStatusCode(); } - var sessionLogMessages = sink.Writes; - - Assert.Single(sessionLogMessages); - Assert.Contains("Session cache read exception", sessionLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); + var message = Assert.Single(sink.Writes); + Assert.Contains("Session cache read exception", message.State.ToString()); + Assert.Equal(LogLevel.Error, message.LogLevel); } [Fact] @@ -634,11 +632,9 @@ namespace Microsoft.AspNetCore.Session response.EnsureSuccessStatusCode(); } - var sessionLogMessages = sink.Writes; - - Assert.Single(sessionLogMessages); - Assert.Contains("Session cache read exception", sessionLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); + var message = Assert.Single(sink.Writes); + Assert.Contains("Session cache read exception", message.State.ToString()); + Assert.Equal(LogLevel.Error, message.LogLevel); } [Fact] @@ -677,11 +673,9 @@ namespace Microsoft.AspNetCore.Session response.EnsureSuccessStatusCode(); } - var sessionLogMessages = sink.Writes; - - Assert.Single(sessionLogMessages); - Assert.Contains("Loading the session timed out.", sessionLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Warning, sessionLogMessages[0].LogLevel); + var message = Assert.Single(sink.Writes); + Assert.Contains("Loading the session timed out.", message.State.ToString()); + Assert.Equal(LogLevel.Warning, message.LogLevel); } [Fact] @@ -720,8 +714,7 @@ namespace Microsoft.AspNetCore.Session response.EnsureSuccessStatusCode(); } - var sessionLogMessages = sink.Writes; - Assert.Empty(sessionLogMessages); + Assert.Empty(sink.Writes); } [Fact] @@ -924,11 +917,9 @@ namespace Microsoft.AspNetCore.Session response.EnsureSuccessStatusCode(); } - var sessionLogMessages = sink.Writes; - - Assert.Single(sessionLogMessages); - Assert.Contains("Error closing the session.", sessionLogMessages[0].State.ToString()); - Assert.Equal(LogLevel.Error, sessionLogMessages[0].LogLevel); + var message = Assert.Single(sink.Writes); + Assert.Contains("Error closing the session.", message.State.ToString()); + Assert.Equal(LogLevel.Error, message.LogLevel); } private class TestClock : ISystemClock From 094d96c4fcc37f2e9ff02a6d861f493ac366ddc6 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 15 Apr 2018 14:26:34 -0700 Subject: [PATCH 281/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 76205f4650..ce33283474 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview3-17002 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 - 2.1.0-preview3-32110 + 2.1.0-preview3-17018 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 + 2.1.0-preview3-32233 2.0.0 - 2.1.0-preview3-26331-01 + 2.1.0-preview3-26413-05 15.6.1 2.3.1 2.4.0-beta.1.build3945 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index b3af0b8bce..b419d767b9 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview3-17002 -commithash:b8e4e6ab104adc94c0719bb74229870e9b584a7f +version:2.1.0-preview3-17018 +commithash:af264ca131f212b5ba8aafbc5110fc0fc510a2be From a9f6f3bb3d0e84c8c88816f6cdb08fa7554de183 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Mon, 16 Apr 2018 17:02:38 -0700 Subject: [PATCH 282/295] Branching for 2.1.0-rc1 --- build/repo.props | 3 ++- korebuild.json | 4 ++-- version.props | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/repo.props b/build/repo.props index 78b0ce5879..dab1601c88 100644 --- a/build/repo.props +++ b/build/repo.props @@ -1,9 +1,10 @@ - + Internal.AspNetCore.Universe.Lineup + 2.1.0-rc1-* https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json diff --git a/korebuild.json b/korebuild.json index bd5d51a51b..678d8bb948 100644 --- a/korebuild.json +++ b/korebuild.json @@ -1,4 +1,4 @@ { - "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", - "channel": "dev" + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/release/2.1/tools/korebuild.schema.json", + "channel": "release/2.1" } diff --git a/version.props b/version.props index 24f2b00a0a..e27532787e 100644 --- a/version.props +++ b/version.props @@ -1,7 +1,7 @@ 2.1.0 - preview3 + rc1 $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final t000 From 3f379ef910f6fb26c216184d68cc6d11607f2e4a Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 19 Apr 2018 16:44:53 -0700 Subject: [PATCH 283/295] Set NETStandardImplicitPackageVersion via dependencies.props --- Directory.Build.targets | 1 + build/dependencies.props | 1 + 2 files changed, 2 insertions(+) diff --git a/Directory.Build.targets b/Directory.Build.targets index 894b1d0cf8..53b3f6e1da 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -2,5 +2,6 @@ $(MicrosoftNETCoreApp20PackageVersion) $(MicrosoftNETCoreApp21PackageVersion) + $(NETStandardLibrary20PackageVersion) diff --git a/build/dependencies.props b/build/dependencies.props index ce33283474..748f4e678b 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -20,6 +20,7 @@ 2.0.0 2.1.0-preview3-26413-05 15.6.1 + 2.0.1 2.3.1 2.4.0-beta.1.build3945 From 23eee246a402d3781a619aae7a9f157204812d08 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Thu, 19 Apr 2018 22:36:18 -0700 Subject: [PATCH 284/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 748f4e678b..938682d04e 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-preview3-17018 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 - 2.1.0-preview3-32233 + 2.1.0-rc1-15774 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 + 2.1.0-rc1-30613 2.0.0 - 2.1.0-preview3-26413-05 + 2.1.0-rc1-26419-02 15.6.1 2.0.1 2.3.1 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index b419d767b9..9d4ef8c888 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview3-17018 -commithash:af264ca131f212b5ba8aafbc5110fc0fc510a2be +version:2.1.0-rc1-15774 +commithash:ed5ca9de3c652347dbb0158a9a65eff3471d2114 From af6b89e8f766eda141c53a0fe07ea0b6a8569d54 Mon Sep 17 00:00:00 2001 From: "Nate McMaster (automated)" Date: Mon, 30 Apr 2018 14:51:45 -0700 Subject: [PATCH 285/295] Bump version to 2.1.0-rtm --- version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.props b/version.props index e27532787e..b9552451d8 100644 --- a/version.props +++ b/version.props @@ -1,7 +1,7 @@ 2.1.0 - rc1 + rtm $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final t000 From 4da224c5f10d21bc90acb60360f12ac6c06a03f7 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Fri, 4 May 2018 07:50:52 -0700 Subject: [PATCH 286/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 32 ++++++++++++++++---------------- korebuild-lock.txt | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 938682d04e..77c40b9794 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,24 +3,24 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-rc1-15774 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 - 2.1.0-rc1-30613 + 2.1.0-rtm-15783 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 + 2.1.0-rtm-30721 2.0.0 - 2.1.0-rc1-26419-02 + 2.1.0-rtm-26502-02 15.6.1 - 2.0.1 + 2.0.3 2.3.1 2.4.0-beta.1.build3945 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 9d4ef8c888..3673744db9 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-rc1-15774 -commithash:ed5ca9de3c652347dbb0158a9a65eff3471d2114 +version:2.1.0-rtm-15783 +commithash:5fc2b2f607f542a2ffde11c19825e786fc1a3774 From 3b0566d8f366413c73ccc70b21f1692356b1df29 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 29 May 2018 09:53:06 -0700 Subject: [PATCH 287/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 77c40b9794..d117edd8e7 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.0-rtm-15783 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 - 2.1.0-rtm-30721 + 2.1.1-rtm-15790 + 2.1.0 + 2.1.0 + 2.1.0 + 2.1.0 + 2.1.0 + 2.1.0 + 2.1.0 + 2.1.0 + 2.1.0 + 2.1.0 + 2.1.0 + 2.1.0 + 2.1.0 2.0.0 - 2.1.0-rtm-26502-02 + 2.1.0 15.6.1 2.0.3 2.3.1 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 3673744db9..cd5b409a1e 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-rtm-15783 -commithash:5fc2b2f607f542a2ffde11c19825e786fc1a3774 +version:2.1.1-rtm-15790 +commithash:274c65868e735f29f4078c1884c61c4371ee1fc0 From d0815aefe1aa667150983db83a22059b54ae484f Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 5 Jun 2018 09:11:45 -0700 Subject: [PATCH 288/295] Bumping version from 2.1.0 to 2.1.1 --- version.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.props b/version.props index b9552451d8..669c874829 100644 --- a/version.props +++ b/version.props @@ -1,6 +1,6 @@ - + - 2.1.0 + 2.1.1 rtm $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final From 2d910089bc05f4ef35bb5807b648ebf557c7a408 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 12 Jun 2018 19:34:29 +0000 Subject: [PATCH 289/295] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 30 +++++++++++++++--------------- korebuild-lock.txt | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index d117edd8e7..38695ac734 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,22 +3,22 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.1-rtm-15790 - 2.1.0 - 2.1.0 - 2.1.0 - 2.1.0 - 2.1.0 - 2.1.0 - 2.1.0 - 2.1.0 - 2.1.0 - 2.1.0 - 2.1.0 - 2.1.0 - 2.1.0 + 2.1.1-rtm-15793 + 2.1.1 + 2.1.1 + 2.1.1 + 2.1.1 + 2.1.1 + 2.1.1 + 2.1.1 + 2.1.1 + 2.1.1 + 2.1.1 + 2.1.1 + 2.1.1 + 2.1.1 2.0.0 - 2.1.0 + 2.1.1 15.6.1 2.0.3 2.3.1 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index cd5b409a1e..bc84e0cd53 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.1-rtm-15790 -commithash:274c65868e735f29f4078c1884c61c4371ee1fc0 +version:2.1.1-rtm-15793 +commithash:988313f4b064d6c69fc6f7b845b6384a6af3447a From f43646e7a197708ee662589208f0166c7406d651 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 13 Jun 2018 10:59:52 -0700 Subject: [PATCH 290/295] Set 2.1 baselines --- src/Microsoft.AspNetCore.Session/baseline.netcore.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Session/baseline.netcore.json b/src/Microsoft.AspNetCore.Session/baseline.netcore.json index b8f0411f46..ff9ee6811f 100644 --- a/src/Microsoft.AspNetCore.Session/baseline.netcore.json +++ b/src/Microsoft.AspNetCore.Session/baseline.netcore.json @@ -1,5 +1,5 @@ { - "AssemblyIdentity": "Microsoft.AspNetCore.Session, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", + "AssemblyIdentity": "Microsoft.AspNetCore.Session, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", "Types": [ { "Name": "Microsoft.Extensions.DependencyInjection.SessionServiceCollectionExtensions", From 246aedb5bf97059d25cc3e2d8de715de5156f6f6 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 27 Jun 2018 13:39:51 -0700 Subject: [PATCH 291/295] Bumping version from 2.1.1 to 2.1.2 --- version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.props b/version.props index 669c874829..478dfd16ed 100644 --- a/version.props +++ b/version.props @@ -1,6 +1,6 @@  - 2.1.1 + 2.1.2 rtm $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final From 6f0464dd9f93e45d0e3c31b4d4363f0f59c1919e Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 11 Jul 2018 15:06:43 -0700 Subject: [PATCH 292/295] Reverting version from 2.1.2 back to 2.1.1 As a result of changing the way we apply servicing updates to aspnet core, this repo did not need the version bump because there are no planned product changes in this repo. --- version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.props b/version.props index 478dfd16ed..669c874829 100644 --- a/version.props +++ b/version.props @@ -1,6 +1,6 @@  - 2.1.2 + 2.1.1 rtm $(VersionPrefix) $(VersionPrefix)-$(VersionSuffix)-final From 6234cf8555487d834030fd0416c3d99ab1133302 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 11 Jul 2018 18:49:58 -0700 Subject: [PATCH 293/295] Updating dependencies to 2.1.2 and adding a section for pinned variable versions --- build/dependencies.props | 15 +++++++++++---- korebuild-lock.txt | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 38695ac734..f30c49da3d 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -2,12 +2,14 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - 2.1.1-rtm-15793 + + + + 2.1.3-rtm-15802 2.1.1 2.1.1 2.1.1 - 2.1.1 + 2.1.2 2.1.1 2.1.1 2.1.1 @@ -18,11 +20,16 @@ 2.1.1 2.1.1 2.0.0 - 2.1.1 + 2.1.2 15.6.1 2.0.3 2.3.1 2.4.0-beta.1.build3945 + + + + + diff --git a/korebuild-lock.txt b/korebuild-lock.txt index bc84e0cd53..251c227c83 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.1-rtm-15793 -commithash:988313f4b064d6c69fc6f7b845b6384a6af3447a +version:2.1.3-rtm-15802 +commithash:a7c08b45b440a7d2058a0aa1eaa3eb6ba811976a From d20c2c8f04e6779239abd65c033fa66eb6c2002f Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 12 Jul 2018 11:58:55 -0700 Subject: [PATCH 294/295] Pin version variables to the ASP.NET Core 2.1.2 baseline This reverts our previous policy of cascading versions on all servicing updates. This moves variables into the 'pinned' section, and points them to the latest stable release (versions that were used at the time of the 2.1.2 release). --- build/dependencies.props | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index f30c49da3d..6e86d21f90 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,8 +4,21 @@ - + 2.1.3-rtm-15802 + 2.0.0 + 2.1.2 + 15.6.1 + 2.0.3 + 2.3.1 + 2.4.0-beta.1.build3945 + + + + + + + 2.1.1 2.1.1 2.1.1 @@ -19,17 +32,5 @@ 2.1.1 2.1.1 2.1.1 - 2.0.0 - 2.1.2 - 15.6.1 - 2.0.3 - 2.3.1 - 2.4.0-beta.1.build3945 - - - - - - - + \ No newline at end of file From 95928c0c64ae0b6c9bed983f459555bbd05b25eb Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 21 Nov 2018 10:02:17 -0800 Subject: [PATCH 295/295] Reorganize source code in preparation to move into aspnet/AspNetCore Prior to reorganization, this source code was found in https://github.com/aspnet/Session/tree/d20c2c8f04e6779239abd65c033fa66eb6c2002f --- .appveyor.yml | 17 -- .gitattributes | 51 ---- .github/ISSUE_TEMPLATE.md | 3 - .travis.yml | 27 -- CONTRIBUTING.md | 4 - LICENSE.txt | 14 -- NuGet.config | 7 - build.cmd | 2 - build.sh | 8 - korebuild-lock.txt | 2 - korebuild.json | 4 - run.cmd | 2 - run.ps1 | 196 --------------- run.sh | 231 ------------------ .gitignore => src/Session/.gitignore | 0 .../Session/Directory.Build.props | 0 .../Session/Directory.Build.targets | 0 .../Session/NuGetPackageVerifier.json | 0 README.md => src/Session/README.md | 0 Session.sln => src/Session/Session.sln | 0 {build => src/Session/build}/Key.snk | Bin .../Session/build}/dependencies.props | 0 {build => src/Session/build}/repo.props | 0 {build => src/Session/build}/sources.props | 0 .../Properties/launchSettings.json | 0 .../SessionSample/SessionSample.csproj | 0 .../Session/samples}/SessionSample/Startup.cs | 0 src/{ => Session/src}/Directory.Build.props | 0 .../CookieProtection.cs | 0 .../DistributedSession.cs | 0 .../DistributedSessionStore.cs | 0 .../EncodedKey.cs | 0 .../ISessionStore.cs | 0 .../LoggingExtensions.cs | 0 .../Microsoft.AspNetCore.Session.csproj | 0 .../NoOpSessionStore.cs | 0 .../Properties/Resources.Designer.cs | 0 .../Resources.resx | 0 .../SessionDefaults.cs | 0 .../SessionFeature.cs | 0 .../SessionMiddleware.cs | 0 .../SessionMiddlewareExtensions.cs | 0 .../SessionOptions.cs | 0 .../SessionServiceCollectionExtensions.cs | 0 .../Microsoft.AspNetCore.Session/SipHash.cs | 0 .../baseline.netcore.json | 0 .../Session/test}/Directory.Build.props | 0 .../Microsoft.AspNetCore.Session.Tests.csproj | 0 .../SessionTests.cs | 0 version.props => src/Session/version.props | 0 50 files changed, 568 deletions(-) delete mode 100644 .appveyor.yml delete mode 100644 .gitattributes delete mode 100644 .github/ISSUE_TEMPLATE.md delete mode 100644 .travis.yml delete mode 100644 CONTRIBUTING.md delete mode 100644 LICENSE.txt delete mode 100644 NuGet.config delete mode 100644 build.cmd delete mode 100755 build.sh delete mode 100644 korebuild-lock.txt delete mode 100644 korebuild.json delete mode 100644 run.cmd delete mode 100644 run.ps1 delete mode 100755 run.sh rename .gitignore => src/Session/.gitignore (100%) rename Directory.Build.props => src/Session/Directory.Build.props (100%) rename Directory.Build.targets => src/Session/Directory.Build.targets (100%) rename NuGetPackageVerifier.json => src/Session/NuGetPackageVerifier.json (100%) rename README.md => src/Session/README.md (100%) rename Session.sln => src/Session/Session.sln (100%) rename {build => src/Session/build}/Key.snk (100%) rename {build => src/Session/build}/dependencies.props (100%) rename {build => src/Session/build}/repo.props (100%) rename {build => src/Session/build}/sources.props (100%) rename {samples => src/Session/samples}/SessionSample/Properties/launchSettings.json (100%) rename {samples => src/Session/samples}/SessionSample/SessionSample.csproj (100%) rename {samples => src/Session/samples}/SessionSample/Startup.cs (100%) rename src/{ => Session/src}/Directory.Build.props (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/CookieProtection.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/DistributedSession.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/DistributedSessionStore.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/EncodedKey.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/ISessionStore.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/LoggingExtensions.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/NoOpSessionStore.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/Resources.resx (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/SessionDefaults.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/SessionFeature.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/SessionMiddleware.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/SessionOptions.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/SipHash.cs (100%) rename src/{ => Session/src}/Microsoft.AspNetCore.Session/baseline.netcore.json (100%) rename {test => src/Session/test}/Directory.Build.props (100%) rename {test => src/Session/test}/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj (100%) rename {test => src/Session/test}/Microsoft.AspNetCore.Session.Tests/SessionTests.cs (100%) rename version.props => src/Session/version.props (100%) diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 4eea96ab69..0000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,17 +0,0 @@ -init: -- git config --global core.autocrlf true -branches: - only: - - dev - - /^release\/.*$/ - - /^(.*\/)?ci-.*$/ -build_script: -- ps: .\run.ps1 default-build -clone_depth: 1 -environment: - global: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - DOTNET_CLI_TELEMETRY_OPTOUT: 1 -test: 'off' -deploy: 'off' -os: Visual Studio 2017 diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index d0a46d6049..0000000000 --- a/.gitattributes +++ /dev/null @@ -1,51 +0,0 @@ -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain - -*.jpg binary -*.png binary -*.gif binary - -*.cs text=auto diff=csharp -*.vb text=auto -*.resx text=auto -*.c text=auto -*.cpp text=auto -*.cxx text=auto -*.h text=auto -*.hxx text=auto -*.py text=auto -*.rb text=auto -*.java text=auto -*.html text=auto -*.htm text=auto -*.css text=auto -*.scss text=auto -*.sass text=auto -*.less text=auto -*.js text=auto -*.lisp text=auto -*.clj text=auto -*.sql text=auto -*.php text=auto -*.lua text=auto -*.m text=auto -*.asm text=auto -*.erl text=auto -*.fs text=auto -*.fsx text=auto -*.hs text=auto - -*.csproj text=auto -*.vbproj text=auto -*.fsproj text=auto -*.dbproj text=auto -*.sln text=auto eol=crlf -*.sh eol=lf diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 101a084f0a..0000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,3 +0,0 @@ -THIS ISSUE TRACKER IS CLOSED - please log new issues here: https://github.com/aspnet/Home/issues - -For information about this change, see https://github.com/aspnet/Announcements/issues/283 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 64bdbb4441..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: csharp -sudo: false -dist: trusty -env: - global: - - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - - DOTNET_CLI_TELEMETRY_OPTOUT: 1 -mono: none -os: -- linux -- osx -osx_image: xcode8.2 -addons: - apt: - packages: - - libunwind8 -branches: - only: - - dev - - /^release\/.*$/ - - /^(.*\/)?ci-.*$/ -before_install: -- if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s - /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib - /usr/local/lib/; fi -script: -- ./build.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 64ff041d5c..0000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,4 +0,0 @@ -Contributing -====== - -Information on contributing to this repo is in the [Contributing Guide](https://github.com/aspnet/Home/blob/dev/CONTRIBUTING.md) in the Home repo. diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 7b2956ecee..0000000000 --- a/LICENSE.txt +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed -under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR -CONDITIONS OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. diff --git a/NuGet.config b/NuGet.config deleted file mode 100644 index e32bddfd51..0000000000 --- a/NuGet.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/build.cmd b/build.cmd deleted file mode 100644 index c0050bda12..0000000000 --- a/build.cmd +++ /dev/null @@ -1,2 +0,0 @@ -@ECHO OFF -PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' default-build %*; exit $LASTEXITCODE" diff --git a/build.sh b/build.sh deleted file mode 100755 index 98a4b22765..0000000000 --- a/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs) -chmod +x "$DIR/run.sh"; sync -"$DIR/run.sh" default-build "$@" diff --git a/korebuild-lock.txt b/korebuild-lock.txt deleted file mode 100644 index 251c227c83..0000000000 --- a/korebuild-lock.txt +++ /dev/null @@ -1,2 +0,0 @@ -version:2.1.3-rtm-15802 -commithash:a7c08b45b440a7d2058a0aa1eaa3eb6ba811976a diff --git a/korebuild.json b/korebuild.json deleted file mode 100644 index 678d8bb948..0000000000 --- a/korebuild.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/release/2.1/tools/korebuild.schema.json", - "channel": "release/2.1" -} diff --git a/run.cmd b/run.cmd deleted file mode 100644 index d52d5c7e68..0000000000 --- a/run.cmd +++ /dev/null @@ -1,2 +0,0 @@ -@ECHO OFF -PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' %*; exit $LASTEXITCODE" diff --git a/run.ps1 b/run.ps1 deleted file mode 100644 index 27dcf848f8..0000000000 --- a/run.ps1 +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/env powershell -#requires -version 4 - -<# -.SYNOPSIS -Executes KoreBuild commands. - -.DESCRIPTION -Downloads korebuild if required. Then executes the KoreBuild command. To see available commands, execute with `-Command help`. - -.PARAMETER Command -The KoreBuild command to run. - -.PARAMETER Path -The folder to build. Defaults to the folder containing this script. - -.PARAMETER Channel -The channel of KoreBuild to download. Overrides the value from the config file. - -.PARAMETER DotNetHome -The directory where .NET Core tools will be stored. - -.PARAMETER ToolsSource -The base url where build tools can be downloaded. Overrides the value from the config file. - -.PARAMETER Update -Updates KoreBuild to the latest version even if a lock file is present. - -.PARAMETER ConfigFile -The path to the configuration file that stores values. Defaults to korebuild.json. - -.PARAMETER ToolsSourceSuffix -The Suffix to append to the end of the ToolsSource. Useful for query strings in blob stores. - -.PARAMETER Arguments -Arguments to be passed to the command - -.NOTES -This function will create a file $PSScriptRoot/korebuild-lock.txt. This lock file can be committed to source, but does not have to be. -When the lockfile is not present, KoreBuild will create one using latest available version from $Channel. - -The $ConfigFile is expected to be an JSON file. It is optional, and the configuration values in it are optional as well. Any options set -in the file are overridden by command line parameters. - -.EXAMPLE -Example config file: -```json -{ - "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", - "channel": "dev", - "toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools" -} -``` -#> -[CmdletBinding(PositionalBinding = $false)] -param( - [Parameter(Mandatory = $true, Position = 0)] - [string]$Command, - [string]$Path = $PSScriptRoot, - [Alias('c')] - [string]$Channel, - [Alias('d')] - [string]$DotNetHome, - [Alias('s')] - [string]$ToolsSource, - [Alias('u')] - [switch]$Update, - [string]$ConfigFile, - [string]$ToolsSourceSuffix, - [Parameter(ValueFromRemainingArguments = $true)] - [string[]]$Arguments -) - -Set-StrictMode -Version 2 -$ErrorActionPreference = 'Stop' - -# -# Functions -# - -function Get-KoreBuild { - - $lockFile = Join-Path $Path 'korebuild-lock.txt' - - if (!(Test-Path $lockFile) -or $Update) { - Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile $ToolsSourceSuffix - } - - $version = Get-Content $lockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1 - if (!$version) { - Write-Error "Failed to parse version from $lockFile. Expected a line that begins with 'version:'" - } - $version = $version.TrimStart('version:').Trim() - $korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version) - - if (!(Test-Path $korebuildPath)) { - Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version" - New-Item -ItemType Directory -Path $korebuildPath | Out-Null - $remotePath = "$ToolsSource/korebuild/artifacts/$version/korebuild.$version.zip" - - try { - $tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip" - Get-RemoteFile $remotePath $tmpfile $ToolsSourceSuffix - if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) { - # Use built-in commands where possible as they are cross-plat compatible - Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath - } - else { - # Fallback to old approach for old installations of PowerShell - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory($tmpfile, $korebuildPath) - } - } - catch { - Remove-Item -Recurse -Force $korebuildPath -ErrorAction Ignore - throw - } - finally { - Remove-Item $tmpfile -ErrorAction Ignore - } - } - - return $korebuildPath -} - -function Join-Paths([string]$path, [string[]]$childPaths) { - $childPaths | ForEach-Object { $path = Join-Path $path $_ } - return $path -} - -function Get-RemoteFile([string]$RemotePath, [string]$LocalPath, [string]$RemoteSuffix) { - if ($RemotePath -notlike 'http*') { - Copy-Item $RemotePath $LocalPath - return - } - - $retries = 10 - while ($retries -gt 0) { - $retries -= 1 - try { - Invoke-WebRequest -UseBasicParsing -Uri $($RemotePath + $RemoteSuffix) -OutFile $LocalPath - return - } - catch { - Write-Verbose "Request failed. $retries retries remaining" - } - } - - Write-Error "Download failed: '$RemotePath'." -} - -# -# Main -# - -# Load configuration or set defaults - -$Path = Resolve-Path $Path -if (!$ConfigFile) { $ConfigFile = Join-Path $Path 'korebuild.json' } - -if (Test-Path $ConfigFile) { - try { - $config = Get-Content -Raw -Encoding UTF8 -Path $ConfigFile | ConvertFrom-Json - if ($config) { - if (!($Channel) -and (Get-Member -Name 'channel' -InputObject $config)) { [string] $Channel = $config.channel } - if (!($ToolsSource) -and (Get-Member -Name 'toolsSource' -InputObject $config)) { [string] $ToolsSource = $config.toolsSource} - } - } - catch { - Write-Warning "$ConfigFile could not be read. Its settings will be ignored." - Write-Warning $Error[0] - } -} - -if (!$DotNetHome) { - $DotNetHome = if ($env:DOTNET_HOME) { $env:DOTNET_HOME } ` - elseif ($env:USERPROFILE) { Join-Path $env:USERPROFILE '.dotnet'} ` - elseif ($env:HOME) {Join-Path $env:HOME '.dotnet'}` - else { Join-Path $PSScriptRoot '.dotnet'} -} - -if (!$Channel) { $Channel = 'dev' } -if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' } - -# Execute - -$korebuildPath = Get-KoreBuild -Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1') - -try { - Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $Path -ConfigFile $ConfigFile - Invoke-KoreBuildCommand $Command @Arguments -} -finally { - Remove-Module 'KoreBuild' -ErrorAction Ignore -} diff --git a/run.sh b/run.sh deleted file mode 100755 index 834961fc3a..0000000000 --- a/run.sh +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -# -# variables -# - -RESET="\033[0m" -RED="\033[0;31m" -YELLOW="\033[0;33m" -MAGENTA="\033[0;95m" -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet" -verbose=false -update=false -repo_path="$DIR" -channel='' -tools_source='' -tools_source_suffix='' - -# -# Functions -# -__usage() { - echo "Usage: $(basename "${BASH_SOURCE[0]}") command [options] [[--] ...]" - echo "" - echo "Arguments:" - echo " command The command to be run." - echo " ... Arguments passed to the command. Variable number of arguments allowed." - echo "" - echo "Options:" - echo " --verbose Show verbose output." - echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.." - echo " --config-file The path to the configuration file that stores values. Defaults to korebuild.json." - echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet." - echo " --path The directory to build. Defaults to the directory containing the script." - echo " -s|--tools-source|-ToolsSource The base url where build tools can be downloaded. Overrides the value from the config file." - echo " --tools-source-suffix|-ToolsSourceSuffix The suffix to append to tools-source. Useful for query strings." - echo " -u|--update Update to the latest KoreBuild even if the lock file is present." - echo "" - echo "Description:" - echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." - echo " When the lockfile is not present, KoreBuild will create one using latest available version from \$channel." - - if [[ "${1:-}" != '--no-exit' ]]; then - exit 2 - fi -} - -get_korebuild() { - local version - local lock_file="$repo_path/korebuild-lock.txt" - if [ ! -f "$lock_file" ] || [ "$update" = true ]; then - __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" "$tools_source_suffix" - fi - version="$(grep 'version:*' -m 1 "$lock_file")" - if [[ "$version" == '' ]]; then - __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'" - return 1 - fi - version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" - local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version" - - { - if [ ! -d "$korebuild_path" ]; then - mkdir -p "$korebuild_path" - local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip" - tmpfile="$(mktemp)" - echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}" - if __get_remote_file "$remote_path" "$tmpfile" "$tools_source_suffix"; then - unzip -q -d "$korebuild_path" "$tmpfile" - fi - rm "$tmpfile" || true - fi - - source "$korebuild_path/KoreBuild.sh" - } || { - if [ -d "$korebuild_path" ]; then - echo "Cleaning up after failed installation" - rm -rf "$korebuild_path" || true - fi - return 1 - } -} - -__error() { - echo -e "${RED}error: $*${RESET}" 1>&2 -} - -__warn() { - echo -e "${YELLOW}warning: $*${RESET}" -} - -__machine_has() { - hash "$1" > /dev/null 2>&1 - return $? -} - -__get_remote_file() { - local remote_path=$1 - local local_path=$2 - local remote_path_suffix=$3 - - if [[ "$remote_path" != 'http'* ]]; then - cp "$remote_path" "$local_path" - return 0 - fi - - local failed=false - if __machine_has wget; then - wget --tries 10 --quiet -O "$local_path" "${remote_path}${remote_path_suffix}" || failed=true - else - failed=true - fi - - if [ "$failed" = true ] && __machine_has curl; then - failed=false - curl --retry 10 -sSL -f --create-dirs -o "$local_path" "${remote_path}${remote_path_suffix}" || failed=true - fi - - if [ "$failed" = true ]; then - __error "Download failed: $remote_path" 1>&2 - return 1 - fi -} - -# -# main -# - -command="${1:-}" -shift - -while [[ $# -gt 0 ]]; do - case $1 in - -\?|-h|--help) - __usage --no-exit - exit 0 - ;; - -c|--channel|-Channel) - shift - channel="${1:-}" - [ -z "$channel" ] && __usage - ;; - --config-file|-ConfigFile) - shift - config_file="${1:-}" - [ -z "$config_file" ] && __usage - if [ ! -f "$config_file" ]; then - __error "Invalid value for --config-file. $config_file does not exist." - exit 1 - fi - ;; - -d|--dotnet-home|-DotNetHome) - shift - DOTNET_HOME="${1:-}" - [ -z "$DOTNET_HOME" ] && __usage - ;; - --path|-Path) - shift - repo_path="${1:-}" - [ -z "$repo_path" ] && __usage - ;; - -s|--tools-source|-ToolsSource) - shift - tools_source="${1:-}" - [ -z "$tools_source" ] && __usage - ;; - --tools-source-suffix|-ToolsSourceSuffix) - shift - tools_source_suffix="${1:-}" - [ -z "$tools_source_suffix" ] && __usage - ;; - -u|--update|-Update) - update=true - ;; - --verbose|-Verbose) - verbose=true - ;; - --) - shift - break - ;; - *) - break - ;; - esac - shift -done - -if ! __machine_has unzip; then - __error 'Missing required command: unzip' - exit 1 -fi - -if ! __machine_has curl && ! __machine_has wget; then - __error 'Missing required command. Either wget or curl is required.' - exit 1 -fi - -[ -z "${config_file:-}" ] && config_file="$repo_path/korebuild.json" -if [ -f "$config_file" ]; then - if __machine_has jq ; then - if jq '.' "$config_file" >/dev/null ; then - config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")" - config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")" - else - __warn "$config_file is invalid JSON. Its settings will be ignored." - fi - elif __machine_has python ; then - if python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'))" >/dev/null ; then - config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")" - config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")" - else - __warn "$config_file is invalid JSON. Its settings will be ignored." - fi - else - __warn 'Missing required command: jq or pyton. Could not parse the JSON file. Its settings will be ignored.' - fi - - [ ! -z "${config_channel:-}" ] && channel="$config_channel" - [ ! -z "${config_tools_source:-}" ] && tools_source="$config_tools_source" -fi - -[ -z "$channel" ] && channel='dev' -[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' - -get_korebuild -set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$repo_path" "$config_file" -invoke_korebuild_command "$command" "$@" diff --git a/.gitignore b/src/Session/.gitignore similarity index 100% rename from .gitignore rename to src/Session/.gitignore diff --git a/Directory.Build.props b/src/Session/Directory.Build.props similarity index 100% rename from Directory.Build.props rename to src/Session/Directory.Build.props diff --git a/Directory.Build.targets b/src/Session/Directory.Build.targets similarity index 100% rename from Directory.Build.targets rename to src/Session/Directory.Build.targets diff --git a/NuGetPackageVerifier.json b/src/Session/NuGetPackageVerifier.json similarity index 100% rename from NuGetPackageVerifier.json rename to src/Session/NuGetPackageVerifier.json diff --git a/README.md b/src/Session/README.md similarity index 100% rename from README.md rename to src/Session/README.md diff --git a/Session.sln b/src/Session/Session.sln similarity index 100% rename from Session.sln rename to src/Session/Session.sln diff --git a/build/Key.snk b/src/Session/build/Key.snk similarity index 100% rename from build/Key.snk rename to src/Session/build/Key.snk diff --git a/build/dependencies.props b/src/Session/build/dependencies.props similarity index 100% rename from build/dependencies.props rename to src/Session/build/dependencies.props diff --git a/build/repo.props b/src/Session/build/repo.props similarity index 100% rename from build/repo.props rename to src/Session/build/repo.props diff --git a/build/sources.props b/src/Session/build/sources.props similarity index 100% rename from build/sources.props rename to src/Session/build/sources.props diff --git a/samples/SessionSample/Properties/launchSettings.json b/src/Session/samples/SessionSample/Properties/launchSettings.json similarity index 100% rename from samples/SessionSample/Properties/launchSettings.json rename to src/Session/samples/SessionSample/Properties/launchSettings.json diff --git a/samples/SessionSample/SessionSample.csproj b/src/Session/samples/SessionSample/SessionSample.csproj similarity index 100% rename from samples/SessionSample/SessionSample.csproj rename to src/Session/samples/SessionSample/SessionSample.csproj diff --git a/samples/SessionSample/Startup.cs b/src/Session/samples/SessionSample/Startup.cs similarity index 100% rename from samples/SessionSample/Startup.cs rename to src/Session/samples/SessionSample/Startup.cs diff --git a/src/Directory.Build.props b/src/Session/src/Directory.Build.props similarity index 100% rename from src/Directory.Build.props rename to src/Session/src/Directory.Build.props diff --git a/src/Microsoft.AspNetCore.Session/CookieProtection.cs b/src/Session/src/Microsoft.AspNetCore.Session/CookieProtection.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/CookieProtection.cs rename to src/Session/src/Microsoft.AspNetCore.Session/CookieProtection.cs diff --git a/src/Microsoft.AspNetCore.Session/DistributedSession.cs b/src/Session/src/Microsoft.AspNetCore.Session/DistributedSession.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/DistributedSession.cs rename to src/Session/src/Microsoft.AspNetCore.Session/DistributedSession.cs diff --git a/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs b/src/Session/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs rename to src/Session/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs diff --git a/src/Microsoft.AspNetCore.Session/EncodedKey.cs b/src/Session/src/Microsoft.AspNetCore.Session/EncodedKey.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/EncodedKey.cs rename to src/Session/src/Microsoft.AspNetCore.Session/EncodedKey.cs diff --git a/src/Microsoft.AspNetCore.Session/ISessionStore.cs b/src/Session/src/Microsoft.AspNetCore.Session/ISessionStore.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/ISessionStore.cs rename to src/Session/src/Microsoft.AspNetCore.Session/ISessionStore.cs diff --git a/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs b/src/Session/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/LoggingExtensions.cs rename to src/Session/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs diff --git a/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Session/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj similarity index 100% rename from src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj rename to src/Session/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj diff --git a/src/Microsoft.AspNetCore.Session/NoOpSessionStore.cs b/src/Session/src/Microsoft.AspNetCore.Session/NoOpSessionStore.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/NoOpSessionStore.cs rename to src/Session/src/Microsoft.AspNetCore.Session/NoOpSessionStore.cs diff --git a/src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs b/src/Session/src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs rename to src/Session/src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs diff --git a/src/Microsoft.AspNetCore.Session/Resources.resx b/src/Session/src/Microsoft.AspNetCore.Session/Resources.resx similarity index 100% rename from src/Microsoft.AspNetCore.Session/Resources.resx rename to src/Session/src/Microsoft.AspNetCore.Session/Resources.resx diff --git a/src/Microsoft.AspNetCore.Session/SessionDefaults.cs b/src/Session/src/Microsoft.AspNetCore.Session/SessionDefaults.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/SessionDefaults.cs rename to src/Session/src/Microsoft.AspNetCore.Session/SessionDefaults.cs diff --git a/src/Microsoft.AspNetCore.Session/SessionFeature.cs b/src/Session/src/Microsoft.AspNetCore.Session/SessionFeature.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/SessionFeature.cs rename to src/Session/src/Microsoft.AspNetCore.Session/SessionFeature.cs diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs b/src/Session/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/SessionMiddleware.cs rename to src/Session/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs diff --git a/src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs b/src/Session/src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs rename to src/Session/src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs diff --git a/src/Microsoft.AspNetCore.Session/SessionOptions.cs b/src/Session/src/Microsoft.AspNetCore.Session/SessionOptions.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/SessionOptions.cs rename to src/Session/src/Microsoft.AspNetCore.Session/SessionOptions.cs diff --git a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs b/src/Session/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs rename to src/Session/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs diff --git a/src/Microsoft.AspNetCore.Session/SipHash.cs b/src/Session/src/Microsoft.AspNetCore.Session/SipHash.cs similarity index 100% rename from src/Microsoft.AspNetCore.Session/SipHash.cs rename to src/Session/src/Microsoft.AspNetCore.Session/SipHash.cs diff --git a/src/Microsoft.AspNetCore.Session/baseline.netcore.json b/src/Session/src/Microsoft.AspNetCore.Session/baseline.netcore.json similarity index 100% rename from src/Microsoft.AspNetCore.Session/baseline.netcore.json rename to src/Session/src/Microsoft.AspNetCore.Session/baseline.netcore.json diff --git a/test/Directory.Build.props b/src/Session/test/Directory.Build.props similarity index 100% rename from test/Directory.Build.props rename to src/Session/test/Directory.Build.props diff --git a/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/src/Session/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj similarity index 100% rename from test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj rename to src/Session/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj diff --git a/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/src/Session/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs similarity index 100% rename from test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs rename to src/Session/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs diff --git a/version.props b/src/Session/version.props similarity index 100% rename from version.props rename to src/Session/version.props