Reactive: System.ArgumentException聽: Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.

Created on 17 Nov 2017  路  5Comments  路  Source: dotnet/reactive

I got this exception when subscribing to an observable : Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.

Here is the sample code :

var dataGridCopy = Observable.Merge(dataGridKeyDown, dataGridKeyUp)
    .Buffer(2, 1)
    .Where(x => !x[0].EventArgs.KeyStatus.IsKeyReleased && !x[1].EventArgs.KeyStatus.IsKeyReleased)
    .Where(x => x[0].EventArgs.VirtualKey == VirtualKey.Control && x[1].EventArgs.VirtualKey == VirtualKey.C);

dataGridCopy.Subscribe(_ =>
    {
        // TODO
    });

I am working on a UWP application under Windows 10 Fall Creators Update with the package System.Reactive 3.1.1.

question [area] Rx

All 5 comments

@Odonno are you able to provide a more complete example? It's not clear where dataGridKeyDown and dataGridKeyUp are coming from, and this is a common error on StackOverflow around creating certain kinds of delegates

Of course. Hope it helps.

ReproBug447.zip

What was the solution for this? I'm having this issue as well.

@chrisevans9629 Well, rxjs with electron was the final solution. :)

But seriously, still don't know why..

For me, this happened when using Observable.FromEvent<>(); in Rx.NET
However, it worked fine after I switched to Observable.FromEventPattern<>():

Don't know why, but it did the trick!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fubar-coder picture fubar-coder  路  6Comments

MartinEgli picture MartinEgli  路  5Comments

jeremyVignelles picture jeremyVignelles  路  5Comments

Mike-E-angelo picture Mike-E-angelo  路  5Comments

jtbrower picture jtbrower  路  7Comments