C
C#11mo ago
Argón

❔ Nonsense Ambiguous Reference

Hi there! I'm habing a problem which is a very odd ambiguous reference that points to the exact same field. Is this normal to happen sometimes in code or am I doing something wrong? If you need more information about the code let me know.
21 Replies
Argón
Argón11mo ago
I am trying to extend a class and fire an event, basically, but when I write its name that exception automatically apears and it confuses me a lot.
Anu6is
Anu6is11mo ago
Do you have a property and an event with the same name?
Argón
Argón11mo ago
Nope, the class only has the event and nothing more
Anu6is
Anu6is11mo ago
You can't use an event in a conditional statement like that
Argón
Argón11mo ago
But how do I check? It's used like that in the base class
Argón
Argón11mo ago
jcotton42
jcotton4211mo ago
@Wolf argon = new Wolf(); does this.LobbySlotValueChanged?.Invoke(this, 0); work?
Argón
Argón11mo ago
Can't verify that since I can't edit the base class directly, so that's why I am writing an extension method Unless I didn't understand what you meant
Anu6is
Anu6is11mo ago
This is different from what you have though
Argón
Argón11mo ago
Yes, because that is the base class I am attempting to write an extension method for I am writing an extension method because I do not have access to modifying that class But when I try to fire the event, I get an ambiguity which makes zero sense
ffmpeg -i me -f null -
are you sure beyond every doubt you don't have that member defined more than once? F12 goes directly to the member instead of enumerating it in reference window?
Argón
Argón11mo ago
It's not defined twice, I'm working with an external library. Plus, the only field that gives me that error is that one
Argón
Argón11mo ago
It's just defined once
ffmpeg -i me -f null -
the error is still there, though have you tried creating an empty project and referencing that field?
Argón
Argón11mo ago
Yes I just tried and it still happens I was wondering, maybe events can't be fired from outside the class But it wouldn't show an ambiguity error, right?
ffmpeg -i me -f null -
wtf how can this happen is there any weird reference? copy here what dotnet/csc is saying, it should point to both the assemblies that declare this member
SinFluxx
SinFluxx11mo ago
are you able to $paste any further code to get a clearer picture of what's going on? Is the base class private or can it be shared?
MODiX
MODiX11mo ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
SinFluxx
SinFluxx11mo ago
can you have your delegate and event with the same name?
ffmpeg -i me -f null -
if you mean delegate type yeah, usually it's not a problem
Accord
Accord11mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.