Skip to content

Commit c92f2fa

Browse files
committed
fix: field _readerName cannot be auto property
1 parent cb9ba0f commit c92f2fa

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Yubico.Core/src/Yubico/PlatformInterop/Desktop/SCard/SCardReaderStates.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,30 @@ namespace Yubico.PlatformInterop
2323
{
2424
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
2525
// Justification: Fields are read/write via interop. Readonly might not have any effect there, but it may give
26-
// maintainers a false impression about the true nature of these fields.
26+
// maintainers a falls impression about the true nature of these fields.
2727
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
2828
[SuppressMessage("Style", "IDE0044:Add readonly modifier")]
2929
internal struct SCARD_READER_STATE
3030
{
31+
#pragma warning disable IDE0032 // Use auto property, leave as is for now, as it auto property may not work with interop
32+
[MarshalAs(UnmanagedType.LPStr)]
33+
private string _readerName;
34+
#pragma warning restore IDE0032 // Use auto property, leave as is for now, as it auto property may not work with interop
3135
private IntPtr _userData;
3236
private uint _currentState;
3337
private uint _eventState;
3438
private uint _atrLength;
35-
3639
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 36)]
3740
private byte[] _answerToReset;
3841

3942
private const uint SequenceMask = 0xFFFF_0000;
4043
private const uint StateMask = 0x0000_FFFF;
4144

42-
[field: MarshalAs(UnmanagedType.LPStr)]
43-
public string ReaderName { get; set; }
45+
public string ReaderName
46+
{
47+
get => _readerName;
48+
set => _readerName = value;
49+
}
4450

4551
public SCARD_STATE CurrentState => (SCARD_STATE)(_currentState & StateMask);
4652
public SCARD_STATE EventState => (SCARD_STATE)(_eventState & StateMask);

0 commit comments

Comments
 (0)