Skip to content

Commit

Permalink
Merge pull request #358 from microsoft/v2.2
Browse files Browse the repository at this point in the history
Merge v2.2 to master
  • Loading branch information
AArnott authored Nov 5, 2019
2 parents d64c14c + 742dbdb commit 45a4172
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/StreamJsonRpc.Tests/JsonRpcWithFatalExceptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public async Task CancelExceptionPreferredOverConnectionLost()
[Fact]
public async Task AggregateExceptionIsNotRemovedFromAsyncMethod()
{
var remoteException = await Assert.ThrowsAnyAsync<Exception>(() => this.clientRpc.InvokeAsync(nameof(Server.AsyncMethodThrowsAggregateExceptionWithTwoInner)));
var remoteException = await Assert.ThrowsAnyAsync<Exception>(() => this.clientRpc.InvokeWithCancellationAsync(nameof(Server.AsyncMethodThrowsAggregateExceptionWithTwoInner), cancellationToken: this.TimeoutToken));

// The async server method itself strips the second of the InnerExceptions, so we can't recover it here.
// Since we only get one, we expect the inner exception (of the AggregateException)
Expand Down
9 changes: 5 additions & 4 deletions src/StreamJsonRpc.Tests/MessageHeaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Threading;
using StreamJsonRpc;
using Xunit;
using Xunit.Abstractions;
Expand Down Expand Up @@ -111,15 +112,15 @@ public async Task SendMessageWithEncoding(string encodingName)
var messageHandler = new HeaderDelimitedMessageHandler(this.clientStream, this.clientStream);
var rpcClient = new JsonRpc(messageHandler);
messageHandler.Encoding = Encoding.GetEncoding(encodingName);
await rpcClient.NotifyAsync("Foo");
await rpcClient.NotifyAsync("Foo").WithCancellation(this.TimeoutToken);
rpcClient.Dispose();

MemoryStream seekableServerStream = await this.GetSeekableServerStream();
int bytesRead = 0;
var reader = new StreamReader(seekableServerStream, Encoding.ASCII);
var headerLines = new List<string>();
string line;
while ((line = reader.ReadLine()) != string.Empty)
while ((line = await reader.ReadLineAsync().WithCancellation(this.TimeoutToken)) != string.Empty)
{
headerLines.Add(line);
bytesRead += line.Length + 2; // + CRLF
Expand All @@ -138,14 +139,14 @@ public async Task SendMessageWithEncoding(string encodingName)
// we need to reposition the stream at the start of the content to create a new StreamReader.
seekableServerStream.Position = bytesRead;
reader = new StreamReader(seekableServerStream, Encoding.GetEncoding(encodingName));
string json = reader.ReadToEnd();
string json = await reader.ReadToEndAsync().WithCancellation(this.TimeoutToken);
Assert.Equal('{', json[0]);
}

private async Task<MemoryStream> GetSeekableServerStream()
{
var seekableServerStream = new MemoryStream();
await this.serverStream.CopyToAsync(seekableServerStream);
await this.serverStream.CopyToAsync(seekableServerStream, 4096, this.TimeoutToken);
seekableServerStream.Position = 0;
return seekableServerStream;
}
Expand Down
12 changes: 6 additions & 6 deletions src/StreamJsonRpc/xlf/Resources.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
</trans-unit>
<trans-unit id="FindIProgressOfTError">
<source>Unable to cast given Type to IProgress&lt;T&gt;</source>
<target state="new">Unable to cast given Type to IProgress&lt;T&gt;</target>
<target state="translated">Daný typ nejde přetypovat na IProgress&lt;T&gt;</target>
<note />
</trans-unit>
<trans-unit id="FormatterConfigurationLockedAfterJsonRpcAssigned">
<source>The configuration is locked because this formatter has already been associated with a JsonRpc instance.</source>
<target state="new">The configuration is locked because this formatter has already been associated with a JsonRpc instance.</target>
<target state="translated">Konfigurace je zamknutá, protože tento formátovací modul už je přidružený k instanci JsonRpc.</target>
<note />
</trans-unit>
<trans-unit id="JsonRpcCannotBeNull" translate="yes" xml:space="preserve">
Expand All @@ -39,7 +39,7 @@
</trans-unit>
<trans-unit id="MarshaledObjectInResponseOrNotificationError">
<source>This tracked object should not be part of any response or notification.</source>
<target state="new">This tracked object should not be part of any response or notification.</target>
<target state="translated">Tento sledovaný objekt by neměl být součástí žádné odpovědi nebo oznámení.</target>
<note />
</trans-unit>
<trans-unit id="MethodHasRefOrOutParameters" translate="yes" xml:space="preserve">
Expand All @@ -59,7 +59,7 @@
</trans-unit>
<trans-unit id="NotSupportedWithoutMultiplexingStream">
<source>Out of band streams/pipes are not supported in this configuration. Have you set a MultiplexingStream on the formatter?</source>
<target state="new">Out of band streams/pipes are not supported in this configuration. Have you set a MultiplexingStream on the formatter?</target>
<target state="translated">Proudy nebo kanály mimo pásmo nejsou v této konfiguraci podporované. Nastavili jste ve formátovacím modulu MultiplexingStream?</target>
<note />
</trans-unit>
<trans-unit id="ReachedEndOfStream" translate="yes" xml:space="preserve">
Expand All @@ -74,7 +74,7 @@
</trans-unit>
<trans-unit id="RelayAlreadySet">
<source>Relay connection has already been established.</source>
<target state="new">Relay connection has already been established.</target>
<target state="translated">Připojení přenosu již bylo navázáno.</target>
<note />
</trans-unit>
<trans-unit id="ResponseIsNotError" translate="yes" xml:space="preserve">
Expand All @@ -84,7 +84,7 @@
</trans-unit>
<trans-unit id="ResponseUnexpectedFormat">
<source>Response is in an unexpected format. Only error and result are supported: {0}</source>
<target state="new">Response is in an unexpected format. Only error and result are supported: {0}</target>
<target state="translated">Odpověď je v neočekávaném formátu. Podporují se jenom chyby a výsledky: {0}</target>
<note>{0} is the response message.</note>
</trans-unit>
<trans-unit id="StreamDisposed" translate="yes" xml:space="preserve">
Expand Down
14 changes: 7 additions & 7 deletions src/StreamJsonRpc/xlf/Resources.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
</trans-unit>
<trans-unit id="FindIProgressOfTError">
<source>Unable to cast given Type to IProgress&lt;T&gt;</source>
<target state="new">Unable to cast given Type to IProgress&lt;T&gt;</target>
<target state="translated">Der angegebene Typ kann nicht in IProgress&lt;T&gt; umgewandelt werden.</target>
<note />
</trans-unit>
<trans-unit id="FormatterConfigurationLockedAfterJsonRpcAssigned">
<source>The configuration is locked because this formatter has already been associated with a JsonRpc instance.</source>
<target state="new">The configuration is locked because this formatter has already been associated with a JsonRpc instance.</target>
<target state="translated">Die Konfiguration ist gesperrt, weil dieser Formatierer bereits einer JsonRpc-Instanz zugeordnet wurde.</target>
<note />
</trans-unit>
<trans-unit id="JsonRpcCannotBeNull" translate="yes" xml:space="preserve">
Expand All @@ -39,7 +39,7 @@
</trans-unit>
<trans-unit id="MarshaledObjectInResponseOrNotificationError">
<source>This tracked object should not be part of any response or notification.</source>
<target state="new">This tracked object should not be part of any response or notification.</target>
<target state="translated">Dieses nachverfolgte Objekt darf nicht Teil einer Antwort oder Benachrichtigung sein.</target>
<note />
</trans-unit>
<trans-unit id="MethodHasRefOrOutParameters" translate="yes" xml:space="preserve">
Expand All @@ -59,7 +59,7 @@
</trans-unit>
<trans-unit id="NotSupportedWithoutMultiplexingStream">
<source>Out of band streams/pipes are not supported in this configuration. Have you set a MultiplexingStream on the formatter?</source>
<target state="new">Out of band streams/pipes are not supported in this configuration. Have you set a MultiplexingStream on the formatter?</target>
<target state="translated">Out-of-Band-Streams/-Pipes werden in dieser Konfiguration nicht unterstützt. Haben Sie einen MultiplexingStream für den Formatierer festgelegt?</target>
<note />
</trans-unit>
<trans-unit id="ReachedEndOfStream" translate="yes" xml:space="preserve">
Expand All @@ -74,7 +74,7 @@
</trans-unit>
<trans-unit id="RelayAlreadySet">
<source>Relay connection has already been established.</source>
<target state="new">Relay connection has already been established.</target>
<target state="translated">Die Relayverbindung wurde bereits eingerichtet.</target>
<note />
</trans-unit>
<trans-unit id="ResponseIsNotError" translate="yes" xml:space="preserve">
Expand All @@ -84,7 +84,7 @@
</trans-unit>
<trans-unit id="ResponseUnexpectedFormat">
<source>Response is in an unexpected format. Only error and result are supported: {0}</source>
<target state="new">Response is in an unexpected format. Only error and result are supported: {0}</target>
<target state="translated">Die Antwort weist ein unerwartetes Format auf. Es werden nur Fehler und Ergebnisse unterstützt: {0}</target>
<note>{0} is the response message.</note>
</trans-unit>
<trans-unit id="StreamDisposed" translate="yes" xml:space="preserve">
Expand Down Expand Up @@ -254,7 +254,7 @@
</trans-unit>
<trans-unit id="RequiredArgumentMissing" translate="yes" xml:space="preserve">
<source>An argument was not supplied for a required parameter.</source>
<target state="translated">Für einen erforderlichen Parameter wurde ein Arguemt nicht angegeben.</target>
<target state="translated">Für einen erforderlichen Parameter wurde ein Argument nicht angegeben.</target>
<note />
</trans-unit>
<trans-unit id="CancellationTokenMustBeLastParameter" translate="yes" xml:space="preserve">
Expand Down
12 changes: 6 additions & 6 deletions src/StreamJsonRpc/xlf/Resources.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
</trans-unit>
<trans-unit id="FindIProgressOfTError">
<source>Unable to cast given Type to IProgress&lt;T&gt;</source>
<target state="new">Unable to cast given Type to IProgress&lt;T&gt;</target>
<target state="translated">No se puede convertir el tipo dado en IProgress&lt;T&gt;</target>
<note />
</trans-unit>
<trans-unit id="FormatterConfigurationLockedAfterJsonRpcAssigned">
<source>The configuration is locked because this formatter has already been associated with a JsonRpc instance.</source>
<target state="new">The configuration is locked because this formatter has already been associated with a JsonRpc instance.</target>
<target state="translated">La configuración está bloqueada porque este formateador ya se ha asociado a una instancia de JsonRpc.</target>
<note />
</trans-unit>
<trans-unit id="JsonRpcCannotBeNull" translate="yes" xml:space="preserve">
Expand All @@ -39,7 +39,7 @@
</trans-unit>
<trans-unit id="MarshaledObjectInResponseOrNotificationError">
<source>This tracked object should not be part of any response or notification.</source>
<target state="new">This tracked object should not be part of any response or notification.</target>
<target state="translated">Este objeto con seguimiento no debe formar parte de ninguna respuesta o notificación.</target>
<note />
</trans-unit>
<trans-unit id="MethodHasRefOrOutParameters" translate="yes" xml:space="preserve">
Expand All @@ -59,7 +59,7 @@
</trans-unit>
<trans-unit id="NotSupportedWithoutMultiplexingStream">
<source>Out of band streams/pipes are not supported in this configuration. Have you set a MultiplexingStream on the formatter?</source>
<target state="new">Out of band streams/pipes are not supported in this configuration. Have you set a MultiplexingStream on the formatter?</target>
<target state="translated">No se admiten los flujos o canalizaciones fuera de banda en esta configuración. ¿Ha establecido un elemento MultiplexingStream en el formateador?</target>
<note />
</trans-unit>
<trans-unit id="ReachedEndOfStream" translate="yes" xml:space="preserve">
Expand All @@ -74,7 +74,7 @@
</trans-unit>
<trans-unit id="RelayAlreadySet">
<source>Relay connection has already been established.</source>
<target state="new">Relay connection has already been established.</target>
<target state="translated">Ya se ha establecido la conexión de retransmisión.</target>
<note />
</trans-unit>
<trans-unit id="ResponseIsNotError" translate="yes" xml:space="preserve">
Expand All @@ -84,7 +84,7 @@
</trans-unit>
<trans-unit id="ResponseUnexpectedFormat">
<source>Response is in an unexpected format. Only error and result are supported: {0}</source>
<target state="new">Response is in an unexpected format. Only error and result are supported: {0}</target>
<target state="translated">La respuesta tiene un formato no esperado. Solo se admiten errores y resultados: {0}</target>
<note>{0} is the response message.</note>
</trans-unit>
<trans-unit id="StreamDisposed" translate="yes" xml:space="preserve">
Expand Down
12 changes: 6 additions & 6 deletions src/StreamJsonRpc/xlf/Resources.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
</trans-unit>
<trans-unit id="FindIProgressOfTError">
<source>Unable to cast given Type to IProgress&lt;T&gt;</source>
<target state="new">Unable to cast given Type to IProgress&lt;T&gt;</target>
<target state="translated">Impossible de caster le type donné en IProgress&lt;T&gt;</target>
<note />
</trans-unit>
<trans-unit id="FormatterConfigurationLockedAfterJsonRpcAssigned">
<source>The configuration is locked because this formatter has already been associated with a JsonRpc instance.</source>
<target state="new">The configuration is locked because this formatter has already been associated with a JsonRpc instance.</target>
<target state="translated">La configuration est verrouillée, car ce formateur a déjà été associé à une instance JsonRpc.</target>
<note />
</trans-unit>
<trans-unit id="JsonRpcCannotBeNull" translate="yes" xml:space="preserve">
Expand All @@ -39,7 +39,7 @@
</trans-unit>
<trans-unit id="MarshaledObjectInResponseOrNotificationError">
<source>This tracked object should not be part of any response or notification.</source>
<target state="new">This tracked object should not be part of any response or notification.</target>
<target state="translated">Cet objet suivi ne doit pas faire partie d'une réponse ou d'une notification.</target>
<note />
</trans-unit>
<trans-unit id="MethodHasRefOrOutParameters" translate="yes" xml:space="preserve">
Expand All @@ -59,7 +59,7 @@
</trans-unit>
<trans-unit id="NotSupportedWithoutMultiplexingStream">
<source>Out of band streams/pipes are not supported in this configuration. Have you set a MultiplexingStream on the formatter?</source>
<target state="new">Out of band streams/pipes are not supported in this configuration. Have you set a MultiplexingStream on the formatter?</target>
<target state="translated">Les flux/canaux hors bande ne sont pas pris en charge dans cette configuration. Avez-vous défini un MultiplexingStream sur le formateur ?</target>
<note />
</trans-unit>
<trans-unit id="ReachedEndOfStream" translate="yes" xml:space="preserve">
Expand All @@ -74,7 +74,7 @@
</trans-unit>
<trans-unit id="RelayAlreadySet">
<source>Relay connection has already been established.</source>
<target state="new">Relay connection has already been established.</target>
<target state="translated">La connexion au relais a déjà été établie.</target>
<note />
</trans-unit>
<trans-unit id="ResponseIsNotError" translate="yes" xml:space="preserve">
Expand All @@ -84,7 +84,7 @@
</trans-unit>
<trans-unit id="ResponseUnexpectedFormat">
<source>Response is in an unexpected format. Only error and result are supported: {0}</source>
<target state="new">Response is in an unexpected format. Only error and result are supported: {0}</target>
<target state="translated">Le format de la réponse est inattendu. Seuls l'erreur et le résultat sont pris en charge : {0}</target>
<note>{0} is the response message.</note>
</trans-unit>
<trans-unit id="StreamDisposed" translate="yes" xml:space="preserve">
Expand Down
12 changes: 6 additions & 6 deletions src/StreamJsonRpc/xlf/Resources.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
</trans-unit>
<trans-unit id="FindIProgressOfTError">
<source>Unable to cast given Type to IProgress&lt;T&gt;</source>
<target state="new">Unable to cast given Type to IProgress&lt;T&gt;</target>
<target state="translated">Non è possibile eseguire il cast del tipo specificato in IProgress&lt;T&gt;</target>
<note />
</trans-unit>
<trans-unit id="FormatterConfigurationLockedAfterJsonRpcAssigned">
<source>The configuration is locked because this formatter has already been associated with a JsonRpc instance.</source>
<target state="new">The configuration is locked because this formatter has already been associated with a JsonRpc instance.</target>
<target state="translated">La configurazione è bloccata perché questo formattatore è già stato associato a un'istanza di JsonRpc.</target>
<note />
</trans-unit>
<trans-unit id="JsonRpcCannotBeNull" translate="yes" xml:space="preserve">
Expand All @@ -39,7 +39,7 @@
</trans-unit>
<trans-unit id="MarshaledObjectInResponseOrNotificationError">
<source>This tracked object should not be part of any response or notification.</source>
<target state="new">This tracked object should not be part of any response or notification.</target>
<target state="translated">Questo oggetto rilevato non deve far parte di alcuna risposta o notifica.</target>
<note />
</trans-unit>
<trans-unit id="MethodHasRefOrOutParameters" translate="yes" xml:space="preserve">
Expand All @@ -59,7 +59,7 @@
</trans-unit>
<trans-unit id="NotSupportedWithoutMultiplexingStream">
<source>Out of band streams/pipes are not supported in this configuration. Have you set a MultiplexingStream on the formatter?</source>
<target state="new">Out of band streams/pipes are not supported in this configuration. Have you set a MultiplexingStream on the formatter?</target>
<target state="translated">I flussi e/o le pipe fuori banda non sono supportati in questa configurazione. È stato impostato un elemento MultiplexingStream sul formattatore?</target>
<note />
</trans-unit>
<trans-unit id="ReachedEndOfStream" translate="yes" xml:space="preserve">
Expand All @@ -74,7 +74,7 @@
</trans-unit>
<trans-unit id="RelayAlreadySet">
<source>Relay connection has already been established.</source>
<target state="new">Relay connection has already been established.</target>
<target state="translated">La connessione di inoltro è già stata stabilita.</target>
<note />
</trans-unit>
<trans-unit id="ResponseIsNotError" translate="yes" xml:space="preserve">
Expand All @@ -84,7 +84,7 @@
</trans-unit>
<trans-unit id="ResponseUnexpectedFormat">
<source>Response is in an unexpected format. Only error and result are supported: {0}</source>
<target state="new">Response is in an unexpected format. Only error and result are supported: {0}</target>
<target state="translated">Il formato della risposta è imprevisto. Sono supportati solo l'errore e il risultato: {0}</target>
<note>{0} is the response message.</note>
</trans-unit>
<trans-unit id="StreamDisposed" translate="yes" xml:space="preserve">
Expand Down
Loading

0 comments on commit 45a4172

Please sign in to comment.