public static RxSpySession Launch(IRxSpyEventHandler eventHandler, bool explicitCapture = false) { var session = new RxSpySession(eventHandler, explicitCapture); Current = session; if (Interlocked.CompareExchange(ref _launched, 1, 0) != 0) { throw new InvalidOperationException("Session already created"); } InstallInterceptingQueryLanguage(session); return(session); }
static void InstallInterceptingQueryLanguage(RxSpySession session) { // TODO: Verify that the version is supported var rxLinqAssembly = Assembly.Load(new AssemblyName("System.Reactive.Linq")); // Make sure it's initialized Observable.Empty <Unit>(); var observableType = typeof(Observable); var defaultImplementationField = observableType.GetField("s_impl", BindingFlags.Static | BindingFlags.NonPublic); var actualImplementation = defaultImplementationField.GetValue(null); object proxy = new QueryLanguageProxy(session, actualImplementation) .GetTransparentProxy(); defaultImplementationField.SetValue(null, proxy); }
public static RxSpySession Launch(IRxSpyEventHandler eventHandler, bool explicitCapture = false) { var session = new RxSpySession(eventHandler, explicitCapture); Current = session; if (Interlocked.CompareExchange(ref _launched, 1, 0) != 0) throw new InvalidOperationException("Session already created"); InstallInterceptingQueryLanguage(session); return session; }
static void InstallInterceptingQueryLanguage(RxSpySession session) { // TODO: Verify that the version is supported var rxLinqAssembly = Assembly.Load(new AssemblyName("System.Reactive.Linq")); // Make sure it's initialized Observable.Empty<Unit>(); var observableType = typeof(Observable); var defaultImplementationField = observableType.GetField("s_impl", BindingFlags.Static | BindingFlags.NonPublic); var actualImplementation = defaultImplementationField.GetValue(null); object proxy = new QueryLanguageProxy(session, actualImplementation) .GetTransparentProxy(); defaultImplementationField.SetValue(null, proxy); }