Merge branch 'dev' of github.com:aspnet/Diagnostics into dev

This commit is contained in:
ajcvickers 2015-04-07 21:51:30 -07:00
commit c72add2736
40 changed files with 250 additions and 259 deletions

4
.travis.yml Normal file
View File

@ -0,0 +1,4 @@
language: csharp
sudo: false
script:
- ./build.sh --quiet verify

View File

@ -1,5 +1,8 @@
ASP.NET DiagnosticsPages ASP.NET DiagnosticsPages
================ ================
AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/5224cefq6y78aq21/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/Diagnostics/branch/dev)
Travis: [![Travis](https://travis-ci.org/aspnet/Diagnostics.svg?branch=dev)](https://travis-ci.org/aspnet/Diagnostics)
Diagnostics middleware. Diagnostics middleware.

7
appveyor.yml Normal file
View File

@ -0,0 +1,7 @@
init:
- git config --global core.autocrlf true
build_script:
- build.cmd --quiet verify
clone_depth: 1
test: off
deploy: off

0
build.sh Normal file → Executable file
View File

View File

@ -1,3 +1,3 @@
{ {
"sources": ["src"] "projects": ["src"]
} }

View File

@ -4,7 +4,7 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>427cdb36-78b0-4583-9ebc-7f283de60355</ProjectGuid> <ProjectGuid>427cdb36-78b0-4583-9ebc-7f283de60355</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -14,5 +14,5 @@
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>62671</DevelopmentServerPort> <DevelopmentServerPort>62671</DevelopmentServerPort>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> </Project>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>589ac17f-9455-4764-8f82-fcd2ae58da14</ProjectGuid> <ProjectGuid>589ac17f-9455-4764-8f82-fcd2ae58da14</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -13,5 +13,5 @@
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> </Project>

View File

@ -4,7 +4,7 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>cd62a191-39f5-4c86-bc1d-7731085120f5</ProjectGuid> <ProjectGuid>cd62a191-39f5-4c86-bc1d-7731085120f5</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -14,5 +14,5 @@
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>62670</DevelopmentServerPort> <DevelopmentServerPort>62670</DevelopmentServerPort>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> </Project>

View File

@ -4,10 +4,9 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>cc1f5841-fe10-4ddb-8477-c4de92ba759f</ProjectGuid> <ProjectGuid>cc1f5841-fe10-4ddb-8477-c4de92ba759f</ProjectGuid>
<RootNamespace>StatusCodePagesSample</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath> <OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup> </PropertyGroup>
@ -15,10 +14,5 @@
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>21211</DevelopmentServerPort> <DevelopmentServerPort>21211</DevelopmentServerPort>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
<ProjectExtensions>
<VisualStudio>
<UserProperties project_1json__JSONSchema="http://www.asp.net/media/4878834/project.json" />
</VisualStudio>
</ProjectExtensions>
</Project> </Project>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>c5f59cba-df2d-4983-8cbb-11b6af21b416</ProjectGuid> <ProjectGuid>c5f59cba-df2d-4983-8cbb-11b6af21b416</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -13,5 +13,5 @@
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> </Project>

View File

@ -57,7 +57,7 @@ namespace Microsoft.AspNet.Diagnostics.Elm
return _options.Filter(_name, logLevel); return _options.Filter(_name, logLevel);
} }
public IDisposable BeginScope(object state) public IDisposable BeginScopeImpl(object state)
{ {
var scope = new ElmScope(_name, state); var scope = new ElmScope(_name, state);
scope.Context = ElmScope.Current?.Context ?? GetNewActivityContext(); scope.Context = ElmScope.Current?.Context ?? GetNewActivityContext();

View File

@ -10,26 +10,25 @@ namespace Microsoft.Framework.DependencyInjection
public static class ElmServiceCollectionExtensions public static class ElmServiceCollectionExtensions
{ {
/// <summary> /// <summary>
/// Registers an <see cref="ElmStore"/> and configures <see cref="ElmOptions"/>. /// Registers an <see cref="ElmStore"/> and configures default <see cref="ElmOptions"/>.
/// </summary> /// </summary>
public static IServiceCollection AddElm([NotNull] this IServiceCollection services) public static IServiceCollection AddElm([NotNull] this IServiceCollection services)
{ {
return services.AddElm(configureOptions: null); services.AddOptions();
services.AddSingleton<ElmStore>();
return services;
} }
/// <summary> /// <summary>
/// Registers an <see cref="ElmStore"/> and configures <see cref="ElmOptions"/>. /// Configures a set of <see cref="ElmOptions"/> for the application.
/// </summary> /// </summary>
public static IServiceCollection AddElm([NotNull] this IServiceCollection services, Action<ElmOptions> configureOptions) /// <param name="services">The services available in the application.</param>
/// <param name="configureOptions">The <see cref="ElmOptions"/> which need to be configured.</param>
public static void ConfigureElm(
[NotNull] this IServiceCollection services,
[NotNull] Action<ElmOptions> configureOptions)
{ {
services.AddSingleton<ElmStore>(); // registering the service so it can be injected into constructors services.Configure(configureOptions);
if (configureOptions != null)
{
services.Configure(configureOptions);
}
return services;
} }
} }
} }

