Problem using Func<T, TResult> when adding Reference to JetBrains.Platform.ReSharper.Util.dll

Hi,

I'm trying to setup an expectation on a ICSharpContextActionDataProvider mock, using Moq and a Func-Delegate.

var classDeclarationMock = new Mock<IClassDeclaration>();
var contextActionDataProviderMock = new Mock<ICSharpContextActionDataProvider>();


contextActionDataProviderMock
  .Setup(x => x.GetSelectedElement<IClassDeclaration>(false, true))
  .Returns(classDeclarationMock.Object);


The problem is, that in order to use IClassDeclaration, I need to add a reference to JetBrains.Platform.ReSharper.Util.dll.

Once I do that, Moq or in fact any code that is using one of the delegates defined in the System namespace in mscorlib, suffer from an ambigous reference problem. So it's not Moq related, just when I came across the problem.

Reflector told me, that the delegates are also defined in a System namespace within JetBrains.Platform.ReSharper.Util.dll.

So my question is, can I somehow overcome this problem? There is probably a good reason why these delegates have been defined in there too.

Thx in advance! :)

2 comments

Solved it by using an external alias for JetBrains.Platform.ReSharper.Util.dll. Guess I should have searched stackoverflow more thoroughly. ;)

0

Maik Roempagel wrote:

Reflector told me, that the delegates are also defined in a System namespace within JetBrains.Platform.ReSharper.Util.dll.


In ReSharper 6 we have renamed conflicting names of our types.

0

Please sign in to leave a comment.