Skip to content

UWPSyncGenerator adds property setters incorrectly #6980

Closed

Description

@Youssef1313

Current behavior

Setter is added even if it doesn't exist in UWP. This is caused by the following:

if (property.GetMethod != null)
{
using (b.BlockInvariant($"get"))
{
b.AppendLineInvariant($"throw new global::System.NotSupportedException();");
}
}
if (property.GetMethod != null)
{
using (b.BlockInvariant($"set"))
{
b.AppendLineInvariant($"throw new global::System.NotSupportedException();");
}
}

The second condition should clearly check for SetMethod instead of GetMethod.

This causes bugs like #6885

Expected behavior

⏫

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

No response

Works on UWP/WinUI

No response

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

Activity

  1. added
    difficulty/tbd
    kind/bug
    triage/untriaged
    on Sep 6, 2021
  2. Youssef1313 commented on Sep 6, 2021

    @Youssef1313
    MemberAuthor

    To avoids conflicts, this can wait until #6866 and #6868 are merged and (if this will target api-alignments*) master is merged into api-alignments branch.

    * Whether or not this should target api-alignments will likely depend on what setters are there incorrectly. If they are all unlikely to be used and are throwing setters, this may be able to target master.

  3. added
    area/code-generation
    project/core-tools 🛠️
    and removed
    triage/untriaged
    on Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/code-generationdifficulty/tbdkind/bugproject/core-tools 🛠️

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions