Exclude System.Runtime.CompilerServices.NullableContextAttribute (#66)

* HttpClient

* .

* .

* .
This commit is contained in:
Stef Heyenrath
2023-12-06 21:32:07 +01:00
committed by GitHub
parent 77f28ffacc
commit 059886d1ca
34 changed files with 1266 additions and 132 deletions
@@ -1,8 +0,0 @@
namespace ProxyInterfaceSourceGenerator.Constants;
internal static class InternalClassNames
{
public const string NullableAttribute = "System.Runtime.CompilerServices.NullableAttribute";
public const string AsyncStateMachineAttribute = "System.Runtime.CompilerServices.AsyncStateMachineAttribute";
}
@@ -1,6 +1,5 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using ProxyInterfaceSourceGenerator.Constants;
namespace ProxyInterfaceSourceGenerator.Extensions;
@@ -8,8 +7,9 @@ internal static class SymbolExtensions
{
private static readonly string[] ExcludedAttributes =
{
InternalClassNames.AsyncStateMachineAttribute ,
InternalClassNames.NullableAttribute
"System.Runtime.CompilerServices.NullableAttribute",
"System.Runtime.CompilerServices.NullableContextAttribute",
"System.Runtime.CompilerServices.AsyncStateMachineAttribute"
};
public static string GetAttributesPrefix(this ISymbol symbol)
@@ -198,7 +198,10 @@ using System;
private string GeneratePublicMethods(ClassSymbol targetClassSymbol, bool proxyBaseClasses)
{
var str = new StringBuilder();
foreach (var method in MemberHelper.GetPublicMethods(targetClassSymbol, proxyBaseClasses))
var methods = MemberHelper.GetPublicMethods(targetClassSymbol, proxyBaseClasses);
foreach (var method in methods)
{
var methodParameters = new List<string>();
var invokeParameters = new List<string>();
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>0.0.36</Version>
<Version>0.0.37</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<ProjectGuid>{12344228-91F4-4502-9595-39584E5ABB34}</ProjectGuid>
<LangVersion>10</LangVersion>
@@ -92,7 +92,7 @@ internal static class MemberHelper
}
var ownMembers = membersQuery.ToList();
var ownPropertyNames = ownMembers.Select(x => x.Name);
var ownMemberNames = ownMembers.Select(x => x.Name);
if (!proxyBaseClasses)
{
@@ -106,7 +106,7 @@ internal static class MemberHelper
{
var baseMembers = baseType.GetMembers().OfType<T>()
.Where(m => m.DeclaredAccessibility == Accessibility.Public)
.Where(x => !ownPropertyNames.Contains(x.Name));
.Where(x => !ownMemberNames.Contains(x.Name));
foreach (var filter in filters)
{