Skip to content
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

Il repack issue investigation #1

Merged
merged 3 commits into from
Dec 12, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Benchmark/Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<NoWarn>$(NoWarn);CS1591;CA1822</NoWarn>
<DefineConstants>$(DefineConstants);NEW_API</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)'=='net472'">$(DefineConstants);WRITE_DLL</DefineConstants>
Expand Down
6 changes: 3 additions & 3 deletions src/BuildToolsUnitTests/RoslynInternals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.CodeAnalysis.Text;
using ProtoBuf.BuildTools.Internal;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysisNew;
using System.Text;
using System.Threading;

Expand Down Expand Up @@ -44,7 +44,7 @@ private class InMemoryConfigOptions : AnalyzerConfigOptions
private readonly ImmutableDictionary<string, string> _values;
public InMemoryConfigOptions(ImmutableDictionary<string, string> values)
=> _values = values;
public override bool TryGetValue(string key, [NotNullWhen(true)] out string? value)
public override bool TryGetValue(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out string? value)
=> _values.TryGetValue(key, out value);
}
}
Expand Down Expand Up @@ -92,6 +92,6 @@ public TestAnalyzerConfigOptions(ImmutableDictionary<string, string> properties)
_backing = properties;
}

public override bool TryGetValue(string key, [NotNullWhen(true)] out string? value) => _backing.TryGetValue(key, out value);
public override bool TryGetValue(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out string? value) => _backing.TryGetValue(key, out value);
}
}
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<IncludeSymbols>false</IncludeSymbols>
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
<LangVersion>12</LangVersion>
<LangVersion>10</LangVersion>
<Features>strict</Features>
<CodeAnalysisRuleset>$(MSBuildThisFileDirectory)Shared.ruleset</CodeAnalysisRuleset>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
Expand Down
2 changes: 1 addition & 1 deletion src/Examples/Examples.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<Configurations>Debug;Release;VS</Configurations>
<DefineConstants>NO_CODEGEN;NO_WCF;NO_ENYIM</DefineConstants>
<DefineConstants Condition="$(CI) != 'true'">$(DefineConstants);LONG_RUNNING</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/VBTest/VBTest.vbproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>14</LangVersion>
<RootNamespace />
<NoWarn>IDE1006</NoWarn>
Expand Down
4 changes: 2 additions & 2 deletions src/protobuf-net.BuildTools/Analyzers/DataContractAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using ProtoBuf.BuildTools.Internal;
using System;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysisNew;
using System.Linq;

namespace ProtoBuf.BuildTools.Analyzers
Expand All @@ -14,7 +14,7 @@ namespace ProtoBuf.BuildTools.Analyzers
/// Reports common usage errors in code that uses protobuf-net
/// </summary>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
[SuppressMessage("AnalyzerReferenceCodeFix", "RS1022", Justification = "Its fine to reference codeFix implementations from analyzer directly: https://github.com/dotnet/roslyn-analyzers/issues/5341")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("AnalyzerReferenceCodeFix", "RS1022", Justification = "Its fine to reference codeFix implementations from analyzer directly: https://github.com/dotnet/roslyn-analyzers/issues/5341")]
public class DataContractAnalyzer : DiagnosticAnalyzer
{
internal static readonly DiagnosticDescriptor InvalidFieldNumber = new(
Expand Down
2 changes: 1 addition & 1 deletion src/protobuf-net.Core/IProtoInputT.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ProtoBuf.Internal;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysisNew;

namespace ProtoBuf
{
Expand Down
2 changes: 1 addition & 1 deletion src/protobuf-net.Core/IProtoOutputT.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ProtoBuf.Internal;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysisNew;

namespace ProtoBuf
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
#if PLAT_DYNAMIC_ACCESS_ATTR
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
// forwards, just to make it explicit that we mean the same
[assembly: TypeForwardedTo(typeof(DynamicallyAccessedMembersAttribute))]
[assembly: TypeForwardedTo(typeof(DynamicallyAccessedMemberTypes))]
#endif

namespace ProtoBuf.Internal
namespace ProtoBuf.Internal
{
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysisNew;
internal sealed class DynamicAccess
{
internal const DynamicallyAccessedMemberTypes ContractType
Expand All @@ -22,14 +14,7 @@ internal sealed class DynamicAccess
}
}

#if !PLAT_DYNAMIC_ACCESS_ATTR
// internalized version of https://github.com/dotnet/runtime/blob/master/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/DynamicallyAccessedMembersAttribute.cs
// and https://github.com/dotnet/runtime/blob/master/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/DynamicallyAccessedMemberTypes.cs

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace System.Diagnostics.CodeAnalysis
namespace System.Diagnostics.CodeAnalysisNew
{
/// <summary>
/// Indicates that certain members on a specified <see cref="Type"/> are accessed dynamically,
Expand All @@ -53,7 +38,7 @@ namespace System.Diagnostics.CodeAnalysis
AttributeTargets.Field | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter |
AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Method,
Inherited = false)]
internal sealed class DynamicallyAccessedMembersAttribute : Attribute
public sealed class DynamicallyAccessedMembersAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="DynamicallyAccessedMembersAttribute"/> class
Expand All @@ -79,7 +64,7 @@ public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes member
/// bitwise combination of its member values.
/// </summary>
[Flags]
internal enum DynamicallyAccessedMemberTypes
public enum DynamicallyAccessedMemberTypes
{
/// <summary>
/// Specifies no members.
Expand Down Expand Up @@ -156,5 +141,4 @@ internal enum DynamicallyAccessedMemberTypes
/// </summary>
All = ~None
}
}
#endif
}
2 changes: 1 addition & 1 deletion src/protobuf-net.Core/MeasureState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using ProtoBuf.Meta;
using System;
using System.Buffers;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysisNew;
using System.IO;

namespace ProtoBuf
Expand Down