View File

@ -4,7 +4,7 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>624b0019-956a-4157-b008-270c5b229553</ProjectGuid> <ProjectGuid>624b0019-956a-4157-b008-270c5b229553</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -13,5 +13,5 @@
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> </Project>

View File

@ -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")]

View File

@ -62,7 +62,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity
return true; return true;
} }
public virtual IDisposable BeginScope(object state) public virtual IDisposable BeginScopeImpl(object state)
{ {
return NullScope.Instance; return NullScope.Instance;
} }

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>4f5a6a72-ffe4-49c4-b4c6-58132cfcb9fe</ProjectGuid> <ProjectGuid>4f5a6a72-ffe4-49c4-b4c6-58132cfcb9fe</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -13,5 +13,5 @@
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> </Project>

View File

@ -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")]

View File

@ -8,7 +8,7 @@
"Microsoft.AspNet.Diagnostics": "1.0.0-*", "Microsoft.AspNet.Diagnostics": "1.0.0-*",
"EntityFramework.Relational": "7.0.0-*" "EntityFramework.Relational": "7.0.0-*"
}, },
"code": [ "**\\*.cs", "..\\Shared\\*.cs" ], "compile": [ "..\\Shared\\*.cs" ],
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"frameworkAssemblies": { "frameworkAssemblies": {

View File

@ -1,18 +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.Collections.Generic;
namespace Microsoft.AspNet.Diagnostics
{
/// <summary>
/// Specifies the contract for an exception representing compilation failure.
/// </summary>
public interface ICompilationException
{
/// <summary>
/// Gets a sequence of <see cref="ICompilationFailure"/> with compilation failures.
/// </summary>
IEnumerable<ICompilationFailure> CompilationFailures { get; }
}
}

View File

@ -1,38 +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.Collections.Generic;
namespace Microsoft.AspNet.Diagnostics
{
/// <summary>
/// Specifies the contract for a file that fails compilation.
/// </summary>
public interface ICompilationFailure
{
/// <summary>
/// Path of the file that produced the compilation exception.
/// </summary>
string SourceFilePath { get; }
/// <summary>
/// Contents of the file.
/// </summary>
string SourceFileContent { get; }
/// <summary>
/// Contents being compiled.
/// </summary>
/// <remarks>
/// For templated files, the <see cref="SourceFileContent"/> represents the original content and
/// <see cref="CompiledContent"/> represents the transformed content. This property can be null if
/// the exception is encountered during transformation.
/// </remarks>
string CompiledContent { get; }
/// <summary>
/// Gets a sequence of <see cref="ICompilationMessage"/> produced as a result of compilation.
/// </summary>
IEnumerable<ICompilationMessage> Messages { get; }
}
}

View File

@ -1,37 +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.
namespace Microsoft.AspNet.Diagnostics
{
/// <summary>
/// Specifies the contract for diagnostic messages produced as result of compiling an instance
/// of <see cref="ICompilationFailure"/>.
/// </summary>
public interface ICompilationMessage
{
/// <summary>
/// Gets the error message.
/// </summary>
string Message { get; }
/// <summary>
/// Gets the zero-based line index for the start of the compilation error.
/// </summary>
int StartLine { get; }
/// <summary>
/// Gets the zero-based column index for the start of the compilation error.
/// </summary>
int StartColumn { get; }
/// <summary>
/// Gets the zero-based line index for the end of the compilation error.
/// </summary>
int EndLine { get; }
/// <summary>
/// Gets the zero-based column index for the end of the compilation error.
/// </summary>
int EndColumn { get; }
}
}

View File

@ -4,17 +4,14 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>83ffb65a-97b1-45aa-bcb8-3f43966bc8a3</ProjectGuid> <ProjectGuid>83ffb65a-97b1-45aa-bcb8-3f43966bc8a3</ProjectGuid>
<RootNamespace>Microsoft.AspNet.Diagnostics.Interfaces</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath> <OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> </Project>

View File

@ -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")]

View File

@ -12,6 +12,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Diagnostics.Views; using Microsoft.AspNet.Diagnostics.Views;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.Framework.Runtime;
namespace Microsoft.AspNet.Diagnostics namespace Microsoft.AspNet.Diagnostics
{ {

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>68a1f0e1-ecce-46d1-b20f-c43ee5b097de</ProjectGuid> <ProjectGuid>68a1f0e1-ecce-46d1-b20f-c43ee5b097de</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -13,5 +13,5 @@
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> </Project>

View File

@ -1,7 +1,9 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNet.Diagnostics.Tests")] [assembly: InternalsVisibleTo("Microsoft.AspNet.Diagnostics.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
[assembly: AssemblyMetadata("Serviceable", "True")]

View File

@ -81,49 +81,27 @@ using Views
#line hidden #line hidden
#line 28 "CompilationErrorPage.cshtml" #line 28 "CompilationErrorPage.cshtml"
if (Model.Options.ShowExceptionDetails) if (!Model.Options.ShowExceptionDetails)
{
#line default
#line hidden
WriteLiteral(" <div class=\"titleerror\">");
#line 30 "CompilationErrorPage.cshtml"
Write(errorDetail.Error.GetType().Name);
#line default
#line hidden
WriteLiteral(": ");
#line 30 "CompilationErrorPage.cshtml"
Output.Write(HtmlEncodeAndReplaceLineBreaks(errorDetail.Error.Message));
#line default
#line hidden
WriteLiteral("</div>\r\n");
#line 31 "CompilationErrorPage.cshtml"
}
else
{ {
#line default #line default
#line hidden #line hidden
WriteLiteral(" <h2>"); WriteLiteral(" <h2>");
#line 34 "CompilationErrorPage.cshtml" #line 30 "CompilationErrorPage.cshtml"
Write(Resources.ErrorPageHtml_EnableShowExceptions); Write(Resources.ErrorPageHtml_EnableShowExceptions);
#line default #line default
#line hidden #line hidden
WriteLiteral("</h2>\r\n"); WriteLiteral("</h2>\r\n");
#line 35 "CompilationErrorPage.cshtml" #line 31 "CompilationErrorPage.cshtml"
} }
#line default #line default
#line hidden #line hidden
WriteLiteral(" "); WriteLiteral(" ");
#line 36 "CompilationErrorPage.cshtml" #line 32 "CompilationErrorPage.cshtml"
if (Model.Options.ShowExceptionDetails) if (Model.Options.ShowExceptionDetails)
{ {
@ -131,26 +109,56 @@ using Views
#line hidden #line hidden
WriteLiteral(" <div id=\"stackpage\" class=\"page\">\r\n"); WriteLiteral(" <div id=\"stackpage\" class=\"page\">\r\n");
#line 39 "CompilationErrorPage.cshtml" #line 35 "CompilationErrorPage.cshtml"
#line default #line default
#line hidden #line hidden
#line 39 "CompilationErrorPage.cshtml" #line 35 "CompilationErrorPage.cshtml"
int tabIndex = 6; int tabIndex = 6;
#line default #line default
#line hidden #line hidden
WriteLiteral("\r\n <br />\r\n <ul>\r\n"); WriteLiteral("\r\n");
#line 42 "CompilationErrorPage.cshtml" #line 36 "CompilationErrorPage.cshtml"
#line default #line default
#line hidden #line hidden
#line 42 "CompilationErrorPage.cshtml" #line 36 "CompilationErrorPage.cshtml"
var fileName = errorDetail.StackFrames.FirstOrDefault()?.File;
if (!string.IsNullOrEmpty(fileName))
{
#line default
#line hidden
WriteLiteral(" <div class=\"titleerror\">");
#line 40 "CompilationErrorPage.cshtml"
Write(fileName);
#line default
#line hidden
WriteLiteral("</div>\r\n");
#line 41 "CompilationErrorPage.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n <br />\r\n <ul>\r\n");
#line 45 "CompilationErrorPage.cshtml"
#line default
#line hidden
#line 45 "CompilationErrorPage.cshtml"
foreach (var frame in errorDetail.StackFrames) foreach (var frame in errorDetail.StackFrames)
{ {
@ -158,29 +166,29 @@ using Views
#line hidden #line hidden
WriteLiteral(" <li class=\"frame\""); WriteLiteral(" <li class=\"frame\"");
WriteAttribute("tabindex", Tuple.Create(" tabindex=\"", 1308), Tuple.Create("\"", 1328), WriteAttribute("tabindex", Tuple.Create(" tabindex=\"", 1409), Tuple.Create("\"", 1429),
Tuple.Create(Tuple.Create("", 1319), Tuple.Create<System.Object, System.Int32>(tabIndex, 1319), false)); Tuple.Create(Tuple.Create("", 1420), Tuple.Create<System.Object, System.Int32>(tabIndex, 1420), false));
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 45 "CompilationErrorPage.cshtml" #line 48 "CompilationErrorPage.cshtml"
#line default #line default
#line hidden #line hidden
#line 45 "CompilationErrorPage.cshtml" #line 48 "CompilationErrorPage.cshtml"
tabIndex++; tabIndex++;
#line default #line default
#line hidden #line hidden
WriteLiteral("\r\n"); WriteLiteral("\r\n");
#line 46 "CompilationErrorPage.cshtml" #line 49 "CompilationErrorPage.cshtml"
#line default #line default
#line hidden #line hidden
#line 46 "CompilationErrorPage.cshtml" #line 49 "CompilationErrorPage.cshtml"
if (!string.IsNullOrEmpty(frame.ErrorDetails)) if (!string.IsNullOrEmpty(frame.ErrorDetails))
{ {
@ -188,13 +196,13 @@ using Views
#line hidden #line hidden
WriteLiteral(" <h3>"); WriteLiteral(" <h3>");
#line 48 "CompilationErrorPage.cshtml" #line 51 "CompilationErrorPage.cshtml"
Write(frame.ErrorDetails); Write(frame.ErrorDetails);
#line default #line default
#line hidden #line hidden
WriteLiteral("</h3>\r\n"); WriteLiteral("</h3>\r\n");
#line 49 "CompilationErrorPage.cshtml" #line 52 "CompilationErrorPage.cshtml"
} }
else else
{ {
@ -205,13 +213,13 @@ using Views
#line hidden #line hidden
WriteLiteral(" <h3>"); WriteLiteral(" <h3>");
#line 54 "CompilationErrorPage.cshtml" #line 57 "CompilationErrorPage.cshtml"
Write(frame.Function); Write(frame.Function);
#line default #line default
#line hidden #line hidden
WriteLiteral("</h3>\r\n"); WriteLiteral("</h3>\r\n");
#line 55 "CompilationErrorPage.cshtml" #line 58 "CompilationErrorPage.cshtml"
} }
else else
{ {
@ -220,22 +228,22 @@ using Views
#line hidden #line hidden
WriteLiteral(" <h3>"); WriteLiteral(" <h3>");
#line 58 "CompilationErrorPage.cshtml" #line 61 "CompilationErrorPage.cshtml"
Write(frame.Function); Write(frame.Function);
#line default #line default
#line hidden #line hidden
WriteLiteral(" in <code"); WriteLiteral(" in <code");
WriteAttribute("title", Tuple.Create(" title=\"", 1928), Tuple.Create("\"", 1947), WriteAttribute("title", Tuple.Create(" title=\"", 2029), Tuple.Create("\"", 2048),
Tuple.Create(Tuple.Create("", 1936), Tuple.Create<System.Object, System.Int32>(frame.File, 1936), false)); Tuple.Create(Tuple.Create("", 2037), Tuple.Create<System.Object, System.Int32>(frame.File, 2037), false));
WriteLiteral(">"); WriteLiteral(">");
#line 58 "CompilationErrorPage.cshtml" #line 61 "CompilationErrorPage.cshtml"
Write(System.IO.Path.GetFileName(frame.File)); Write(System.IO.Path.GetFileName(frame.File));
#line default #line default
#line hidden #line hidden
WriteLiteral("</code></h3>\r\n"); WriteLiteral("</code></h3>\r\n");
#line 59 "CompilationErrorPage.cshtml" #line 62 "CompilationErrorPage.cshtml"
} }
} }
@ -243,7 +251,7 @@ using Views
#line hidden #line hidden
WriteLiteral(" "); WriteLiteral(" ");
#line 61 "CompilationErrorPage.cshtml" #line 64 "CompilationErrorPage.cshtml"
if (frame.Line != 0 && frame.ContextCode.Any()) if (frame.Line != 0 && frame.ContextCode.Any())
{ {
@ -251,13 +259,13 @@ using Views
#line hidden #line hidden
WriteLiteral(" <div class=\"source\">\r\n"); WriteLiteral(" <div class=\"source\">\r\n");
#line 64 "CompilationErrorPage.cshtml" #line 67 "CompilationErrorPage.cshtml"
#line default #line default
#line hidden #line hidden
#line 64 "CompilationErrorPage.cshtml" #line 67 "CompilationErrorPage.cshtml"
if (frame.PreContextCode != null) if (frame.PreContextCode != null)
{ {
@ -265,16 +273,16 @@ using Views
#line hidden #line hidden
WriteLiteral(" <ol"); WriteLiteral(" <ol");
WriteAttribute("start", Tuple.Create(" start=\"", 2353), Tuple.Create("\"", 2382), WriteAttribute("start", Tuple.Create(" start=\"", 2454), Tuple.Create("\"", 2483),
Tuple.Create(Tuple.Create("", 2361), Tuple.Create<System.Object, System.Int32>(frame.PreContextLine, 2361), false)); Tuple.Create(Tuple.Create("", 2462), Tuple.Create<System.Object, System.Int32>(frame.PreContextLine, 2462), false));
WriteLiteral(" class=\"collapsible\">\r\n"); WriteLiteral(" class=\"collapsible\">\r\n");
#line 67 "CompilationErrorPage.cshtml" #line 70 "CompilationErrorPage.cshtml"
#line default #line default
#line hidden #line hidden
#line 67 "CompilationErrorPage.cshtml" #line 70 "CompilationErrorPage.cshtml"
foreach (var line in frame.PreContextCode) foreach (var line in frame.PreContextCode)
{ {
@ -282,36 +290,36 @@ using Views
#line hidden #line hidden
WriteLiteral(" <li><span>"); WriteLiteral(" <li><span>");
#line 69 "CompilationErrorPage.cshtml" #line 72 "CompilationErrorPage.cshtml"
Write(line); Write(line);
#line default #line default
#line hidden #line hidden
WriteLiteral("</span></li>\r\n"); WriteLiteral("</span></li>\r\n");
#line 70 "CompilationErrorPage.cshtml" #line 73 "CompilationErrorPage.cshtml"
} }
#line default #line default
#line hidden #line hidden
WriteLiteral(" </ol>\r\n"); WriteLiteral(" </ol>\r\n");
#line 72 "CompilationErrorPage.cshtml" #line 75 "CompilationErrorPage.cshtml"
} }
#line default #line default
#line hidden #line hidden
WriteLiteral(" <ol"); WriteLiteral(" <ol");
WriteAttribute("start", Tuple.Create(" start=\"", 2763), Tuple.Create("\"", 2782), WriteAttribute("start", Tuple.Create(" start=\"", 2864), Tuple.Create("\"", 2883),
Tuple.Create(Tuple.Create("", 2771), Tuple.Create<System.Object, System.Int32>(frame.Line, 2771), false)); Tuple.Create(Tuple.Create("", 2872), Tuple.Create<System.Object, System.Int32>(frame.Line, 2872), false));
WriteLiteral(" class=\"highlight\">\r\n"); WriteLiteral(" class=\"highlight\">\r\n");
#line 74 "CompilationErrorPage.cshtml" #line 77 "CompilationErrorPage.cshtml"
#line default #line default
#line hidden #line hidden
#line 74 "CompilationErrorPage.cshtml" #line 77 "CompilationErrorPage.cshtml"
foreach (var line in frame.ContextCode) foreach (var line in frame.ContextCode)
{ {
@ -319,26 +327,26 @@ using Views
#line hidden #line hidden
WriteLiteral(" <li><span>"); WriteLiteral(" <li><span>");
#line 76 "CompilationErrorPage.cshtml" #line 79 "CompilationErrorPage.cshtml"
Write(line); Write(line);
#line default #line default
#line hidden #line hidden
WriteLiteral("</span></li>\r\n"); WriteLiteral("</span></li>\r\n");
#line 77 "CompilationErrorPage.cshtml" #line 80 "CompilationErrorPage.cshtml"
} }
#line default #line default
#line hidden #line hidden
WriteLiteral(" </ol>\r\n"); WriteLiteral(" </ol>\r\n");
#line 79 "CompilationErrorPage.cshtml" #line 82 "CompilationErrorPage.cshtml"
#line default #line default
#line hidden #line hidden
#line 79 "CompilationErrorPage.cshtml" #line 82 "CompilationErrorPage.cshtml"
if (frame.PostContextCode != null) if (frame.PostContextCode != null)
{ {
@ -346,16 +354,16 @@ using Views
#line hidden #line hidden
WriteLiteral(" <ol"); WriteLiteral(" <ol");
WriteAttribute("start", Tuple.Create(" start=\'", 3211), Tuple.Create("\'", 3236), WriteAttribute("start", Tuple.Create(" start=\'", 3312), Tuple.Create("\'", 3337),
Tuple.Create(Tuple.Create("", 3219), Tuple.Create<System.Object, System.Int32>(frame.Line + 1, 3219), false)); Tuple.Create(Tuple.Create("", 3320), Tuple.Create<System.Object, System.Int32>(frame.Line + 1, 3320), false));
WriteLiteral(" class=\"collapsible\">\r\n"); WriteLiteral(" class=\"collapsible\">\r\n");
#line 82 "CompilationErrorPage.cshtml" #line 85 "CompilationErrorPage.cshtml"
#line default #line default
#line hidden #line hidden
#line 82 "CompilationErrorPage.cshtml" #line 85 "CompilationErrorPage.cshtml"
foreach (var line in frame.PostContextCode) foreach (var line in frame.PostContextCode)
{ {
@ -363,41 +371,41 @@ using Views
#line hidden #line hidden
WriteLiteral(" <li><span>"); WriteLiteral(" <li><span>");
#line 84 "CompilationErrorPage.cshtml" #line 87 "CompilationErrorPage.cshtml"
Write(line); Write(line);
#line default #line default
#line hidden #line hidden
WriteLiteral("</span></li>\r\n"); WriteLiteral("</span></li>\r\n");
#line 85 "CompilationErrorPage.cshtml" #line 88 "CompilationErrorPage.cshtml"
} }
#line default #line default
#line hidden #line hidden
WriteLiteral(" </ol>\r\n"); WriteLiteral(" </ol>\r\n");
#line 87 "CompilationErrorPage.cshtml" #line 90 "CompilationErrorPage.cshtml"
} }
#line default #line default
#line hidden #line hidden
WriteLiteral(" </div>\r\n"); WriteLiteral(" </div>\r\n");
#line 89 "CompilationErrorPage.cshtml" #line 92 "CompilationErrorPage.cshtml"
} }
#line default #line default
#line hidden #line hidden
WriteLiteral(" </li>\r\n"); WriteLiteral(" </li>\r\n");
#line 91 "CompilationErrorPage.cshtml" #line 94 "CompilationErrorPage.cshtml"
} }
#line default #line default
#line hidden #line hidden
WriteLiteral(" </ul>\r\n </div>\r\n"); WriteLiteral(" </ul>\r\n </div>\r\n");
#line 94 "CompilationErrorPage.cshtml" #line 97 "CompilationErrorPage.cshtml"
} }
#line default #line default

View File

@ -25,11 +25,7 @@
</head> </head>
<body> <body>
<h1>@Resources.ErrorPageHtml_CompilationException</h1> <h1>@Resources.ErrorPageHtml_CompilationException</h1>
@if (Model.Options.ShowExceptionDetails) @if (!Model.Options.ShowExceptionDetails)
{
<div class="titleerror">@errorDetail.Error.GetType().Name: @{ Output.Write(HtmlEncodeAndReplaceLineBreaks(errorDetail.Error.Message)); }</div>
}
else
{ {
<h2>@Resources.ErrorPageHtml_EnableShowExceptions</h2> <h2>@Resources.ErrorPageHtml_EnableShowExceptions</h2>
} }
@ -37,6 +33,13 @@
{ {
<div id="stackpage" class="page"> <div id="stackpage" class="page">
@{ int tabIndex = 6; } @{ int tabIndex = 6; }
@{
var fileName = errorDetail.StackFrames.FirstOrDefault()?.File;
if (!string.IsNullOrEmpty(fileName))
{
<div class="titleerror">@fileName</div>
}
}
<br /> <br />
<ul> <ul>
@foreach (var frame in errorDetail.StackFrames) @foreach (var frame in errorDetail.StackFrames)

View File

@ -4,7 +4,7 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>4d4a785a-ecb9-4916-a88f-0fd306ee3b74</ProjectGuid> <ProjectGuid>4d4a785a-ecb9-4916-a88f-0fd306ee3b74</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -14,5 +14,5 @@
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>0</DevelopmentServerPort> <DevelopmentServerPort>0</DevelopmentServerPort>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> </Project>

View File

@ -188,7 +188,14 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
{ {
services.AddEntityFramework().AddSqlServer(); services.AddEntityFramework().AddSqlServer();
var optionsBuilder = new DbContextOptionsBuilder(); var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseSqlServer(database.ConnectionString); if (!PlatformHelper.IsMono)
{
optionsBuilder.UseSqlServer(database.ConnectionString);
}
else
{
optionsBuilder.UseInMemoryStore();
}
services.AddInstance<DbContextOptions>(optionsBuilder.Options); services.AddInstance<DbContextOptions>(optionsBuilder.Options);
}); });
@ -309,7 +316,14 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
services.AddScoped<TContext>(); services.AddScoped<TContext>();
var optionsBuilder = new DbContextOptionsBuilder(); var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseSqlServer(database.ConnectionString); if (!PlatformHelper.IsMono)
{
optionsBuilder.UseSqlServer(database.ConnectionString);
}
else
{
optionsBuilder.UseInMemoryStore();
}
services.AddInstance(optionsBuilder.Options); services.AddInstance(optionsBuilder.Options);
}); });
} }

