Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Orleans.Core.Abstractions/Lifecycle/IGrainLifecycle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;

namespace Orleans.Runtime
Expand Down Expand Up @@ -106,6 +107,6 @@ public interface IRehydrationContext
/// <param name="key">The key.</param>
/// <param name="value">The value, if present.</param>
/// <returns><see langword="true"/> if the key exists in the context, otherwise <see langword="false"/>.</returns>
bool TryGetValue<T>(string key, out T? value);
bool TryGetValue<T>(string key, [NotNullWhen(true)] out T? value);
}
}
5 changes: 3 additions & 2 deletions src/Orleans.Core/Lifecycle/MigrationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using Orleans.Serialization.Buffers;
using Orleans.Serialization.Codecs;
Expand Down Expand Up @@ -97,7 +98,7 @@ public bool TryGetBytes(string key, out ReadOnlySequence<byte> value)
return false;
}

public bool TryGetValue<T>(string key, out T? value)
public bool TryGetValue<T>(string key, [NotNullWhen(true)] out T? value)
{
if (_indices.TryGetValue(key, out var record) && _sessionPool.CodecProvider.TryGetCodec<T>() is { } codec)
{
Expand All @@ -106,7 +107,7 @@ public bool TryGetValue<T>(string key, out T? value)
var reader = Reader.Create(source, session);
var field = reader.ReadFieldHeader();
value = codec.ReadValue(ref reader, field);
return true;
return value is not null;
}

value = default;
Expand Down