I am having these errors in VSCode -> GNU/Linux:
For this behavior I have read this,
How to fix "namespace x already contains a definition for x" error? Happened after converting to VS2010
but I can not find the solution, that works for me.
The call is ambiguous between the following methods or properties: 'GCoreT.mapTex(string, E[])' and 'GCoreT.mapTex(string, E[])' [testc]
Type 'GCoreT' already defines a member called 'mapTex' with the same parameter types [testc] void GCoreT.mapTex(string text, E[] add)
.
I think this is the most relevant simplified code.
using System;
namespace testc
{
class Program
{
static void Main(string[] args)
{
//..
}
}
}
using System;
class GCoreT{
^^^------------------> he says 0
public Ene[] GTEne (String tex, E[] ene){
//..
mapTex(tex, ene);
^^^------------------> he says 1
//..
}
private void mapTex(String text, E[] add){
^^^------------------------------> he says 2
//..
}
}
VSCode says:
0
The namespace '' already contains a definition for 'GCoreT' [testc]
1
The call is ambiguous between the following methods or properties: 'GCoreT.mapTex(string, E[])' and 'GCoreT.mapTex(string, E[])' [testc]
2
Type 'GCoreT' already defines a member called 'mapTex' with the same parameter types [testc] void GCoreT.mapTex(string text, E[] add)
Clicking on the Code Action lightbulb or using the Quick Fix command Ctrl+. will display Quick Fixes and refactorings. If you'd just like to see refactorings without Quick Fixes, you can use the Refactor command (Ctrl+Shift+R).
The easiest way to reset VS Code back to the default settings is to clear your user settings.json file. You can open the settings.json file with the Preferences: Open Settings (JSON) command in the Command Palette (Ctrl+Shift+P).
The workspace settings file is located under the . vscode folder in your project.
Restarting Omnisharp worked for me. Press CTRL + SHIFT + P, then select 'Restart Omnisharp' from the list
Have you tried restarting VSCode? Could be worth a try. I have faced a similar issue and the problem seemed to magically disappear when I restarted VSCode. Seems like a bug in VSCode that when you rename namespace in certain cases it clings on to the old namespace name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With