View File

@ -0,0 +1,18 @@
// 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.Diagnostics.Entity.FunctionalTests.Helpers
{
public class PlatformHelper
{
public static bool IsMono
{
get
{
return Type.GetType("Mono.Runtime") != null;
}
}
}
}

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.FunctionalTests.Helpers
return true; return true;
} }
public IDisposable BeginScope(object state) public IDisposable BeginScopeImpl(object state)
{ {
return NullScope.Instance; return NullScope.Instance;
} }

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>2f9b479d-8247-4210-804b-78e6dd5c3e98</ProjectGuid> <ProjectGuid>2f9b479d-8247-4210-804b-78e6dd5c3e98</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -13,5 +13,5 @@
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project> </Project>

View File

@ -4,8 +4,8 @@
using System; using System;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Threading; using System.Threading;
using Microsoft.AspNet.Diagnostics.Entity.FunctionalTests.Helpers;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
namespace Microsoft.AspNet.Diagnostics.Entity.Tests namespace Microsoft.AspNet.Diagnostics.Entity.Tests
{ {
@ -17,7 +17,6 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
{ {
var name = "Microsoft.AspNet.Diagnostics.Entity.FunctionalTests.Scratch_" + Interlocked.Increment(ref _scratchCount); var name = "Microsoft.AspNet.Diagnostics.Entity.FunctionalTests.Scratch_" + Interlocked.Increment(ref _scratchCount);
var db = new SqlServerTestStore(name); var db = new SqlServerTestStore(name);
db.EnsureDeleted();
return db; return db;
} }
@ -31,7 +30,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
InitialCatalog = name, InitialCatalog = name,
IntegratedSecurity = true, IntegratedSecurity = true,
ConnectTimeout = 30 ConnectTimeout = 30
}.ConnectionString; ; }.ConnectionString;
} }
public string ConnectionString public string ConnectionString
@ -41,12 +40,15 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
private void EnsureDeleted() private void EnsureDeleted()
{ {
var optionsBuilder = new DbContextOptionsBuilder(); if (!PlatformHelper.IsMono)
optionsBuilder.UseSqlServer(_connectionString);
using (var db = new DbContext(optionsBuilder.Options))
{ {
db.Database.EnsureDeleted(); var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseSqlServer(_connectionString);
using (var db = new DbContext(optionsBuilder.Options))
{
db.Database.EnsureDeleted();
}
} }
} }

View File

@ -73,10 +73,10 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
migrationBuilder.CreateTable("Blog", migrationBuilder.CreateTable("Blog",
c => new c => new
{ {
BlogId = c.Column("int", annotations: new Dictionary<string, string> { { "SqlServer:ValueGeneration", "Identity" } }), BlogId = c.Column("int").Annotation("SqlServer:ValueGeneration", "Identity"),
Name = c.Column("nvarchar(max)", nullable: true), Name = c.Column("nvarchar(max)", nullable: true),
}) })
.PrimaryKey(t => t.BlogId, name: "PK_Blog"); .PrimaryKey("PK_Blog", t => t.BlogId);
} }
public override void Down(MigrationBuilder migrationBuilder) public override void Down(MigrationBuilder migrationBuilder)

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>5486117b-a742-49e0-94fc-12b76f061803</ProjectGuid> <ProjectGuid>5486117b-a742-49e0-94fc-12b76f061803</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -13,5 +13,8 @@
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <ItemGroup>
</Project> <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -5,7 +5,7 @@
"Moq": "4.2.1312.1622", "Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*" "xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"code": [ "**\\*.cs", "..\\Shared\\ApiConsistencyTestBase.cs", "..\\Shared\\TestHelpers.cs" ], "compile": [ "..\\Shared\\ApiConsistencyTestBase.cs", "..\\Shared\\TestHelpers.cs" ],
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },

