LinqPad5 keeps adding an import after every line of code I add.

After every line of code I add to a script, linqpad automatically adds 'Microsoft.ServiceBus.Messaging' to the 'Additional Namespace Imports.

When I try to run the c# program, i get the exception:

CS0234The type or namespace name 'ServiceBus' does not exist in the namespace 'Microsoft'.

I have to remove the import, and the code runs again.

MyExtensions did (in the past) used this namespace, but I removed the NuGet package, and all related code from MyExtensions. Also I reinstalled LinqPad, but this did not do the job.

Also manually removed the MyExtensions dll, pdb and xml files (leaving the .linq file).

How do I fix this?

Code:

After change:

Additional References:

Namespace Imports (after adding one like of code):

MyExtensions Additional References:

MyExtensions Imports:

Comments

  • When you create a new query, does the import appear in the namespace list?

    If so, remove it, and click "Set as default for new queries".

  • Denniz
    edited May 2021

    No. when creating a new query, the import is not there. After writing one line of code, it suddenly appears in the import.

    Created a new query:

    Added one line of code, executed it:

  • Open the "My Snippets" folder - you can determine its location by looking in Edit | Preferences > Folders.

    Are there any snippets there, and if so, can you you try deleting them or moving them elsewhere? (You'll need to restart LINQPad after doing this.)

  • Finally :smile: looking at the snippets i created:

    This explains alot :wink:
    Problem fixed...

    Thanks !!!