diff --git a/src/Microsoft.AspNet.Razor/Editor/BackgroundParser.cs b/src/Microsoft.AspNet.Razor/Editor/BackgroundParser.cs index 4dd588faec..ff953d54c6 100644 --- a/src/Microsoft.AspNet.Razor/Editor/BackgroundParser.cs +++ b/src/Microsoft.AspNet.Razor/Editor/BackgroundParser.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.Globalization; using System.IO; using System.Linq; using System.Text; @@ -321,7 +322,7 @@ namespace Microsoft.AspNet.Razor.Editor DocumentParseCompleteEventArgs args = null; using (var linkedCancel = CancellationTokenSource.CreateLinkedTokenSource(_shutdownToken, parcel.CancelToken)) { - if (parcel != null && !linkedCancel.IsCancellationRequested) + if (!linkedCancel.IsCancellationRequested) { // Collect ALL changes #if EDITOR_TRACING @@ -330,60 +331,67 @@ namespace Microsoft.AspNet.Razor.Editor RazorEditorTrace.TraceLine(RazorResources.Trace_CollectedDiscardedChanges, fileNameOnly, _previouslyDiscarded.Count); } #endif - var allChanges = Enumerable.Concat( - _previouslyDiscarded ?? Enumerable.Empty(), parcel.Changes).ToList(); - var finalChange = allChanges.LastOrDefault(); - if (finalChange != null) + List allChanges; + + if (_previouslyDiscarded != null) { + allChanges = Enumerable.Concat(_previouslyDiscarded, parcel.Changes).ToList(); + } + else + { + allChanges = parcel.Changes.ToList(); + } + + TextChange finalChange = allChanges.Last(); +#if EDITOR_TRACING + sw.Start(); +#endif + GeneratorResults results = ParseChange(finalChange.NewBuffer, linkedCancel.Token); +#if EDITOR_TRACING + sw.Stop(); + elapsedMs = sw.ElapsedMilliseconds; + sw.Reset(); +#endif + RazorEditorTrace.TraceLine( + RazorResources.Trace_ParseComplete, + fileNameOnly, + elapsedMs.HasValue ? elapsedMs.Value.ToString(CultureInfo.InvariantCulture) : "?"); + + if (results != null && !linkedCancel.IsCancellationRequested) + { + // Clear discarded changes list + _previouslyDiscarded = null; + + // Take the current tree and check for differences #if EDITOR_TRACING sw.Start(); #endif - GeneratorResults results = ParseChange(finalChange.NewBuffer, linkedCancel.Token); + bool treeStructureChanged = _currentParseTree == null || TreesAreDifferent(_currentParseTree, results.Document, allChanges, parcel.CancelToken); #if EDITOR_TRACING sw.Stop(); elapsedMs = sw.ElapsedMilliseconds; sw.Reset(); #endif - RazorEditorTrace.TraceLine( - RazorResources.Trace_ParseComplete, + _currentParseTree = results.Document; + RazorEditorTrace.TraceLine(RazorResources.Trace_TreesCompared, fileNameOnly, - elapsedMs.HasValue ? elapsedMs.Value.ToString() : "?"); + elapsedMs.HasValue ? elapsedMs.Value.ToString(CultureInfo.InvariantCulture) : "?", + treeStructureChanged); - if (results != null && !linkedCancel.IsCancellationRequested) + // Build Arguments + args = new DocumentParseCompleteEventArgs() { - // Clear discarded changes list - _previouslyDiscarded = null; - - // Take the current tree and check for differences -#if EDITOR_TRACING - sw.Start(); -#endif - bool treeStructureChanged = _currentParseTree == null || TreesAreDifferent(_currentParseTree, results.Document, allChanges, parcel.CancelToken); -#if EDITOR_TRACING - sw.Stop(); - elapsedMs = sw.ElapsedMilliseconds; - sw.Reset(); -#endif - _currentParseTree = results.Document; - RazorEditorTrace.TraceLine(RazorResources.Trace_TreesCompared, - fileNameOnly, - elapsedMs.HasValue ? elapsedMs.Value.ToString() : "?", - treeStructureChanged); - - // Build Arguments - args = new DocumentParseCompleteEventArgs() - { - GeneratorResults = results, - SourceChange = finalChange, - TreeStructureChanged = treeStructureChanged - }; - } - else - { - // Parse completed but we were cancelled in the mean time. Add these to the discarded changes set - RazorEditorTrace.TraceLine(RazorResources.Trace_ChangesDiscarded, fileNameOnly, allChanges.Count); - _previouslyDiscarded = allChanges; - } + GeneratorResults = results, + SourceChange = finalChange, + TreeStructureChanged = treeStructureChanged + }; + } + else + { + // Parse completed but we were cancelled in the mean time. Add these to the discarded changes set + RazorEditorTrace.TraceLine(RazorResources.Trace_ChangesDiscarded, fileNameOnly, allChanges.Count); + _previouslyDiscarded = allChanges; + } #if CHECK_TREE if (args != null) @@ -402,7 +410,6 @@ namespace Microsoft.AspNet.Razor.Editor "Found a span with an absolute offset outside the source file"); } #endif - } } } if (args != null) diff --git a/src/Microsoft.AspNet.Razor/Editor/EditorHints.cs b/src/Microsoft.AspNet.Razor/Editor/EditorHints.cs index 303b78d656..dd41d4717b 100644 --- a/src/Microsoft.AspNet.Razor/Editor/EditorHints.cs +++ b/src/Microsoft.AspNet.Razor/Editor/EditorHints.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; + namespace Microsoft.AspNet.Razor.Editor { /// diff --git a/src/Microsoft.AspNet.Razor/Editor/ImplicitExpressionEditHandler.cs b/src/Microsoft.AspNet.Razor/Editor/ImplicitExpressionEditHandler.cs index fa0ed1c1a2..393820fcb2 100644 --- a/src/Microsoft.AspNet.Razor/Editor/ImplicitExpressionEditHandler.cs +++ b/src/Microsoft.AspNet.Razor/Editor/ImplicitExpressionEditHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; @@ -56,6 +57,18 @@ namespace Microsoft.AspNet.Razor.Editor return PartialParseResult.Rejected; } + // In some editors intellisense insertions are handled as "dotless commits". If an intellisense selection is confirmed + // via something like '.' a dotless commit will append a '.' and then insert the remaining intellisense selection prior + // to the appended '.'. This 'if' statement attempts to accept the intermediate steps of a dotless commit via + // intellisense. It will accept two cases: + // 1. '@foo.' -> '@foobaz.'. + // 2. '@foobaz..' -> '@foobaz.bar.'. Includes Sub-cases '@foobaz()..' -> '@foobaz().bar.' etc. + // The key distinction being the double '.' in the second case. + if (IsDotlessCommitInsertion(target, normalizedChange)) + { + return HandleDotlessCommitInsertion(target); + } + if (IsAcceptableReplace(target, normalizedChange)) { return HandleReplacement(target, normalizedChange); @@ -75,7 +88,7 @@ namespace Microsoft.AspNet.Razor.Editor return PartialParseResult.Rejected; } - // Only support insertions at the end of the span + // Accepts cases when insertions are made at the end of a span or '.' is inserted within a span. if (IsAcceptableInsertion(target, normalizedChange)) { // Handle the insertion @@ -96,6 +109,36 @@ namespace Microsoft.AspNet.Razor.Editor AcceptTrailingDot = acceptTrailingDot; } + // A dotless commit is the process of inserting a '.' with an intellisense selection. + private static bool IsDotlessCommitInsertion(Span target, TextChange change) + { + return IsNewDotlessCommitInsertion(target, change) || IsSecondaryDotlessCommitInsertion(target, change); + } + + // Completing 'DateTime' in intellisense with a '.' could result in: '@DateT' -> '@DateT.' -> '@DateTime.' which is accepted. + private static bool IsNewDotlessCommitInsertion(Span target, TextChange change) + { + return !IsAtEndOfSpan(target, change) && + change.NewPosition > 0 && + change.NewLength > 0 && + target.Content.Last() == '.' && + ParserHelpers.IsIdentifier(change.NewText, requireIdentifierStart: false) && + (change.OldLength == 0 || ParserHelpers.IsIdentifier(change.OldText, requireIdentifierStart: false)); + } + + // Once a dotless commit has been performed you then have something like '@DateTime.'. This scenario is used to detect the + // situation when you try to perform another dotless commit resulting in a textchange with '..'. Completing 'DateTime.Now' + // in intellisense with a '.' could result in: '@DateTime.' -> '@DateTime..' -> '@DateTime.Now.' which is accepted. + private static bool IsSecondaryDotlessCommitInsertion(Span target, TextChange change) + { + // Do not need to worry about other punctuation, just looking for double '.' (after change) + return change.NewLength == 1 && + !String.IsNullOrEmpty(target.Content) && + target.Content.Last() == '.' && + change.NewText == "." && + change.OldLength == 0; + } + private static bool IsAcceptableReplace(Span target, TextChange change) { return IsEndReplace(target, change) || @@ -108,10 +151,36 @@ namespace Microsoft.AspNet.Razor.Editor (change.IsDelete && RemainingIsWhitespace(target, change)); } + // Acceptable insertions can occur at the end of a span or when a '.' is inserted within a span. private static bool IsAcceptableInsertion(Span target, TextChange change) { - return IsEndInsertion(target, change) || - (change.IsInsert && RemainingIsWhitespace(target, change)); + return change.IsInsert && + (IsAcceptableEndInsertion(target, change) || + IsAcceptableInnerInsertion(target, change)); + } + + // Accepts character insertions at the end of spans. AKA: '@foo' -> '@fooo' or '@foo' -> '@foo ' etc. + private static bool IsAcceptableEndInsertion(Span target, TextChange change) + { + Debug.Assert(change.IsInsert); + + return IsAtEndOfSpan(target, change) || + RemainingIsWhitespace(target, change); + } + + // Accepts '.' insertions in the middle of spans. Ex: '@foo.baz.bar' -> '@foo..baz.bar' + // This is meant to allow intellisense when editing a span. + [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "target", Justification = "The 'target' parameter is used in Debug to validate that the function is called in the correct context.")] + private static bool IsAcceptableInnerInsertion(Span target, TextChange change) + { + Debug.Assert(change.IsInsert); + + // Ensure that we're actually inserting in the middle of a span and not at the end. + // This case will fail if the IsAcceptableEndInsertion does not capture an end insertion correctly. + Debug.Assert(!IsAtEndOfSpan(target, change)); + + return change.NewPosition > 0 && + change.NewText == "."; } private static bool RemainingIsWhitespace(Span target, TextChange change) @@ -120,6 +189,16 @@ namespace Microsoft.AspNet.Razor.Editor return String.IsNullOrWhiteSpace(target.Content.Substring(offset)); } + private PartialParseResult HandleDotlessCommitInsertion(Span target) + { + PartialParseResult result = PartialParseResult.Accepted; + if (!AcceptTrailingDot && target.Content.LastOrDefault() == '.') + { + result |= PartialParseResult.Provisional; + } + return result; + } + private PartialParseResult HandleReplacement(Span target, TextChange change) { // Special Case for IntelliSense commits. @@ -207,8 +286,8 @@ namespace Microsoft.AspNet.Razor.Editor private PartialParseResult HandleInsertionAfterDot(Span target, TextChange change) { - // If the insertion is a full identifier, accept it - if (ParserHelpers.IsIdentifier(change.NewText)) + // If the insertion is a full identifier or another dot, accept it + if (ParserHelpers.IsIdentifier(change.NewText) || change.NewText == ".") { return TryAcceptChange(target, change); } diff --git a/src/Microsoft.AspNet.Razor/GlobalSuppressions.cs b/src/Microsoft.AspNet.Razor/GlobalSuppressions.cs index aac9dd64dc..c24f9e76ca 100644 --- a/src/Microsoft.AspNet.Razor/GlobalSuppressions.cs +++ b/src/Microsoft.AspNet.Razor/GlobalSuppressions.cs @@ -12,11 +12,11 @@ using System.Diagnostics.CodeAnalysis; -[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "br", Scope = "resource", Target = "System.Web.Razor.Resources.RazorResources.resources", Justification = "Resource is referencing html tag")] -[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Web.Razor.Tokenizer.Symbols", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] -[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Web.Razor.Tokenizer", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] -[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Web.Razor.Text", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] -[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Web.Razor.Parser", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] -[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Web.Razor.Editor", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] -[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Web.Razor", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "br", Scope = "resource", Target = "Microsoft.AspNet.Razor.Resources.RazorResources.resources", Justification = "Resource is referencing html tag")] +[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] +[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor.Tokenizer", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] +[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor.Text", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] +[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor.Parser", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] +[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor.Editor", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] +[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")] [assembly: SuppressMessage("Microsoft.Web.FxCop", "MW1000:UnusedResourceUsageRule", Justification = "There are numerous unused resources due to VB being disabled. This rule will be re-run after VB is restored")] diff --git a/src/Microsoft.AspNet.Razor/RazorEditorParser.cs b/src/Microsoft.AspNet.Razor/RazorEditorParser.cs index 9a74013bc4..cb2496e1bc 100644 --- a/src/Microsoft.AspNet.Razor/RazorEditorParser.cs +++ b/src/Microsoft.AspNet.Razor/RazorEditorParser.cs @@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Razor /// NOTE: Additional flags can be applied to the PartialParseResult, see that enum for more details. However, /// the Accepted or Rejected flags will ALWAYS be present /// - /// A change can only be incrementally parsed if a single, unique, Span (see System.Web.Razor.Parser.SyntaxTree) in the syntax tree can + /// A change can only be incrementally parsed if a single, unique, Span (see Microsoft.AspNet.Razor.Parser.SyntaxTree) in the syntax tree can /// be identified as owning the entire change. For example, if a change overlaps with multiple spans, the change cannot be /// parsed incrementally and a full reparse is necessary. A Span "owns" a change if the change occurs either a) entirely /// within it's boundaries or b) it is a pure insertion (see TextChange) at the end of a Span whose CanGrow flag (see Span) is @@ -175,7 +175,7 @@ namespace Microsoft.AspNet.Razor elapsedMs = sw.ElapsedMilliseconds; sw.Reset(); #endif - RazorEditorTrace.TraceLine(RazorResources.Trace_EditorProcessedChange, Path.GetFileName(FileName), changeString, elapsedMs.HasValue ? elapsedMs.Value.ToString() : "?", result.ToString()); + RazorEditorTrace.TraceLine(RazorResources.Trace_EditorProcessedChange, Path.GetFileName(FileName), changeString, elapsedMs.HasValue ? elapsedMs.Value.ToString(CultureInfo.InvariantCulture) : "?", result.ToString()); return result; } diff --git a/src/Microsoft.AspNet.Razor/Resources/RazorResources.Designer.cs b/src/Microsoft.AspNet.Razor/Resources/RazorResources.Designer.cs index 929c4f40af..28d71aa195 100644 --- a/src/Microsoft.AspNet.Razor/Resources/RazorResources.Designer.cs +++ b/src/Microsoft.AspNet.Razor/Resources/RazorResources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34003 +// Runtime Version:4.0.30319.17929 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/Microsoft.AspNet.Razor/Text/LookaheadToken.cs b/src/Microsoft.AspNet.Razor/Text/LookaheadToken.cs index d6406d20a3..a7b3e12f0d 100644 --- a/src/Microsoft.AspNet.Razor/Text/LookaheadToken.cs +++ b/src/Microsoft.AspNet.Razor/Text/LookaheadToken.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; + namespace Microsoft.AspNet.Razor.Text { public class LookaheadToken : IDisposable diff --git a/src/Microsoft.AspNet.Razor/Text/SourceLocation.cs b/src/Microsoft.AspNet.Razor/Text/SourceLocation.cs index 37502d971c..ca8cd8194c 100644 --- a/src/Microsoft.AspNet.Razor/Text/SourceLocation.cs +++ b/src/Microsoft.AspNet.Razor/Text/SourceLocation.cs @@ -58,11 +58,6 @@ namespace Microsoft.AspNet.Razor.Text public bool Equals(SourceLocation other) { - if (other == null) - { - throw new ArgumentNullException("other"); - } - return AbsoluteIndex == other.AbsoluteIndex && LineIndex == other.LineIndex && CharacterIndex == other.CharacterIndex; diff --git a/src/Microsoft.AspNet.Razor/Text/TextChange.cs b/src/Microsoft.AspNet.Razor/Text/TextChange.cs index 06ad346f58..deac9027bd 100644 --- a/src/Microsoft.AspNet.Razor/Text/TextChange.cs +++ b/src/Microsoft.AspNet.Razor/Text/TextChange.cs @@ -65,6 +65,11 @@ namespace Microsoft.AspNet.Razor.Text public ITextBuffer NewBuffer { get; private set; } public ITextBuffer OldBuffer { get; private set; } + /// + /// Note: This property is not thread safe, and will move position on the textbuffer while being read. + /// https://aspnetwebstack.codeplex.com/workitem/1317, tracks making this immutable and improving the access + /// to ITextBuffer to be thread safe. + /// public string OldText { get @@ -77,6 +82,11 @@ namespace Microsoft.AspNet.Razor.Text } } + /// + /// Note: This property is not thread safe, and will move position on the textbuffer while being read. + /// https://aspnetwebstack.codeplex.com/workitem/1317, tracks making this immutable and improving the access + /// to ITextBuffer to be thread safe. + /// public string NewText { get @@ -166,14 +176,21 @@ namespace Microsoft.AspNet.Razor.Text return this; } - private string GetText(ITextBuffer buffer, int position, int length) + private static string GetText(ITextBuffer buffer, int position, int length) { + // Optimization for the common case of one char inserts, in this case we don't even need to seek the buffer. + if (length == 0) + { + return String.Empty; + } + int oldPosition = buffer.Position; try { buffer.Position = position; - // Optimization for the common case of one char inserts - if (NewLength == 1) + + // Optimization for the common case of one char inserts, in this case we seek the buffer. + if (length == 1) { return ((char)buffer.Read()).ToString(); } @@ -184,6 +201,8 @@ namespace Microsoft.AspNet.Razor.Text { char c = (char)buffer.Read(); builder.Append(c); + + // This check is probably not necessary, will revisit when fixing https://aspnetwebstack.codeplex.com/workitem/1317 if (Char.IsHighSurrogate(c)) { builder.Append((char)buffer.Read()); diff --git a/src/Microsoft.AspNet.Razor/Tokenizer/Symbols/SymbolTypeSuppressions.cs b/src/Microsoft.AspNet.Razor/Tokenizer/Symbols/SymbolTypeSuppressions.cs index 309d33c84a..d7a2aab2d4 100644 --- a/src/Microsoft.AspNet.Razor/Tokenizer/Symbols/SymbolTypeSuppressions.cs +++ b/src/Microsoft.AspNet.Razor/Tokenizer/Symbols/SymbolTypeSuppressions.cs @@ -5,20 +5,20 @@ using System.Diagnostics.CodeAnalysis; -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Foreach", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.CSharpKeyword.#Foreach", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Readonly", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.CSharpKeyword.#Readonly", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sbyte", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.CSharpKeyword.#Sbyte", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sizeof", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.CSharpKeyword.#Sizeof", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Stackalloc", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.CSharpKeyword.#Stackalloc", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Typeof", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.CSharpKeyword.#Typeof", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Uint", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.CSharpKeyword.#Uint", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ulong", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.CSharpKeyword.#Ulong", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ushort", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.CSharpKeyword.#Ushort", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Val", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.VBKeyword.#ByVal", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sng", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.VBKeyword.#CSng", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "ReDim", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.VBKeyword.#ReDim", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Re", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.VBKeyword.#ReDim", Justification = Justifications.SymbolTypeNames)] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Str", Scope = "member", Target = "System.Web.Razor.Tokenizer.Symbols.VBKeyword.#CStr", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Foreach", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Foreach", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Readonly", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Readonly", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sbyte", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Sbyte", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sizeof", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Sizeof", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Stackalloc", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Stackalloc", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Typeof", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Typeof", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Uint", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Uint", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ulong", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Ulong", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ushort", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Ushort", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Val", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.VBKeyword.#ByVal", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sng", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.VBKeyword.#CSng", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "ReDim", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.VBKeyword.#ReDim", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Re", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.VBKeyword.#ReDim", Justification = Justifications.SymbolTypeNames)] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Str", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.VBKeyword.#CStr", Justification = Justifications.SymbolTypeNames)] internal static partial class Justifications { diff --git a/src/Microsoft.AspNet.Razor/Utils/DisposableAction.cs b/src/Microsoft.AspNet.Razor/Utils/DisposableAction.cs index a47b9c4421..fd422d8cd6 100644 --- a/src/Microsoft.AspNet.Razor/Utils/DisposableAction.cs +++ b/src/Microsoft.AspNet.Razor/Utils/DisposableAction.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; + namespace Microsoft.AspNet.Razor.Utils { internal class DisposableAction : IDisposable