Skip to content

removed ReadOnly field in TransactionAttribute - #9490

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
scalalang2:remove-readonly-field
May 12, 2025
Merged

ReubenBond merged 1 commit into
dotnet:mainfrom
scalalang2:remove-readonly-field

Conversation

@scalalang2

@scalalang2 scalalang2 commented May 12, 2025 •

Copy link
Copy Markdown
Contributor

Background

Many software engineers uses LLMs(e.g. chatgpt) as learning resources instead of the official documentation.
But as shown in the image below. It is often hallucinated and generates inaccurate information, which may misleads users.

Therefore, I suggest that it would be better to delete an unused field ReadOnly.

image

Microsoft Reviewers: Open in CodeFlow

@ReubenBond

Copy link
Copy Markdown
Member

Thanks, @scalalang2. This functionality is achieved via the [ReadOnly] attribute instead.

@ReubenBond

Copy link
Copy Markdown
Member

Ideally, we should keep this property and mark it [Obsolete(...)] instead, with a message pointing people to [ReadOnly]

@scalalang2

Copy link
Copy Markdown
Contributor Author

@ReubenBond

Does attaching the [ReadOnly] attribute ensure that the PerformUpdate() function cannot be called within a transaction context?

@scalalang2

scalalang2 commented May 12, 2025 •

Copy link
Copy Markdown
Contributor Author

Ideally, we should keep this property and mark it [Obsolete(...)] instead, with a message pointing people to [ReadOnly]

I'll update the code as you described.

@scalalang2
scalalang2 force-pushed the remove-readonly-field branch from 9480019 to 70066af Compare May 12, 2025 06:11
@ReubenBond

Copy link
Copy Markdown
Member

Does attaching the [ReadOnly] attribute ensure that the PerformUpdate() function cannot be called within a transaction context?

There is logic for that, but I am looking at it now and I see that 'readOnly' is not being flowed through into the TransactionInfo constructor here:

return Task.FromResult<TransactionInfo>(new TransactionInfo(guid, ts, ts));
. The readOnly parameter on the constructor should not be optional...

@scalalang2

Copy link
Copy Markdown
Contributor Author

There is logic for that, but I am looking at it now and I see that 'readOnly' is not being flowed through into the TransactionInfo constructor here:

Thanks for the reply. I'll share the comment with my co-workers.
I'll try to fix the problem in a seperate PR.

@ReubenBond
ReubenBond merged commit 518881f into dotnet:main May 12, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants