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.

QoL - Microsoft.Bot namespace collides with Bot class name

See original GitHub issue

Because the root namespace is Microsoft.Bot and there is a class named Bot, there is no way to use the plain class name in code without either aliasing it or prefixing it with the Builder namespace. That means that a new user sitting down and writing the following code:

Bot myBot = new Bot(...);

Will immediately run into errors with intellisense finding the class and putting red squigglies under the class name, and the following compile time error:

Error	 CS0118 'Bot' is a namespace but is used like a type

Instead you are forced to use either explicit namespace scoping:

Builder.Bot myBot = new Builder.Bot(...);

Or you would have to alias the Bot class to a name that doesn’t collide like:

using BotIMean = Microsoft.Bot.Builder.Bot;
.
.
.

BotIMean myBot = new BotIMean(...);

This is going to be a problem for those who just sit down to use the SDK for the first time and also seems like a silly thing to have to constantly work around. Either the namespace could be renamed to something like Microsoft.Bots or the class could be renamed, but that seems less appropriate since that really is the “thing” that the noun represents.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cleemullinscommented, Feb 15, 2018

There’s also the Lisp Variant: (((((((((((((((((((((((((((b(((((((((((((((((((o(((((((((((((((((((((((((((t))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

1reaction
justinwilabycommented, Feb 15, 2018

we should consider using the name: class BotBuilderBotThatUsesMiddlewareAndPluginsToPostAndReceiveActivities {} In case there is ever an Objective-C port in the future. 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft.Bot.Builder Namespace
Represents a bot adapter that can connect a bot to a service endpoint. This class is abstract. BotAssert. Provides methods for debugging Bot...
Read more >
Microsoft.Bot.Builder.AI.QnA Namespace
Represents the Metadata object sent as part of QnA Maker requests. QnACardBuilder. Message activity card builder for QnAMaker dialogs. QnADialogResponseOptions.
Read more >
Microsoft.Bot.Builder.Teams Namespace
Explore all classes and interfaces of the Microsoft.Bot.Builder.Teams namespace. ... If the activity name is signin/tokenExchange, this middleware will ...
Read more >
Untitled
Didn t find class okhttp3 internal platform on path dexpathlist, Lufthansa boarding pass wallet, 465kb 14 may 2018 09 48, International partnership ...
Read more >
c# - Namespace + class naming collisions
This causes a naming collision, and when I attempt to instantiate a User object, it informs me that namespaces aren't classes.
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