diff --git a/src/Microsoft.AspNet.Routing/InlineRouteParameterParser.cs b/src/Microsoft.AspNet.Routing/InlineRouteParameterParser.cs index 57625f7049..193befa746 100644 --- a/src/Microsoft.AspNet.Routing/InlineRouteParameterParser.cs +++ b/src/Microsoft.AspNet.Routing/InlineRouteParameterParser.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Contracts; +using System.Diagnostics; using System.Text.RegularExpressions; using Microsoft.AspNet.Routing.Template; @@ -70,7 +70,7 @@ namespace Microsoft.AspNet.Routing var defaultValueMatch = defaultValueGroup.Value; // Strip out the equal sign at the beginning - Contract.Assert(defaultValueMatch.StartsWith("=", StringComparison.Ordinal)); + Debug.Assert(defaultValueMatch.StartsWith("=", StringComparison.Ordinal)); return defaultValueMatch.Substring(1); } diff --git a/src/Microsoft.AspNet.Routing/Template/TemplateBinder.cs b/src/Microsoft.AspNet.Routing/Template/TemplateBinder.cs index 2934b6361e..62faf8db59 100644 --- a/src/Microsoft.AspNet.Routing/Template/TemplateBinder.cs +++ b/src/Microsoft.AspNet.Routing/Template/TemplateBinder.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Contracts; using System.Globalization; using System.Text; using System.Text.RegularExpressions; @@ -178,8 +177,8 @@ namespace Microsoft.AspNet.Routing.Template for (var i = 0; i < _template.Segments.Count; i++) { - Contract.Assert(context.BufferState == SegmentState.Beginning); - Contract.Assert(context.UriState == SegmentState.Beginning); + Debug.Assert(context.BufferState == SegmentState.Beginning); + Debug.Assert(context.UriState == SegmentState.Beginning); var segment = _template.Segments[i]; @@ -384,7 +383,7 @@ namespace Microsoft.AspNet.Routing.Template public void AcceptDefault(string key) { - Contract.Assert(!_acceptedValues.ContainsKey(key)); + Debug.Assert(!_acceptedValues.ContainsKey(key)); object value; if (_defaults != null && _defaults.TryGetValue(key, out value)) @@ -502,7 +501,7 @@ namespace Microsoft.AspNet.Routing.Template // We've already checked the conditions that could result in a rejected part, so this should // always be true. - Contract.Assert(result); + Debug.Assert(result); return result; } diff --git a/src/Microsoft.AspNet.Routing/Template/TemplateMatcher.cs b/src/Microsoft.AspNet.Routing/Template/TemplateMatcher.cs index 58d1e9e0cc..c1c80ff8de 100644 --- a/src/Microsoft.AspNet.Routing/Template/TemplateMatcher.cs +++ b/src/Microsoft.AspNet.Routing/Template/TemplateMatcher.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Contracts; +using System.Diagnostics; namespace Microsoft.AspNet.Routing.Template { @@ -59,7 +59,7 @@ namespace Microsoft.AspNet.Routing.Template } else { - Contract.Assert(part.IsParameter); + Debug.Assert(part.IsParameter); if (part.IsCatchAll) { @@ -133,7 +133,7 @@ namespace Microsoft.AspNet.Routing.Template return null; } - Contract.Assert(part.IsParameter); + Debug.Assert(part.IsParameter); // It's ok for a catch-all to produce a null value object defaultValue; @@ -169,8 +169,8 @@ namespace Microsoft.AspNet.Routing.Template IReadOnlyDictionary defaults, RouteValueDictionary values) { - Contract.Assert(routeSegment != null); - Contract.Assert(routeSegment.Parts.Count > 1); + Debug.Assert(routeSegment != null); + Debug.Assert(routeSegment.Parts.Count > 1); // Find last literal segment and get its last index in the string var lastIndex = requestSegment.Length; @@ -191,7 +191,7 @@ namespace Microsoft.AspNet.Routing.Template } else { - Contract.Assert(part.IsLiteral); + Debug.Assert(part.IsLiteral); lastLiteral = part; var startIndex = lastIndex - 1; @@ -246,7 +246,7 @@ namespace Microsoft.AspNet.Routing.Template else { parameterStartIndex = newLastIndex; - Contract.Assert(false, "indexOfLastSegementUsed should always be 0 from the check above"); + Debug.Assert(false, "indexOfLastSegementUsed should always be 0 from the check above"); } parameterTextLength = lastIndex; } diff --git a/src/Microsoft.AspNet.Routing/Template/TemplateParser.cs b/src/Microsoft.AspNet.Routing/Template/TemplateParser.cs index ebd32088c6..31dbdc30f9 100644 --- a/src/Microsoft.AspNet.Routing/Template/TemplateParser.cs +++ b/src/Microsoft.AspNet.Routing/Template/TemplateParser.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Contracts; +using System.Diagnostics; using System.Globalization; namespace Microsoft.AspNet.Routing.Template @@ -62,8 +62,8 @@ namespace Microsoft.AspNet.Routing.Template private static bool ParseSegment(TemplateParserContext context, List segments) { - Contract.Assert(context != null); - Contract.Assert(segments != null); + Debug.Assert(context != null); + Debug.Assert(segments != null); var segment = new TemplateSegment(); @@ -378,8 +378,8 @@ namespace Microsoft.AspNet.Routing.Template private static bool IsValidLiteral(TemplateParserContext context, string literal) { - Contract.Assert(context != null); - Contract.Assert(literal != null); + Debug.Assert(context != null); + Debug.Assert(literal != null); if (literal.IndexOf(QuestionMark) != -1) { @@ -407,7 +407,7 @@ namespace Microsoft.AspNet.Routing.Template public TemplateParserContext(string template) { - Contract.Assert(template != null); + Debug.Assert(template != null); _template = template; _index = -1; diff --git a/src/Microsoft.AspNet.Routing/project.json b/src/Microsoft.AspNet.Routing/project.json index ee7e51354f..09081ae8e3 100644 --- a/src/Microsoft.AspNet.Routing/project.json +++ b/src/Microsoft.AspNet.Routing/project.json @@ -13,7 +13,6 @@ "aspnet50": {}, "aspnetcore50": { "dependencies": { - "System.Diagnostics.Contracts": "4.0.0-beta-*", "System.Reflection.Extensions": "4.0.0-beta-*", "System.Text.RegularExpressions": "4.0.10-beta-*" }