Skip to content

Commit a09804b

Browse files
committed
Fix: Weird issue where ReadOnlySpan overload is hidden for MemoryStream
1 parent f19c075 commit a09804b

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

Source/Reloaded.Memory/Reloaded.Memory.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<RepositoryUrl></RepositoryUrl>
1717
<RepositoryType></RepositoryType>
1818
<Description>A fully featured C# memory editing library supporting reading/writing primitive or generic struct types in either current or an external process.</Description>
19-
<Version>4.0.0</Version>
19+
<Version>4.0.1</Version>
2020
<Authors>Sewer56</Authors>
2121
<Company />
2222
<Product>Project Reloaded</Product>

Source/Reloaded.Memory/Streams/ExtendedMemoryStream.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void Write<T>(ref T structure) where T : unmanaged
9898
{
9999
Span<byte> stack = stackalloc byte[sizeof(T)];
100100
Struct.GetBytes(ref structure, stack);
101-
base.Write(stack);
101+
Write(stack);
102102
}
103103
else
104104
{
@@ -109,6 +109,16 @@ public void Write<T>(ref T structure) where T : unmanaged
109109
#endif
110110
}
111111

112+
113+
#if FEATURE_NATIVE_SPAN
114+
/// <summary>
115+
/// Writes the sequence of bytes contained in source into the current memory stream and advances the current position within this memory stream by the number of bytes written.
116+
/// </summary>
117+
/// <param name="source">A region of memory. This method copies the contents of this region to the current memory stream.</param>
118+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
119+
public new void Write(ReadOnlySpan<byte> source) => base.Write(source);
120+
#endif
121+
112122
/// <summary>
113123
/// Appends a managed/marshalled structure onto the given <see cref="MemoryStream"/> and advances the position.
114124
/// </summary>

0 commit comments

Comments
 (0)