Can't use Moq in Linqpad 6

In Linqpad 5.40.00 using the Nuget Moq 4.10.0 the following code works fine:

var mock = new Mock();

IFoo test = mock.Object;

In the 6.0.18 beta using the same Moq version I get a NotSupportedException with message "A non-collectible assembly may not reference a collectible assembly.".

Any ideas on what's going on? These are the first three lines of Main() and it blows up in mock.Object.

Zipped linq file attached.


  • This should be fixed in 6.0.19. It will now give you a message telling you what to do.
  • You are incredibly on top of things and timely! Thanks for the info!
  • I assume you're aware of this, but it's still happening in 6.0.20. I mention this not to nag but just FYI.
  • Do you get the same error message? It should now say:

    NotSupportedException: A non-collectible assembly may not reference a collectible assembly.

    Tip: You can make the query's load-context non-collectible by checking the option in Query Properties | Advanced (press F4)
  • Ah - of course. You told me that this was what to expect but I forgot and jumped the gun. Yes - it does tell me that and doing that fixes the problem. Thanks again! Such a great product and fabulous support!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!