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.

Using `IgnoredCodeIssues` with legacy C# extension

See original GitHub issue

Environment

  • .NET CLI 1.0.0-preview1-002702
  • Mac OS X 10.11
  • VS Code version: 1.2.1
  • C# Extension version: Legacy C# (Unity development)

Issue

There’s this annoying issue with Unity development and VS Code where you get 99+ warnings instantly upon loading your project because of using System; at the top of virtually every Unity script.

screen shot 2016-07-04 at 4 04 21 pm

Attempted, but Failed Solution

I found this Omnisharp Roslyn Issue (closed) which addresses what I am attempting to do, so I tried adding a omnisharp.json file to my project root with:

{
    "IgnoredCodeIssues": [
        "^Unnecessary using directive.$"
    ]
}

This, as you may already suspect, borks everything and throws a similar error:

System.FormatException: Unsupported JSON token 'StartArray' was found.
Path 'IgnoredCodeIssues', line 2 position 27.

I‘ve described the problem and my failed solution, is there any hope?

tumblr_njmj4xfu2c1s6w6foo1_500

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:11
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jlmakescommented, Dec 7, 2016

Thanks for the response @DustinCampbell

Updated Environment

  • .NET CLI 1.0.0-preview2-1-003177
  • Mac OS X 10.11
  • VS Code version: 1.7.2
  • C# Extension version: 1.5.3

The upgrade in C# extension seems to successfully replace the legacy extension with regards to mono support and working with Unity. Also, the warnings have indeed been downgraded to infos, and instead of showing 99+ it now explicitly counts 180 on my particular project.

But every file is still haunted with this…

screen shot 2016-12-07 at 6 19 14 pm

Do you have any suggestions?

0reactions
DustinCampbellcommented, Feb 14, 2017

Yup. I totally agree that’s it’s pretty horrid. That’s why I’ll be taking a look at Remove Unnecessary Usings specific in 1.8.

Obsolete is probably not something I can help with – especially if it’s a generated project. I’d recommend touching base with Unity to add a <NoWarn> for obsolete warnings. Additionally, it might be worth adding a request for VS Code itself (e.g. https://github.com/Microsoft/vscode/issues) to allow turning off the display for info and warning in the Problems window.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Safely Extend your Legacy Code | by Daniel Rusnok
In this article, I want to present the techniques you can apply in the mentioned situations. Sprout method. When you are extending the...
Read more >
Quickly testing legacy code - Clare Macrae [C++ on Sea 2019]
You've inherited some legacy code: it's valuable, but it doesn't have tests, and it wasn't designed to be testable, so you need to...
Read more >
c# - How to disable the warning of Unnecessary Using of ...
i think issue has been addressed in latest version of omnisharp — because forced use legacy c# extension unity, solution remains unclear.
Read more >
Как отключить предупреждение о ненужном использовании ...
... использовать legacy-расширение C# для Unity, то решение остается неясным. ... 'auto' type specifier is a C++11 extension [-Wc++11-extensions] (14, ...
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