question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CS0612 propagating obsolete methods

See original GitHub issue

dotnet-format’s fix for CS0612 is propagating the Obsolete attributes, making all my methods that uses an Obsolete method also Obsolete. I wasn’t able to find any documentation on fixes for CS0612 and what would be the expected behavior in this situation.

Is this expected? If so, where can I find info on this fix?

image

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
GalaxiaGuycommented, Oct 4, 2021

I think there needs to be some way to control the behavior of the formatter for this.

In my case I definitely want the warnings produced by CS0618, but marking members of my code that use Obsolete code as also Obsolete is incorrect (it’s not obsolete, but does need need updating to use non-obsolete code, hence why I still need CS0618 enabled).

1reaction
DosangGucommented, Jun 27, 2023

exclude-diagnostics option was enough for me

dotnet format --exclude-diagnostics CS0612 CS0618

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve build warning for obsolete methods ...
Description: While working with the projects, sometimes we have some deprecated methods called in our code and when we build.
Read more >
Compiler Warning (level 1) CS0612
The class designer marked a member with the Obsolete attribute. This means that the member might not be supported in a future version...
Read more >
CS0612 warning about obsolete member not suppressed ...
CS0612 warning about obsolete member not suppressed when it is referenced by a ObsoleteAttribute placed on a method #23015.
Read more >
Why does Visual Studio not consider Obsolete("message") ...
When the ObsoleteAttribute is being applied without a message, it results in a CS0612 warning, which is level 1 .
Read more >
Code Inspections in C# | ReSharper Documentation
This category groups code inspections with minor severity levels. Inspection. ID · EditorConfig property · Default severity · Method invocation ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found