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

Runtime error with system.text.json if a model includes action type for source generator #64871

Closed
musictopia2 opened this issue Feb 6, 2022 · 3 comments

Comments

@musictopia2
Copy link

Description

I discovered that if a model being used for source generation has a type of Action, that causes a runtime error with the source generator even if I mark the attribute ignore.
Action should never even be considered for serializing anyways.

Reproduction Steps

  1. Create Model
  2. Have a type of Action
  3. Inherit from JsonSerializerContext and mark attribute as JsonSerializable
  4. Build Solution.

Expected behavior

I expect the project to build successfully and not even see anything having to do with action in the source generator.

Actual behavior

The runtime error message was "Method name expected"
Also has lots of warnings.
If you want to see a screenshot of the warnings, I can do that as well.

Regression?

No response

Known Workarounds

Not use the source generator (which means it uses reflection).

Configuration

.net 6.

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Text.Json untriaged New issue has not been triaged by the area owner labels Feb 6, 2022
@ghost
Copy link

ghost commented Feb 6, 2022

Tagging subscribers to this area: @dotnet/area-system-text-json
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

I discovered that if a model being used for source generation has a type of Action, that causes a runtime error with the source generator even if I mark the attribute ignore.
Action should never even be considered for serializing anyways.

Reproduction Steps

  1. Create Model
  2. Have a type of Action
  3. Inherit from JsonSerializerContext and mark attribute as JsonSerializable
  4. Build Solution.

Expected behavior

I expect the project to build successfully and not even see anything having to do with action in the source generator.

Actual behavior

The runtime error message was "Method name expected"
Also has lots of warnings.
If you want to see a screenshot of the warnings, I can do that as well.

Regression?

No response

Known Workarounds

Not use the source generator (which means it uses reflection).

Configuration

.net 6.

Other information

No response

Author: musictopia2
Assignees: -
Labels:

area-System.Text.Json, untriaged

Milestone: -

@martincostello
Copy link
Member

Looks like a dupe of #62354.

@layomia
Copy link
Contributor

layomia commented Mar 2, 2022

Looks like a dupe of #62354.

Yup. Fixed for 6.0.2 in #63514.

@layomia layomia closed this as completed Mar 2, 2022
@layomia layomia removed the untriaged New issue has not been triaged by the area owner label Mar 2, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants