Avoid unnecessary SetLastError on PInvokes by jkotas · Pull Request #36544 · dotnet/corefx (original) (raw)

This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation3 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

jkotas

These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError
will save us from generating marshalling stub for them.

@jkotas

These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError will save us from generating marshalling stub for them.

jkotas

internal partial class Interop
{
internal partial class Kernel32

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also deduplicated the file with CoreLib.

danmoseley

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary because they don't set last error? Or because we never test it?

As a general rule, when should we not add SetLastError =true ?

@JeremyKuhne

@jkotas

We never test it.

when should we not add SetLastError =true

We should be adding SetLastError only when it is needed - the API sets it and the calling code tests it.

stephentoub

JeremyKuhne

Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corert that referenced this pull request

Apr 2, 2019

@jkotas @dotnet-bot

These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError will save us from generating marshalling stub for them.

Signed-off-by: dotnet-bot dotnet-bot@microsoft.com

Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/mono that referenced this pull request

Apr 2, 2019

@jkotas @dotnet-bot

These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError will save us from generating marshalling stub for them.

Signed-off-by: dotnet-bot dotnet-bot@microsoft.com

Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/coreclr that referenced this pull request

Apr 2, 2019

@jkotas @dotnet-bot

These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError will save us from generating marshalling stub for them.

Signed-off-by: dotnet-bot dotnet-bot@microsoft.com

jkotas added a commit to Dotnet-GitSync-Bot/coreclr that referenced this pull request

Apr 2, 2019

@jkotas

These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError will save us from generating marshalling stub for them.

Signed-off-by: dotnet-bot dotnet-bot@microsoft.com

jkotas added a commit to dotnet/corert that referenced this pull request

Apr 2, 2019

@jkotas

These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError will save us from generating marshalling stub for them.

Signed-off-by: dotnet-bot dotnet-bot@microsoft.com

jkotas added a commit to dotnet/coreclr that referenced this pull request

Apr 3, 2019

@jkotas

These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError will save us from generating marshalling stub for them.

Signed-off-by: dotnet-bot dotnet-bot@microsoft.com

marek-safar pushed a commit to mono/mono that referenced this pull request

Apr 3, 2019

@jkotas @marek-safar

These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError will save us from generating marshalling stub for them.

Signed-off-by: dotnet-bot dotnet-bot@microsoft.com

picenka21 pushed a commit to picenka21/runtime that referenced this pull request

Feb 18, 2022

@jkotas

These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError will save us from generating marshalling stub for them.

Commit migrated from dotnet/corefx@ccb68c0