dahall / TaskScheduler

Provides a .NET wrapper for the Windows Task Scheduler. It aggregates the multiple versions, provides an editor and allows for localization.
MIT License
1.2k stars 191 forks source link

Using task scheduler with System.Runtime.InteropServices in .NET FRAMEWORK 4.5 #980

Closed Preethiravi196 closed 7 months ago

Preethiravi196 commented 7 months ago

Describe the bug I am using CallerMemberName and CallerLineNumber from System.Runtime.InteropServices to get the method name and line number for the purpose of logging. System.Runtime.InteropServices resolves from mscorlib. After including TaskScheduler, I am getting an error that CallerLineNumberAttribute type already exist since TaskScheduler have their own custom System.Runtime.InteropServices.

To Reproduce Steps to reproduce the behavior: -> Create a WPF project in visual studio 2019 with .NET framework 4.5 and then include task scheduler package. Use CallerMemberName from System.Runtime.CompilerServices.

-> On compilation you will get the below error,

Severity Code Description Project File Line Suppression State Error CS0433 The type 'CallerLineNumberAttribute' exists in both 'Microsoft.Win32.TaskScheduler, Version=2.10.1.0, Culture=neutral, PublicKeyToken=e25603a88b3aa7da' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Expected behavior I want to include task scheduler. Also I want to use CallerMemberName for logging purpose where it should resolve properly from System.Runtime.CompilerServices.

Environment (please complete the following information): OS - Windows 11 Pro Task Scheduler version - 2.10.1