Reputation: 60892
Why am I getting this exception, even though I only have 1 OnUnzipHttpTriggered
defined?
I did a global search:
And it showed that indeed I had only 1 one of these classes defined:
What I have tried:
Why am I getting this exception?
Here's my VS info:
Upvotes: 1
Views: 7686
Reputation: 1147
Deleting and re-creating the file seemed to fix this for me. Renaming it and reversing the rename also seems to work. Looks like a bug.
Upvotes: 1
Reputation: 61
Reload the visual studio code window by Ctrl+shift+P and then search for Reload window. This worked for me.
Upvotes: 6
Reputation: 15619
Have a look at the first result in your search. It states pretty clearly that DestinationFileNamer.cs
has the namespace AlidadeUtilities.OnUnzipHttpTriggered.Extensions
. That's where the problem is, because both the class and (part of) the namespace of that file are AlidadeUtilities.OnUnzipHttpTriggered
.
A class cannot have the same name as a namespace in the same namespace as where the class is.
By the way, just a tip: anything starting with On sounds a LOT like an event handler. Please reconsider the name.
EDIT:
The full name of the class you're creating is this:
AlidadeUtilities.OnUnzipHttpTriggered
The namespace of the class DestinationFileNamer
is this:
AlidadeUtilities.OnUnzipHttpTriggered.Extensions
Your problem is the fact that those two bold parts are the same.
Solution:
The solution would be to either rename the class OnUnzipHttpTriggered
or rename the namespace AlidadeUtilities.OnUnzipHttpTriggered**.Extensions
.
Upvotes: 3
Reputation: 2669
Some other ways to find the problem:
You also may have a compiled dll (added reference) with an extension method of the same name. In that case you will have to call your class something else.
Upvotes: 1