Skip to content

Signature of methods with default CancellationToken are generated incorrectly with null default value #390

Open
@divega

Description

@divega

This was previously reported at dotnet/EntityFramework.ApiDocs#25, specifically for methods that contain cancelationToken = default, which is a really common pattern,but it could apply to other defaults, not sure.

From the original issue:

In https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.savechangesasync?view=efcore-2.1 it says signature for SaveChangesAsync is

    public virtual System.Threading.Tasks.Task<int> SaveChangesAsync (
        System.Threading.CancellationToken cancellationToken = null);

Obviously, if you try overriding SaveChangesAsync using the above example, it'll give you the following error:

Using default(CancellationToken) instead of null solves the issue:
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = default(CancellationToken))

In fact the original signature is:

    public virtual Task<int> SaveChangesAsync(
        CancellationToken cancellationToken = default)

cc @joelmartinez

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions