Fix net45 tests

This commit is contained in:
James Newton-King 2020-04-11 18:00:51 +12:00 committed by Jan Tattermusch
parent 07182a843c
commit 18bfd9e2e5
9 changed files with 19 additions and 1 deletions

View File

@ -54,6 +54,7 @@ namespace Google.Protobuf
/// and <see cref="MapField{TKey, TValue}"/> to serialize such fields.
/// </para>
/// </remarks>
[SecuritySafeCritical]
public sealed class CodedInputStream : IDisposable
{
/// <summary>

View File

@ -38,6 +38,7 @@ using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security;
namespace Google.Protobuf.Collections
{
@ -442,6 +443,7 @@ namespace Google.Protobuf.Collections
/// </remarks>
/// <param name="ctx">Input to read from</param>
/// <param name="codec">Codec describing how the key/value pairs are encoded</param>
[SecuritySafeCritical]
public void AddEntriesFrom(ref ParseContext ctx, Codec codec)
{
// TODO: deduplicate code?
@ -689,6 +691,7 @@ namespace Google.Protobuf.Collections
}
}
[SecuritySafeCritical]
public void MergeFrom_Internal(ref ParseContext ctx)
{
// TODO(jtattermusch): deduplicate code

View File

@ -34,6 +34,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Security;
namespace Google.Protobuf.Collections
{
@ -111,6 +112,7 @@ namespace Google.Protobuf.Collections
/// </summary>
/// <param name="ctx">The input to read from.</param>
/// <param name="codec">The codec to use in order to read each entry.</param>
[SecuritySafeCritical]
public void AddEntriesFrom(ref ParseContext ctx, FieldCodec<T> codec)
{
// TODO: Inline some of the Add code, so we can avoid checking the size on every

View File

@ -35,6 +35,7 @@ using Google.Protobuf.Compatibility;
using Google.Protobuf.WellKnownTypes;
using System;
using System.Collections.Generic;
using System.Security;
namespace Google.Protobuf
{
@ -614,6 +615,7 @@ namespace Google.Protobuf
return value;
}
[SecuritySafeCritical]
internal static T Read<T>(ref ParseContext ctx, FieldCodec<T> codec)
{
int length = ctx.ReadLength();

View File

@ -46,6 +46,7 @@ namespace Google.Protobuf
/// <summary>
/// Primitives for parsing protobuf wire format.
/// </summary>
[SecuritySafeCritical]
internal static class ParsingPrimitives
{
@ -595,6 +596,7 @@ namespace Google.Protobuf
/// <exception cref="InvalidProtocolBufferException">
/// the end of the stream or the current limit was reached
/// </exception>
[SecuritySafeCritical]
public static string ReadRawString(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state, int length)
{
// No need to read any data for an empty string.
@ -643,7 +645,8 @@ namespace Google.Protobuf
// Slow path: Build a byte array first then copy it.
return CodedOutputStream.Utf8Encoding.GetString(ReadRawBytes(ref buffer, ref state, length), 0, length);
}
[SecuritySafeCritical]
private static byte ReadRawByte(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state)
{
if (state.bufferPos == state.bufferSize)

View File

@ -34,12 +34,14 @@ using System;
using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
using System.Security;
namespace Google.Protobuf
{
/// <summary>
/// Reading and skipping messages / groups
/// </summary>
[SecuritySafeCritical]
internal static class ParsingPrimitivesMessages
{
public static void SkipLastField(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state)

View File

@ -46,6 +46,7 @@ namespace Google.Protobuf
/// <summary>
/// Fast parsing primitives for wrapper types
/// </summary>
[SecuritySafeCritical]
internal static class ParsingPrimitivesWrappers
{
internal static float? ReadFloatWrapperLittleEndian(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state)

View File

@ -34,6 +34,7 @@ using System;
using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
using System.Security;
namespace Google.Protobuf
{
@ -41,6 +42,7 @@ namespace Google.Protobuf
/// Abstraction for reading from a stream / read only sequence.
/// Parsing from the buffer is a loop of reading from current buffer / refreshing the buffer once done.
/// </summary>
[SecuritySafeCritical]
internal struct SegmentedBufferHelper
{
private int? totalLength;

View File

@ -33,6 +33,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Security;
using Google.Protobuf.Reflection;
namespace Google.Protobuf
@ -278,6 +279,7 @@ namespace Google.Protobuf
/// <param name="unknownFields">The UnknownFieldSet which need to be merged</param>
/// <param name="ctx">The parse context from which to read the field</param>
/// <returns>The merged UnknownFieldSet</returns>
[SecuritySafeCritical]
public static UnknownFieldSet MergeFieldFrom(UnknownFieldSet unknownFields,
ref ParseContext ctx)
{