-
Notifications
You must be signed in to change notification settings - Fork 2.1k
* Redesign CompilationResult so that it does not throw when CompiledType is accessed #2045
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +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 Microsoft.AspNet.FileProviders; | ||
|
||
namespace Microsoft.AspNet.Mvc.Razor | ||
{ | ||
/// <summary> | ||
|
@@ -13,11 +11,11 @@ public interface ICompilationService | |
/// <summary> | ||
/// Compiles content and returns the result of compilation. | ||
/// </summary> | ||
/// <param name="fileInfo">The <see cref="IFileInfo"/> for the Razor file that was compiled.</param> | ||
/// <param name="fileInfo">The <see cref="RelativeFileInfo"/> for the Razor file that was compiled.</param> | ||
/// <param name="compilationContent">The generated C# content to be compiled.</param> | ||
/// <returns> | ||
/// A <see cref="CompilationResult"/> representing the result of compilation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: "... for the compilation." |
||
/// </returns> | ||
CompilationResult Compile(IFileInfo fileInfo, string compilationContent); | ||
CompilationResult Compile(RelativeFileInfo fileInfo, string compilationContent); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this cleanup part of this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put better, how is move from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's part of the work tiem - #955 (comment). We were relying of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👌 |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// 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; | ||
using Microsoft.Framework.Runtime; | ||
using Microsoft.Framework.Internal; | ||
|
||
namespace Microsoft.AspNet.Mvc.Razor | ||
{ | ||
/// <summary> | ||
/// <see cref="ICompilationFailure"/> for Razor parse failures. | ||
/// </summary> | ||
public class RazorCompilationFailure : ICompilationFailure | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can't see how this class and |
||
{ | ||
/// <summary>Initializes a new instance of <see cref="RazorCompilationFailure"/>.</summary> | ||
/// <param name="sourceFilePath">The path of the Razor source file that was compiled.</param> | ||
/// <param name="sourceFileContent">The contents of the Razor source file.</param> | ||
/// <param name="messages">A sequence of <see cref="ICompilationMessage"/> encountered | ||
/// during compilation.</param> | ||
public RazorCompilationFailure( | ||
[NotNull] string sourceFilePath, | ||
[NotNull] string sourceFileContent, | ||
[NotNull] IEnumerable<RazorCompilationMessage> messages) | ||
{ | ||
SourceFilePath = sourceFilePath; | ||
SourceFileContent = sourceFileContent; | ||
Messages = messages; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public string SourceFilePath { get; } | ||
|
||
/// <inheritdoc /> | ||
public string SourceFileContent { get; } | ||
|
||
/// <inheritdoc /> | ||
public string CompiledContent { get; } = null; | ||
|
||
/// <inheritdoc /> | ||
public IEnumerable<ICompilationMessage> Messages { get; } | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We changed Diagnostics \ Helios to not print compilation messages. So we can do better with showing exception messages in the debugger now.