Botbuilder-samples: EchoBot file from Bots directory not accessible at startup page

Created on 17 Nov 2019  路  8Comments  路  Source: microsoft/BotBuilder-Samples

Sample information

  1. Sample type: echobot
  2. Sample language: dotnetcore or webapi
  3. Sample name: echobot1

Describe the bug

startup page can't able to access the bots directory files into method ConfigureServices for property AddTransient to get type. the error shows

  • Error CS0118 'EchoBot' is a namespace but is used like a type

Expected behavior

It expects to acquire all the properties of the referred directory and can be utilized in startup page.

Screenshots

screenshots to help explain the problem.

Screenshot (94)

[bug]

Bot Services customer-replied-to customer-reported

Most helpful comment

Ah! Thank you @johnkellyjr

Sorry I missed that earlier. Good find, that is absolutely the cause (I didn't test thoroughly enough before). @ashutoshpith As John said; just rename either your namespace or your class.

All 8 comments

Hi @ashutoshpith My apologies, I'm a little confused on what you are trying to do here. Are you _trying_ to use a discard? If you remove the _ = from line 35 does it work?

with and without discard it's not going work. The main issue here is that the EchoBot class which is in directory Bots cannot be able to read even after the importing via 'using' .
This issue appears in 1 out of 3 times on new project creation . startup class can't able to access the other dir, in this case, the Bots/EchoBot.cs class even after it belongs in same namespace.

@EricDahlvang @cleemullins @johnataylor @stevengum Any ideas here? I am not able to reproduce.

I'm working on it.I'll get back to you when it's done.

Hi @ashutoshpith Just curious; can you still reproduce this?

Closing this as doesn't seem to be an issue that we can reproduce. If you are still exhibiting this issue, and need assistance, please reopen.

I was able to repro this. When you are prompted for a project name while creating an EchoBot, it will give you EchoBot1 as the default name. I changed this to EchoBot and received the same error. The error is correct, as it has now used EchoBot as both the namespace for the project as well as the class name within Bots\EchoBot.cs... public class EchoBot : ActivityHandler.

Creating a new project and modifying the name to something other than EchoBot resolved it for me. I hope this helps someone else, and if I am off base with my conclusion, please provide me with an explanation so I'm not muddying the waters.

Ah! Thank you @johnkellyjr

Sorry I missed that earlier. Good find, that is absolutely the cause (I didn't test thoroughly enough before). @ashutoshpith As John said; just rename either your namespace or your class.

Was this page helpful?
0 / 5 - 0 ratings