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

RCS1242: Do not pass non-read-only struct by read-only reference #40692

Closed
elachlan opened this issue Aug 12, 2020 · 4 comments
Closed

RCS1242: Do not pass non-read-only struct by read-only reference #40692

elachlan opened this issue Aug 12, 2020 · 4 comments
Labels
area-System.Diagnostics.Tracing untriaged New issue has not been triaged by the area owner

Comments

@elachlan
Copy link
Contributor

Description

I installed Roslynator and it found many references of RCS1242: Do not pass non-read-only struct by read-only reference
https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1242.md

I was wondering if this is a legitimate issue:

// <SecurityKernel Critical="True" Ring="0">
// <UsesUnsafeCode Name="Parameter filterData of type: Void*" />
// <UsesUnsafeCode Name="Parameter callbackContext of type: Void*" />
// </SecurityKernel>
private unsafe void EtwEnableCallBack(
in System.Guid sourceId,
int controlCode,
byte setLevel,
long anyKeyword,
long allKeyword,
Interop.Advapi32.EVENT_FILTER_DESCRIPTOR* filterData,
void* callbackContext
)
{

unsafe EventProvider.WriteEventErrorCode IEventProvider.EventWriteTransfer(
long registrationHandle,
in EventDescriptor eventDescriptor,
IntPtr eventHandle,
Guid* activityId,
Guid* relatedActivityId,
int userDataCount,
EventProvider.EventData* userData)

@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Aug 12, 2020
@ghost
Copy link

ghost commented Aug 12, 2020

Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti
See info in area-owners.md if you want to be subscribed.

@jkotas
Copy link
Member

jkotas commented Aug 12, 2020

System.Guid is mostly read-only, but it is non-trivial to mark it as read-only.

#1718 and #1809 are related / duplicates.

I do not see legitimate issue here.

@danmoseley
Copy link
Member

Thanks for opening.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Diagnostics.Tracing untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

4 participants