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
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