Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

SqlClient: Avoid a delegate allocation on each call #7471

Merged
merged 1 commit into from
Apr 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/System.Data.SqlClient/src/System/Data/Locale/Locale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private static Tuple<string, int, Encoding> GetDetailsForLcid(int lcid)
{
throw ADP.ArgumentOutOfRange("lcid");
}
return s_cachedEncodings.GetOrAdd(lcid, GetDetailsInternal);
return s_cachedEncodings.GetOrAdd(lcid, id => GetDetailsInternal(id));
Copy link
Member

Choose a reason for hiding this comment

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

Put a comment here to nobody "fixes it". TBH, the compiler should just fix this bug. @stephentoub reported it like 2 years ago...

/cc @jaredpar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

A bug is when the compiler behaves counter to the design. The compiler is behaving as designed here so not a bug.

}

internal static Encoding GetEncodingForLcid(int lcid)
Expand Down