changed contracts.assert to debug.assert

This commit is contained in:
Ajay Bhargav Baaskaran 2014-11-18 13:52:42 -08:00
parent 5c116db6a5
commit 91c3a550f1
5 changed files with 19 additions and 21 deletions

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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<string, object> 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;
}

View File

@ -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<TemplateSegment> 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;

View File

@ -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-*"
}