-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Use DllImportGenerator in System.Diagnostics.PerformanceCounter #61389
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,7 @@ internal static partial class Interop | |
| { | ||
| internal static partial class Advapi32 | ||
| { | ||
| [DllImport(Interop.Libraries.Advapi32, EntryPoint = "GetSecurityDescriptorLength", CallingConvention = CallingConvention.Winapi, | ||
| CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
| internal static extern /*DWORD*/ uint GetSecurityDescriptorLength(IntPtr byteArray); | ||
| [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "GetSecurityDescriptorLength", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we are just removing CallingConvention = CallingConvention.Winapi from everywhere as it's default and archaic. |
||
| internal static partial uint GetSecurityDescriptorLength(IntPtr byteArray); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,8 +13,8 @@ internal static partial class Interop | |
| { | ||
| internal static partial class Advapi32 | ||
| { | ||
| [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegEnumValueW", ExactSpelling = true)] | ||
| internal static extern int RegEnumValue( | ||
| [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegEnumValueW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we assuming BestFitMapping = true is fine in these?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, these are all using
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like there are several variations of DllImport/GeneratedDllImport properties that are not meaningful or invalid but just ignored. I wonder whether it would make sense for the generator to flag/reject those so the ycan be cleaned up during conversion? I guess it is a minor thing.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Certainly something we should keep in mind. We've been trying to remove support for sometimes-non-meaningful things (like |
||
| internal static partial int RegEnumValue( | ||
| SafeRegistryHandle hKey, | ||
| int dwIndex, | ||
| char[] lpValueName, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,10 @@ | |
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks> | ||
| <NoWarn>$(NoWarn);CA1838;CA1847</NoWarn> | ||
| <!-- Suppressions to avoid ifdefs: | ||
| CA1845: Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' | ||
| CA1846: Prefer 'AsSpan' over 'Substring' when span-based overloads are available --> | ||
| <NoWarn>$(NoWarn);CA1845;CA1846</NoWarn> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's causing these analyzers to fire now and they didn't before?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reference to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see; then the analyzer sees that these APIs exist and the analyzers start running. Ok, thanks. |
||
| <IsPackable>true</IsPackable> | ||
| <PackageDescription>Provides the System.Diagnostics.EventLog class, which allows the applications to use the windows event log service. | ||
|
|
||
|
|
@@ -125,8 +129,10 @@ System.Diagnostics.EventLog</PackageDescription> | |
| <Reference Include="System.Diagnostics.Tools" /> | ||
| <Reference Include="System.Diagnostics.TraceSource" /> | ||
| <Reference Include="System.IO.FileSystem" /> | ||
| <Reference Include="System.Memory" /> | ||
| <Reference Include="System.Runtime" /> | ||
| <Reference Include="System.Runtime.Extensions" /> | ||
| <Reference Include="System.Runtime.CompilerServices.Unsafe" /> | ||
| <Reference Include="System.Runtime.InteropServices" /> | ||
| <Reference Include="System.Resources.ResourceManager" /> | ||
| <Reference Include="System.Security.Principal.Windows" /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bah! Sorry @jkoritzinsky looks like I did miss that case <shame />