Skip to content

Commit

Permalink
Update the CustomMarshallerAttributeFixer to support adding missing m…
Browse files Browse the repository at this point in the history
…ethods for stateless marshaller shapes (#72869)
  • Loading branch information
jkoritzinsky authored Jul 28, 2022
1 parent ad58ce5 commit cf3bf7a
Show file tree
Hide file tree
Showing 4 changed files with 946 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ internal static DiagnosticDescriptor GetDefaultMarshalModeDiagnostic(DiagnosticD
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics =>
ImmutableArray.Create(
MarshallerTypeMustSpecifyManagedTypeRule,
MarshallerTypeMustBeStaticClassOrStructRule,
UnmanagedTypeMustBeUnmanagedRule,
GetPinnableReferenceReturnTypeBlittableRule,
TypeMustHaveExplicitCastFromVoidPointerRule,
Expand Down Expand Up @@ -653,7 +654,7 @@ void ReportDiagnosticsForMissingMembers(DiagnosticReporter diagnosticReporter)
if (isLinearCollectionMarshaller)
{
// Verify that all of the following methods are present with valid shapes:
// - AllocateContainerForUnmanagedElements
// - AllocateContainerForManagedElements
// - GetUnmanagedValuesSource
// - GetManagedValuesDestination
if (methods.ToManaged is null && methods.ToManagedFinally is null)
Expand All @@ -662,7 +663,7 @@ void ReportDiagnosticsForMissingMembers(DiagnosticReporter diagnosticReporter)
StatelessLinearCollectionRequiresTwoParameterAllocateContainerForManagedElementsRule,
MissingMemberNames.CreateDiagnosticPropertiesForMissingMembersDiagnostic(
mode,
ShapeMemberNames.LinearCollection.Stateless.AllocateContainerForUnmanagedElements),
ShapeMemberNames.LinearCollection.Stateless.AllocateContainerForManagedElements),
marshallerType.ToDisplayString(),
mode,
managedType.ToDisplayString());
Expand Down
Loading

0 comments on commit cf3bf7a

Please sign in to comment.