Skip to content

Commit

Permalink
Update messagepack to tag v2.5.192 (#2089)
Browse files Browse the repository at this point in the history
* Update messagepack to tag v2.1.115

* Adding pitfalls

* Make protocol projects nullable

* Throw with parameter name

* Fix nullable

* update

...+ console.log("Application has started successfully.");
```

file: src/config.js
diff:
```
- const port = 3000;
+ const port = process.env.PORT || 3000;
```

Commit message: Update log message and port configuration

* Fix build failure
  • Loading branch information
vicancy authored Dec 9, 2024
1 parent 3f2a64a commit 6bfabbf
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 85 deletions.
2 changes: 1 addition & 1 deletion build/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<MicrosoftAspNetCoreSignalRPackageVersion>1.0.0</MicrosoftAspNetCoreSignalRPackageVersion>
<MicrosoftAspNetCoreLocalizationPackageVersion>2.1.0</MicrosoftAspNetCoreLocalizationPackageVersion>
<SystemBuffersPackageVersion>4.5.1</SystemBuffersPackageVersion>
<SystemMemoryPackageVersion>4.5.4</SystemMemoryPackageVersion>
<SystemMemoryPackageVersion>4.5.5</SystemMemoryPackageVersion>
<SystemRuntimeCompilerServicesUnsafePackageVersion>6.0.0</SystemRuntimeCompilerServicesUnsafePackageVersion>
<AzureIdentityPackageVersion>1.11.4</AzureIdentityPackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>2.1.0</MicrosoftExtensionsLoggingPackageVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable enable
using System;
using System.Threading;
using System.Threading.Tasks;
Expand Down
12 changes: 6 additions & 6 deletions src/Microsoft.Azure.SignalR.Protocols/ConnectionMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public OpenConnectionMessage(string connectionId, Claim[]? claims)
/// <param name="claims">An array of <see cref="Claim"/> associated with the connection.</param>
/// <param name="headers">A <see cref="IDictionary{TKey,TValue}"/> associated with the connection.</param>
/// <param name="queryString">Query string associated with the connection.</param>
public OpenConnectionMessage(string connectionId, Claim[]? claims, IDictionary<string, StringValues> headers, string queryString)
public OpenConnectionMessage(string connectionId, Claim[]? claims, IDictionary<string, StringValues> headers, string? queryString)
: base(connectionId)
{
Claims = claims ?? [];
Expand All @@ -75,7 +75,7 @@ public OpenConnectionMessage(string connectionId, Claim[]? claims, IDictionary<s
/// <summary>
/// Gets or sets the associated query string.
/// </summary>
public string QueryString { get; set; }
public string? QueryString { get; set; }

/// <summary>
/// Gets or sets the protocol for new connection.
Expand All @@ -99,7 +99,7 @@ public class CloseConnectionMessage : ConnectionMessage, IMessageWithTracingId
/// <param name="connectionId">The connection Id.</param>
/// <param name="errorMessage">Optional error message.</param>
/// <param name="headers">A <see cref="IDictionary{TKey,TValue}"/> associated with the connection.</param>
public CloseConnectionMessage(string connectionId, string errorMessage, IDictionary<string, StringValues>? headers = null) : base(connectionId)
public CloseConnectionMessage(string connectionId, string? errorMessage, IDictionary<string, StringValues>? headers = null) : base(connectionId)
{
ErrorMessage = errorMessage ?? "";
Headers = headers ?? new Dictionary<string, StringValues>();
Expand Down Expand Up @@ -230,7 +230,7 @@ public class ClientCompletionMessage : ServiceCompletionMessage, IHasProtocol
/// <param name="protocol">The protocol of the connection.</param>
/// <param name="payload">The payload of the completion result.</param>
/// <param name="tracingId">The tracing Id of the message.</param>
public ClientCompletionMessage(string invocationId, string connectionId, string callerServerId, string protocol, ReadOnlyMemory<byte> payload, ulong? tracingId = null)
public ClientCompletionMessage(string invocationId, string connectionId, string callerServerId, string? protocol, ReadOnlyMemory<byte> payload, ulong? tracingId = null)
: base(invocationId, connectionId, callerServerId, tracingId)
{
Protocol = protocol;
Expand Down Expand Up @@ -261,10 +261,10 @@ public class ErrorCompletionMessage : ServiceCompletionMessage
/// <param name="callerServerId">The serverId that wrap the completion result.</param>
/// <param name="error">The error information about invacation failure.</param>
/// <param name="tracingId">The tracing Id of the message.</param>
public ErrorCompletionMessage(string invocationId, string connectionId, string callerServerId, string error, ulong? tracingId = null)
public ErrorCompletionMessage(string invocationId, string connectionId, string callerServerId, string? error, ulong? tracingId = null)
: base(invocationId, connectionId, callerServerId, tracingId)
{
Error = error;
Error = error ?? string.Empty;
}

/// <summary>
Expand Down
18 changes: 9 additions & 9 deletions src/Microsoft.Azure.SignalR.Protocols/GroupMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class LeaveGroupMessage : ExtensibleServiceMessage, IMessageWithTracingId
/// <summary>
/// Gets or sets the group name.
/// </summary>
public string GroupName { get; set; }
public string? GroupName { get; set; }

/// <summary>
/// Gets or sets the tracing Id
Expand All @@ -68,7 +68,7 @@ public class LeaveGroupMessage : ExtensibleServiceMessage, IMessageWithTracingId
/// <param name="connectionId">The connection Id.</param>
/// <param name="groupName">The group name, from which the connection will leave.</param>
/// <param name="tracingId">The tracing Id of the message.</param>
public LeaveGroupMessage(string connectionId, string groupName, ulong? tracingId = null)
public LeaveGroupMessage(string connectionId, string? groupName, ulong? tracingId = null)
{
ConnectionId = connectionId;
GroupName = groupName;
Expand Down Expand Up @@ -130,7 +130,7 @@ public class UserLeaveGroupMessage : ExtensibleServiceMessage, IMessageWithTraci
/// <summary>
/// Gets or sets the group name.
/// </summary>
public string GroupName { get; set; }
public string? GroupName { get; set; }

/// <summary>
/// Gets or sets the tracing Id
Expand All @@ -145,7 +145,7 @@ public class UserLeaveGroupMessage : ExtensibleServiceMessage, IMessageWithTraci
/// <param name="userId">The user Id.</param>
/// <param name="groupName">The group name, from which the user will leave.</param>
/// <param name="tracingId">The tracing Id of the message.</param>
public UserLeaveGroupMessage(string userId, string groupName, ulong? tracingId = null)
public UserLeaveGroupMessage(string userId, string? groupName, ulong? tracingId = null)
{
UserId = userId;
GroupName = groupName;
Expand Down Expand Up @@ -216,7 +216,7 @@ public class UserLeaveGroupWithAckMessage : ExtensibleServiceMessage, IMessageWi
/// <summary>
/// Gets or sets the group name.
/// </summary>
public string GroupName { get; set; }
public string? GroupName { get; set; }

/// <summary>
/// Gets or sets the tracing Id
Expand All @@ -237,7 +237,7 @@ public class UserLeaveGroupWithAckMessage : ExtensibleServiceMessage, IMessageWi
/// <param name="groupName">The group name, from which the user will leave.</param>
/// <param name="ackId">The ack Id.</param>
/// <param name="tracingId">The tracing Id of the message.</param>
public UserLeaveGroupWithAckMessage(string userId, string groupName, int ackId, ulong? tracingId = null)
public UserLeaveGroupWithAckMessage(string userId, string? groupName, int ackId, ulong? tracingId = null)
{
UserId = userId;
GroupName = groupName;
Expand Down Expand Up @@ -312,7 +312,7 @@ public class LeaveGroupWithAckMessage : ExtensibleServiceMessage, IAckableMessag
/// <summary>
/// Gets or sets the group name.
/// </summary>
public string GroupName { get; set; }
public string? GroupName { get; set; }

/// <summary>
/// Gets or sets the ack id.
Expand All @@ -332,7 +332,7 @@ public class LeaveGroupWithAckMessage : ExtensibleServiceMessage, IAckableMessag
/// <param name="connectionId">The connection Id.</param>
/// <param name="groupName">The group name, from which the connection will leave.</param>
/// <param name="tracingId">The tracing Id of the message.</param>
public LeaveGroupWithAckMessage(string connectionId, string groupName, ulong? tracingId = null): this(connectionId, groupName, 0, tracingId)
public LeaveGroupWithAckMessage(string connectionId, string? groupName, ulong? tracingId = null): this(connectionId, groupName, 0, tracingId)
{
}

Expand All @@ -343,7 +343,7 @@ public LeaveGroupWithAckMessage(string connectionId, string groupName, ulong? tr
/// <param name="groupName">The group name, from which the connection will leave.</param>
/// <param name="ackId">The ack Id</param>
/// <param name="tracingId">The tracing Id of the message.</param>
public LeaveGroupWithAckMessage(string connectionId, string groupName, int ackId, ulong? tracingId = null)
public LeaveGroupWithAckMessage(string connectionId, string? groupName, int ackId, ulong? tracingId = null)
{
ConnectionId = connectionId;
GroupName = groupName;
Expand Down
13 changes: 13 additions & 0 deletions src/Microsoft.Azure.SignalR.Protocols/MessagePackPitfalls.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Text;

namespace System.Diagnostics.CodeAnalysis;

[AttributeUsage(AttributeTargets.Method, Inherited = false)]
internal sealed class DoesNotReturnAttribute : Attribute
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Microsoft.Azure.SignalR.Protocol</RootNamespace>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
22 changes: 11 additions & 11 deletions src/Microsoft.Azure.SignalR.Protocols/ServiceMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public abstract class ServiceMessage
/// </summary>
public virtual ServiceMessage Clone() => (MemberwiseClone() as ServiceMessage)!;

public static byte GeneratePartitionKey(string input)
public static byte GeneratePartitionKey(string? input)
{
return (byte)((input?.GetHashCode() ?? 0) & 0xFF);
}
Expand Down Expand Up @@ -393,7 +393,7 @@ public class HandshakeResponseMessage : ExtensibleServiceMessage
/// <summary>
/// Gets or sets the optional error message.
/// </summary>
public string ErrorMessage { get; set; }
public string? ErrorMessage { get; set; }

/// <summary>
/// Gets or sets the id of this connection.
Expand All @@ -411,7 +411,7 @@ public HandshakeResponseMessage() : this(string.Empty)
/// Initializes a new instance of the <see cref="HandshakeResponseMessage"/> class.
/// </summary>
/// <param name="errorMessage">An optional response error message. A <c>null</c> or empty error message indicates a successful handshake.</param>
public HandshakeResponseMessage(string errorMessage)
public HandshakeResponseMessage(string? errorMessage)
{
ErrorMessage = errorMessage;
}
Expand All @@ -427,7 +427,7 @@ public class PingMessage : ServiceMessage
/// </summary>
public static PingMessage Instance = new PingMessage();

public string[] Messages { get; set; } = Array.Empty<string>();
public string?[] Messages { get; set; } = Array.Empty<string?>();
}

/// <summary>
Expand All @@ -444,9 +444,9 @@ public class ServiceErrorMessage : ServiceMessage
/// Initializes a new instance of the <see cref="ServiceErrorMessage"/> class.
/// </summary>
/// <param name="errorMessage">An error message.</param>
public ServiceErrorMessage(string errorMessage)
public ServiceErrorMessage(string? errorMessage)
{
ErrorMessage = errorMessage;
ErrorMessage = errorMessage ?? string.Empty;
}
}

Expand All @@ -463,7 +463,7 @@ public class ServiceEventMessage : ExtensibleServiceMessage
/// <summary>
/// Gets or sets the id of event object.
/// </summary>
public string Id { get; set; }
public string? Id { get; set; }

/// <summary>
/// Gets or sets the kind of event.
Expand All @@ -482,12 +482,12 @@ public class ServiceEventMessage : ExtensibleServiceMessage
/// <param name="id">An id of event object.</param>
/// <param name="kind">A kind of event.</param>
/// <param name="message">A message of event.</param>
public ServiceEventMessage(ServiceEventObjectType type, string id, ServiceEventKind kind, string message)
public ServiceEventMessage(ServiceEventObjectType type, string? id, ServiceEventKind kind, string? message)
{
Type = type;
Id = id;
Kind = kind;
Message = message;
Message = message ?? string.Empty;
}
}

Expand Down Expand Up @@ -526,11 +526,11 @@ public AckMessage(int ackId, int status) : this(ackId, status, string.Empty)
/// <param name="ackId">The ack Id</param>
/// <param name="status">The status code</param>
/// <param name="message">The ack message</param>
public AckMessage(int ackId, int status, string message)
public AckMessage(int ackId, int status, string? message)
{
AckId = ackId;
Status = status;
Message = message;
Message = message ?? string.Empty;
}
}

Expand Down
Loading

0 comments on commit 6bfabbf

Please sign in to comment.