提交 94ee71e0 编写于 作者: C Cyrus Najmabadi

Use simple usings

上级 4226d8ce
......@@ -60,19 +60,18 @@ public override void AfterReturn(IBraceCompletionSession session, CancellationTo
// alright, it is in right shape.
var undoHistory = GetUndoHistory(session.TextView);
using (var transaction = undoHistory.CreateTransaction(EditorFeaturesResources.Brace_Completion))
using var transaction = undoHistory.CreateTransaction(EditorFeaturesResources.Brace_Completion);
var document = session.SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
var document = session.SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
document.InsertText(session.ClosingPoint.GetPosition(session.SubjectBuffer.CurrentSnapshot) - 1, Environment.NewLine, cancellationToken);
FormatTrackingSpan(session, shouldHonorAutoFormattingOnCloseBraceOption: false, rules: GetFormattingRules(document));
document.InsertText(session.ClosingPoint.GetPosition(session.SubjectBuffer.CurrentSnapshot) - 1, Environment.NewLine, cancellationToken);
FormatTrackingSpan(session, shouldHonorAutoFormattingOnCloseBraceOption: false, rules: GetFormattingRules(document));
// put caret at right indentation
PutCaretOnLine(session, session.OpeningPoint.GetPoint(session.SubjectBuffer.CurrentSnapshot).GetContainingLineNumber() + 1);
// put caret at right indentation
PutCaretOnLine(session, session.OpeningPoint.GetPoint(session.SubjectBuffer.CurrentSnapshot).GetContainingLineNumber() + 1);
transaction.Complete();
}
transaction.Complete();
}
}
......
......@@ -179,10 +179,9 @@ public async Task<IDocumentOptions> GetOptionsForDocumentAsync(Document document
// as in some builds the ICodingConventionsManager captures the thread pool.
var conventionsAsync = Task.Run(() => GetConventionContextAsync(path, cancellationToken));
using (var context = await conventionsAsync.ConfigureAwait(false))
{
return new DocumentOptions(context.CurrentConventions, _errorLogger);
}
using var context = await conventionsAsync.ConfigureAwait(false);
return new DocumentOptions(context.CurrentConventions, _errorLogger);
}
}
......
......@@ -111,22 +111,21 @@ public void ExecuteCommand(AutomaticLineEnderCommandArgs args, Action nextHandle
return;
}
using (var transaction = args.TextView.CreateEditTransaction(EditorFeaturesResources.Automatic_Line_Ender, _undoRegistry, _editorOperationsFactoryService))
{
// try to move the caret to the end of the line on which the caret is
args.TextView.TryMoveCaretToAndEnsureVisible(subjectLineWhereCaretIsOn.End);
using var transaction = args.TextView.CreateEditTransaction(EditorFeaturesResources.Automatic_Line_Ender, _undoRegistry, _editorOperationsFactoryService);
// okay, now insert ending if we need to
var newDocument = InsertEndingIfRequired(document, insertionPoint.Value, position.Value, userCancellationToken);
// try to move the caret to the end of the line on which the caret is
args.TextView.TryMoveCaretToAndEnsureVisible(subjectLineWhereCaretIsOn.End);
// format the document and apply the changes to the workspace
FormatAndApply(newDocument, insertionPoint.Value, userCancellationToken);
// okay, now insert ending if we need to
var newDocument = InsertEndingIfRequired(document, insertionPoint.Value, position.Value, userCancellationToken);
// now, insert new line
NextAction(operations, nextHandler);
// format the document and apply the changes to the workspace
FormatAndApply(newDocument, insertionPoint.Value, userCancellationToken);
transaction.Complete();
}
// now, insert new line
NextAction(operations, nextHandler);
transaction.Complete();
}
}
......
......@@ -47,16 +47,15 @@ protected bool TryHandleReturnKey(ITextBuffer subjectBuffer, ITextView textView)
return false;
}
using (var transaction = _undoHistoryRegistry.GetHistory(textView.TextBuffer).CreateTransaction(EditorFeaturesResources.Insert_new_line))
{
var editorOperations = _editorOperationsFactoryService.GetEditorOperations(textView);
using var transaction = _undoHistoryRegistry.GetHistory(textView.TextBuffer).CreateTransaction(EditorFeaturesResources.Insert_new_line);
editorOperations.InsertNewLine();
editorOperations.InsertText(exteriorText);
var editorOperations = _editorOperationsFactoryService.GetEditorOperations(textView);
transaction.Complete();
return true;
}
editorOperations.InsertNewLine();
editorOperations.InsertText(exteriorText);
transaction.Complete();
return true;
}
protected abstract string GetExteriorTextForNextLine(SnapshotPoint caretPosition);
......
......@@ -67,18 +67,17 @@ public void ExecuteCommand(TypeCharCommandArgs args, Action nextHandler, Command
protected void InsertTextAndMoveCaret(ITextView textView, ITextBuffer subjectBuffer, SnapshotPoint position, string insertionText, int? finalCaretPosition)
{
using (var transaction = _undoHistory.GetHistory(textView.TextBuffer).CreateTransaction("XmlTagCompletion"))
{
subjectBuffer.Insert(position, insertionText);
using var transaction = _undoHistory.GetHistory(textView.TextBuffer).CreateTransaction("XmlTagCompletion");
if (finalCaretPosition.HasValue)
{
var point = subjectBuffer.CurrentSnapshot.GetPoint(finalCaretPosition.Value);
textView.TryMoveCaretToAndEnsureVisible(point);
}
subjectBuffer.Insert(position, insertionText);
transaction.Complete();
if (finalCaretPosition.HasValue)
{
var point = subjectBuffer.CurrentSnapshot.GetPoint(finalCaretPosition.Value);
textView.TryMoveCaretToAndEnsureVisible(point);
}
transaction.Complete();
}
}
}
......@@ -112,11 +112,10 @@ private void RemoveReadOnlyRegionFromBuffer(DocumentId documentId, IReadOnlyRegi
AssertIsForeground();
var textBuffer = GetTextBuffer(_workspace, documentId);
using (var readOnlyEdit = textBuffer.CreateReadOnlyRegionEdit())
{
readOnlyEdit.RemoveReadOnlyRegion(region);
readOnlyEdit.Apply();
}
using var readOnlyEdit = textBuffer.CreateReadOnlyRegionEdit();
readOnlyEdit.RemoveReadOnlyRegion(region);
readOnlyEdit.Apply();
}
private static ITextBuffer GetTextBuffer(Workspace workspace, DocumentId documentId)
......
......@@ -42,10 +42,9 @@ public bool ExecuteCommand(EncapsulateFieldCommandArgs args, CommandExecutionCon
return false;
}
using (var waitScope = context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Applying_Encapsulate_Field_refactoring))
{
return Execute(args, waitScope);
}
using var waitScope = context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Applying_Encapsulate_Field_refactoring);
return Execute(args, waitScope);
}
private bool Execute(EncapsulateFieldCommandArgs args, IUIThreadOperationScope waitScope)
......
......@@ -238,15 +238,14 @@ private bool TryNotifyFailureToUser(Document document, ExtractMethodResult resul
/// </summary>
private void ApplyChangesToBuffer(ExtractMethodResult extractMethodResult, ITextBuffer subjectBuffer, CancellationToken cancellationToken)
{
using (var undoTransaction = _undoManager.GetTextBufferUndoManager(subjectBuffer).TextBufferUndoHistory.CreateTransaction("Extract Method"))
{
// apply extract method code to buffer
var document = extractMethodResult.Document;
document.Project.Solution.Workspace.ApplyDocumentChanges(document, cancellationToken);
using var undoTransaction = _undoManager.GetTextBufferUndoManager(subjectBuffer).TextBufferUndoHistory.CreateTransaction("Extract Method");
// apply changes
undoTransaction.Complete();
}
// apply extract method code to buffer
var document = extractMethodResult.Document;
document.Project.Solution.Workspace.ApplyDocumentChanges(document, cancellationToken);
// apply changes
undoTransaction.Complete();
}
}
}
......@@ -262,33 +262,32 @@ private void UpdateWorkspaceForResetOfTypedIdentifier(Workspace workspace, Solut
var undoHistory = _undoHistoryRegistry.RegisterHistory(_stateMachine.Buffer);
using (var workspaceUndoTransaction = workspace.OpenGlobalUndoTransaction(undoName))
using (var localUndoTransaction = undoHistory.CreateTransaction(undoName))
{
var undoPrimitiveBefore = new UndoPrimitive(_stateMachine.Buffer, trackingSessionId, shouldRestoreStateOnUndo: false);
localUndoTransaction.AddUndo(undoPrimitiveBefore);
using var workspaceUndoTransaction = workspace.OpenGlobalUndoTransaction(undoName);
using var localUndoTransaction = undoHistory.CreateTransaction(undoName);
if (!workspace.TryApplyChanges(newSolution))
{
Contract.Fail("Rename Tracking could not update solution.");
}
var undoPrimitiveBefore = new UndoPrimitive(_stateMachine.Buffer, trackingSessionId, shouldRestoreStateOnUndo: false);
localUndoTransaction.AddUndo(undoPrimitiveBefore);
if (!_refactorNotifyServices.TryOnAfterGlobalSymbolRenamed(workspace, changedDocuments, symbol, newName, throwOnFailure: false))
{
var notificationService = workspace.Services.GetService<INotificationService>();
notificationService.SendNotification(
EditorFeaturesResources.Rename_operation_was_not_properly_completed_Some_file_might_not_have_been_updated,
EditorFeaturesResources.Rename_Symbol,
NotificationSeverity.Information);
}
// Never resume tracking session on redo
var undoPrimitiveAfter = new UndoPrimitive(_stateMachine.Buffer, trackingSessionId, shouldRestoreStateOnUndo: false);
localUndoTransaction.AddUndo(undoPrimitiveAfter);
if (!workspace.TryApplyChanges(newSolution))
{
Contract.Fail("Rename Tracking could not update solution.");
}
localUndoTransaction.Complete();
workspaceUndoTransaction.Commit();
if (!_refactorNotifyServices.TryOnAfterGlobalSymbolRenamed(workspace, changedDocuments, symbol, newName, throwOnFailure: false))
{
var notificationService = workspace.Services.GetService<INotificationService>();
notificationService.SendNotification(
EditorFeaturesResources.Rename_operation_was_not_properly_completed_Some_file_might_not_have_been_updated,
EditorFeaturesResources.Rename_Symbol,
NotificationSeverity.Information);
}
// Never resume tracking session on redo
var undoPrimitiveAfter = new UndoPrimitive(_stateMachine.Buffer, trackingSessionId, shouldRestoreStateOnUndo: false);
localUndoTransaction.AddUndo(undoPrimitiveAfter);
localUndoTransaction.Complete();
workspaceUndoTransaction.Commit();
}
}
}
......
......@@ -48,29 +48,28 @@ protected override Data TryGetExistingData(Stream stream, Document value, Cancel
protected override void WriteTo(Stream stream, Data data, CancellationToken cancellationToken)
{
using (var writer = new ObjectWriter(stream, cancellationToken: cancellationToken))
{
writer.WriteString(FormatVersion);
data.TextVersion.WriteTo(writer);
data.SyntaxVersion.WriteTo(writer);
using var writer = new ObjectWriter(stream, cancellationToken: cancellationToken);
writer.WriteInt32(data.Items.Length);
writer.WriteString(FormatVersion);
data.TextVersion.WriteTo(writer);
data.SyntaxVersion.WriteTo(writer);
foreach (var item in data.Items.OfType<TodoItem>())
{
cancellationToken.ThrowIfCancellationRequested();
writer.WriteInt32(data.Items.Length);
foreach (var item in data.Items.OfType<TodoItem>())
{
cancellationToken.ThrowIfCancellationRequested();
writer.WriteInt32(item.Priority);
writer.WriteString(item.Message);
writer.WriteInt32(item.Priority);
writer.WriteString(item.Message);
writer.WriteString(item.OriginalFilePath);
writer.WriteInt32(item.OriginalLine);
writer.WriteInt32(item.OriginalColumn);
writer.WriteString(item.OriginalFilePath);
writer.WriteInt32(item.OriginalLine);
writer.WriteInt32(item.OriginalColumn);
writer.WriteString(item.MappedFilePath);
writer.WriteInt32(item.MappedLine);
writer.WriteInt32(item.MappedColumn);
}
writer.WriteString(item.MappedFilePath);
writer.WriteInt32(item.MappedLine);
writer.WriteInt32(item.MappedColumn);
}
}
......
......@@ -42,12 +42,11 @@ private void GenerateComments(SyntaxTriviaList triviaList)
var firstNonWhitespacePosition = line.GetFirstNonWhitespacePosition() ?? -1;
if (firstNonWhitespacePosition == trivia.SpanStart)
{
using (var tag = CommentTag())
{
// Skip initial slashes
var trimmedComment = trivia.ToString().Substring(2);
EncodedText(trimmedComment);
}
using var tag = CommentTag();
// Skip initial slashes
var trimmedComment = trivia.ToString().Substring(2);
EncodedText(trimmedComment);
}
}
}
......
......@@ -17,18 +17,17 @@ public class LocationInfoGetterTests
{
private async Task TestAsync(string markup, string expectedName, int expectedLineOffset, CSharpParseOptions parseOptions = null)
{
using (var workspace = TestWorkspace.CreateCSharp(markup, parseOptions))
{
var testDocument = workspace.Documents.Single();
var position = testDocument.CursorPosition.Value;
var locationInfo = await LocationInfoGetter.GetInfoAsync(
workspace.CurrentSolution.Projects.Single().Documents.Single(),
position,
CancellationToken.None);
Assert.Equal(expectedName, locationInfo.Name);
Assert.Equal(expectedLineOffset, locationInfo.LineOffset);
}
using var workspace = TestWorkspace.CreateCSharp(markup, parseOptions);
var testDocument = workspace.Documents.Single();
var position = testDocument.CursorPosition.Value;
var locationInfo = await LocationInfoGetter.GetInfoAsync(
workspace.CurrentSolution.Projects.Single().Documents.Single(),
position,
CancellationToken.None);
Assert.Equal(expectedName, locationInfo.Name);
Assert.Equal(expectedLineOffset, locationInfo.LineOffset);
}
[Fact, Trait(Traits.Feature, Traits.Features.DebuggingLocationName)]
......
......@@ -27,12 +27,11 @@ private async Task TestAsync(string text, string searchText, params string[] exp
[Fact, Trait(Traits.Feature, Traits.Features.DebuggingNameResolver)]
public async Task TestCSharpLanguageDebugInfoCreateNameResolver()
{
using (var workspace = TestWorkspace.CreateCSharp(" "))
{
var debugInfo = new CSharpBreakpointResolutionService();
var results = await debugInfo.ResolveBreakpointsAsync(workspace.CurrentSolution, "goo", CancellationToken.None);
Assert.Equal(0, results.Count());
}
using var workspace = TestWorkspace.CreateCSharp(" ");
var debugInfo = new CSharpBreakpointResolutionService();
var results = await debugInfo.ResolveBreakpointsAsync(workspace.CurrentSolution, "goo", CancellationToken.None);
Assert.Equal(0, results.Count());
}
[Fact, Trait(Traits.Feature, Traits.Features.DebuggingNameResolver)]
......
......@@ -337,20 +337,19 @@ void M()
MyEvent +$$
}
}";
using (var testState = EventHookupTestState.CreateTestState(markup))
{
testState.SendTypeChar('=');
await testState.WaitForAsynchronousOperationsAsync();
testState.AssertShowing("C_MyEvent;");
using var testState = EventHookupTestState.CreateTestState(markup);
testState.SendTypeChar(' ');
await testState.WaitForAsynchronousOperationsAsync();
testState.AssertShowing("C_MyEvent;");
testState.SendTypeChar('=');
await testState.WaitForAsynchronousOperationsAsync();
testState.AssertShowing("C_MyEvent;");
testState.SendBackspace();
await testState.WaitForAsynchronousOperationsAsync();
testState.AssertNotShowing();
}
testState.SendTypeChar(' ');
await testState.WaitForAsynchronousOperationsAsync();
testState.AssertShowing("C_MyEvent;");
testState.SendBackspace();
await testState.WaitForAsynchronousOperationsAsync();
testState.AssertNotShowing();
}
[WpfFact, Trait(Traits.Feature, Traits.Features.EventHookup)]
......
......@@ -248,60 +248,59 @@ private IEnumerable<TextChange> FilterTextChanges(SourceText originalText, List<
yield break;
}
using (var pooledObject = SharedPools.Default<List<TextChange>>().GetPooledObject())
using var pooledObject = SharedPools.Default<List<TextChange>>().GetPooledObject();
var changeQueue = pooledObject.Object;
changeQueue.AddRange(changes);
var spanIndex = 0;
var changeIndex = 0;
for (; spanIndex < editorVisibleSpansInOriginal.Count; spanIndex++)
{
var changeQueue = pooledObject.Object;
changeQueue.AddRange(changes);
var visibleSpan = editorVisibleSpansInOriginal[spanIndex];
var visibleTextSpan = GetVisibleTextSpan(originalText, visibleSpan, uptoFirstAndLastLine: true);
var spanIndex = 0;
var changeIndex = 0;
for (; spanIndex < editorVisibleSpansInOriginal.Count; spanIndex++)
for (; changeIndex < changeQueue.Count; changeIndex++)
{
var visibleSpan = editorVisibleSpansInOriginal[spanIndex];
var visibleTextSpan = GetVisibleTextSpan(originalText, visibleSpan, uptoFirstAndLastLine: true);
var change = changeQueue[changeIndex];
for (; changeIndex < changeQueue.Count; changeIndex++)
// easy case first
if (change.Span.End < visibleSpan.Start)
{
var change = changeQueue[changeIndex];
// move to next change
continue;
}
// easy case first
if (change.Span.End < visibleSpan.Start)
{
// move to next change
continue;
}
if (visibleSpan.End < change.Span.Start)
{
// move to next visible span
break;
}
if (visibleSpan.End < change.Span.Start)
{
// move to next visible span
break;
}
// make sure we are not replacing whitespace around start and at the end of visible span
if (WhitespaceOnEdges(originalText, visibleTextSpan, change))
{
continue;
}
// make sure we are not replacing whitespace around start and at the end of visible span
if (WhitespaceOnEdges(originalText, visibleTextSpan, change))
{
continue;
}
if (visibleSpan.Contains(change.Span))
{
yield return change;
continue;
}
if (visibleSpan.Contains(change.Span))
// now it is complex case where things are intersecting each other
var subChanges = GetSubTextChanges(originalText, change, visibleSpan).ToList();
if (subChanges.Count > 0)
{
if (subChanges.Count == 1 && subChanges[0] == change)
{
yield return change;
// we can't break it. not much we can do here. just don't touch and ignore this change
continue;
}
// now it is complex case where things are intersecting each other
var subChanges = GetSubTextChanges(originalText, change, visibleSpan).ToList();
if (subChanges.Count > 0)
{
if (subChanges.Count == 1 && subChanges[0] == change)
{
// we can't break it. not much we can do here. just don't touch and ignore this change
continue;
}
changeQueue.InsertRange(changeIndex + 1, subChanges);
continue;
}
changeQueue.InsertRange(changeIndex + 1, subChanges);
continue;
}
}
}
......
......@@ -465,10 +465,9 @@ protected void GenerateType(ITypeSymbol type, bool? @implicit = null, bool assem
if (type.TypeKind == TypeKind.Array)
{
var arrayType = (IArrayTypeSymbol)type;
using (var tag = ArrayTypeTag(arrayType.Rank))
{
GenerateType(arrayType.ElementType, @implicit, assemblyQualify);
}
using var tag = ArrayTypeTag(arrayType.Rank);
GenerateType(arrayType.ElementType, @implicit, assemblyQualify);
}
else
{
......
......@@ -248,12 +248,11 @@ internal static partial class DeclarationFinder
{
var list = ArrayBuilder<SymbolAndProjectId>.GetInstance();
using (var query = SearchQuery.Create(name, ignoreCase))
{
await AddCompilationDeclarationsWithNormalQueryAsync(
project, query, filter, list, cancellationToken).ConfigureAwait(false);
return list.ToImmutableAndFree();
}
using var query = SearchQuery.Create(name, ignoreCase);
await AddCompilationDeclarationsWithNormalQueryAsync(
project, query, filter, list, cancellationToken).ConfigureAwait(false);
return list.ToImmutableAndFree();
}
private static async Task<ImmutableArray<SymbolAndProjectId>> FindSourceDeclarationsWithPatternInCurrentProcessAsync(
......@@ -273,27 +272,25 @@ internal static partial class DeclarationFinder
// If we don't have a dot in the pattern, just make a pattern matcher for the entire
// pattern they passed in. Otherwise, make a pattern matcher just for the part after
// the dot.
using (var nameMatcher = PatternMatcher.CreatePatternMatcher(namePart, includeMatchedSpans: false))
using (var query = SearchQuery.CreateCustom(nameMatcher.Matches))
using var nameMatcher = PatternMatcher.CreatePatternMatcher(namePart, includeMatchedSpans: false);
using var query = SearchQuery.CreateCustom(nameMatcher.Matches);
var symbolAndProjectIds = await searchAsync(query).ConfigureAwait(false);
if (symbolAndProjectIds.Length == 0 ||
!isDottedPattern)
{
var symbolAndProjectIds = await searchAsync(query).ConfigureAwait(false);
if (symbolAndProjectIds.Length == 0 ||
!isDottedPattern)
{
// If it wasn't a dotted pattern, or we didn't get anything back, then we're done.
// We can just return whatever set of results we got so far.
return symbolAndProjectIds;
}
// Ok, we had a dotted pattern. Have to see if the symbol's container matches the
// pattern as well.
using (var containerPatternMatcher = PatternMatcher.CreateDotSeparatedContainerMatcher(containerPart))
{
return symbolAndProjectIds.WhereAsArray(t =>
containerPatternMatcher.Matches(GetContainer(t.Symbol)));
}
// If it wasn't a dotted pattern, or we didn't get anything back, then we're done.
// We can just return whatever set of results we got so far.
return symbolAndProjectIds;
}
// Ok, we had a dotted pattern. Have to see if the symbol's container matches the
// pattern as well.
using var containerPatternMatcher = PatternMatcher.CreateDotSeparatedContainerMatcher(containerPart);
return symbolAndProjectIds.WhereAsArray(t =>
containerPatternMatcher.Matches(GetContainer(t.Symbol)));
}
internal static Task<ImmutableArray<SymbolAndProjectId>> FindSourceDeclarationsWithPatternInCurrentProcessAsync(
......
......@@ -78,13 +78,12 @@ public Task FindLiteralReferencesAsync(object value, TypeCode typeCode, Cancella
var solution = await GetSolutionAsync(cancellationToken).ConfigureAwait(false);
var project = solution.GetProject(projectId);
using (var query = SearchQuery.Create(name, searchKind))
{
var result = await DeclarationFinder.FindAllDeclarationsWithNormalQueryInCurrentProcessAsync(
project, query, criteria, cancellationToken).ConfigureAwait(false);
using var query = SearchQuery.Create(name, searchKind);
return (IList<SerializableSymbolAndProjectId>)result.SelectAsArray(SerializableSymbolAndProjectId.Dehydrate);
}
var result = await DeclarationFinder.FindAllDeclarationsWithNormalQueryInCurrentProcessAsync(
project, query, criteria, cancellationToken).ConfigureAwait(false);
return (IList<SerializableSymbolAndProjectId>)result.SelectAsArray(SerializableSymbolAndProjectId.Dehydrate);
}
}, cancellationToken);
}
......
......@@ -83,33 +83,32 @@ private bool ReportUnlessCanceled(Exception ex, CancellationToken cancellationTo
{
var results = new List<(Checksum, object)>();
using (var reader = ObjectReader.TryGetReader(stream, cancellationToken))
{
Debug.Assert(reader != null,
using var reader = ObjectReader.TryGetReader(stream, cancellationToken);
Debug.Assert(reader != null,
@"We only ge a reader for data transmitted between live processes.
This data should always be correct as we're never persisting the data between sessions.");
var responseScopeId = reader.ReadInt32();
Contract.ThrowIfFalse(scopeId == responseScopeId);
var responseScopeId = reader.ReadInt32();
Contract.ThrowIfFalse(scopeId == responseScopeId);
var count = reader.ReadInt32();
Contract.ThrowIfFalse(count == checksums.Count);
for (var i = 0; i < count; i++)
{
var responseChecksum = Checksum.ReadFrom(reader);
Contract.ThrowIfFalse(checksums.Contains(responseChecksum));
var count = reader.ReadInt32();
Contract.ThrowIfFalse(count == checksums.Count);
var kind = (WellKnownSynchronizationKind)reader.ReadInt32();
for (var i = 0; i < count; i++)
{
var responseChecksum = Checksum.ReadFrom(reader);
Contract.ThrowIfFalse(checksums.Contains(responseChecksum));
// in service hub, cancellation means simply closed stream
var @object = serializerService.Deserialize<object>(kind, reader, cancellationToken);
var kind = (WellKnownSynchronizationKind)reader.ReadInt32();
results.Add((responseChecksum, @object));
}
// in service hub, cancellation means simply closed stream
var @object = serializerService.Deserialize<object>(kind, reader, cancellationToken);
return results;
results.Add((responseChecksum, @object));
}
return results;
}
private static string GetRequestLogInfo(int serviceId, IEnumerable<Checksum> checksums)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册