View File

@ -179,9 +179,15 @@ namespace Microsoft.AspNet.Diagnostics.Tests
// Assert // Assert
// get the root of the activity for scope "test2" // get the root of the activity for scope "test2"
var root1 = (store.GetActivities()).Where(a => a.Root.State.Equals("test2"))?.FirstOrDefault()?.Root; var root1 = (store.GetActivities())
.Where(a => string.Equals(a.Root.State?.ToString(), "test2"))?
.FirstOrDefault()?
.Root;
Assert.NotNull(root1); Assert.NotNull(root1);
var root2 = (store.GetActivities()).Where(a => a.Root.State.Equals("test12"))?.FirstOrDefault()?.Root; var root2 = (store.GetActivities())
.Where(a => string.Equals(a.Root.State?.ToString(), "test12"))?
.FirstOrDefault()?
.Root;
Assert.NotNull(root2); Assert.NotNull(root2);
Assert.Equal(0, root1.Children.Count); Assert.Equal(0, root1.Children.Count);
@ -269,7 +275,9 @@ namespace Microsoft.AspNet.Diagnostics.Tests
// Assert // Assert
Assert.Single(store.GetActivities()); Assert.Single(store.GetActivities());
var context = store.GetActivities().Where(a => a.Root.State.Equals("test8")).First(); var context = store.GetActivities()
.Where(a => string.Equals(a.Root.State?.ToString(), "test8"))
.First();
Assert.Empty(context.Root.Children); Assert.Empty(context.Root.Children);
} }

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>994351b4-7b2a-4139-8b72-72c5bb5cc618</ProjectGuid> <ProjectGuid>994351b4-7b2a-4139-8b72-72c5bb5cc618</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
@ -13,5 +13,8 @@
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" /> <ItemGroup>
</Project> <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -1,6 +1,6 @@
{ {
"compilationOptions": { "compilationOptions": {
"warningsAsErrors": true "warningsAsErrors": "true"
}, },
"dependencies": { "dependencies": {
"Microsoft.AspNet.Diagnostics.Elm": "1.0.0-*", "Microsoft.AspNet.Diagnostics.Elm": "1.0.0-*",