I have a MethodCallExpression
object from which I'm trying to return a IObservable<Thing>
instance using the Reactive Extensions
framework.
private IObservable<Thing> GetThing(Expression<Func<Thing>> expression)
{
Func<Thing> method = expression.Compile()
var observable = Observable.FromAsyncPattern<Thing>(method.BeginInvoke, method.EndInvoke);
IObservable<Thing> observable = observable();
return observable;
}
The issue is that when this executes I get the following runtime exception on observable()
:
Could not load file or assembly 'System.CoreEx, Version=1.0.2617.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Access is denied.
If I run the method without the Reactive framework everything is fine.
Thing item = method();
Any ideas what's causing this? All assembly references are added.
Edit I should add that the expression in question contains a method which executes on a Mocked object created using Moq.