Skip to content

Make StringHelper.GenerateSuffix internal #3663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ namespace NHibernate.Test.NHSpecificTest.NH2898
public partial class BinaryFormatterCache : CacheBase
{

public override Task<object> GetAsync(object key, CancellationToken cancellationToken)
{
try
{
var entry = _hashtable[key] as byte[];
if (entry == null)
return Task.FromResult<object>(null);

var fmt = new BinaryFormatter
{
#if !NETFX
SurrogateSelector = new SerializationHelper.SurrogateSelector()
#endif
};
using (var stream = new MemoryStream(entry))
{
return Task.FromResult<object>(fmt.Deserialize(stream));
}
}
catch (System.Exception ex)
{
return Task.FromException<object>(ex);
}
}

public override Task PutAsync(object key, object value, CancellationToken cancellationToken)
{
try
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate/Util/StringHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ public static bool IsAnyNewLine(this string str, int index, out int newLineLengt
return false;
}

public static string GenerateSuffix(int index)
internal static string GenerateSuffix(int index)
{
return index switch
{
Expand Down