Comments (5)
ccc0934 でおそらく治ったと思いますが、Nugetなどバージョンを上げていないので手動でアセンブリ置換などをお願いできましょうでしょうか?
from livet.
ありがとうございます(サンプルコード動かしたやつコピペしたつもりだったんですが何故か動かないやつで申し訳ないです)。
確認しましたところ、 ccc0934 の修正ではメソッドに定義された引数の型が interface の場合に対応できないようです。
if ((!parameters[0].ParameterType.IsAssignableFrom(_argumentType))) return false;
であれば大丈夫そうであることは確認しましたが、いかがでしょうか?
from livet.
今度こそこれで治ったかと・・ ad6b43f
if (parameters[0].ParameterType.IsInterface)
{
if (!newArgumentType.GetInterfaces().Contains(parameters[0].ParameterType)) return false;
}
else
{
if ((!_argumentType.IsSubclassOf(parameters[0].ParameterType)) && (_argumentType != parameters[0].ParameterType)) return false;
}
にて今まで起きてた問題全部解決したかと思います。
また、いただいたコードの修正版
class Program
{
static void Main(string[] args)
{
TestNormal();
TestBinder();
}
private static void TestNormal()
{
// MethodBinderWithArgument を使わない通常の呼び出し
Super calleeArg = null;
var test = new Test(x => calleeArg = x);
var callerArg = new Sub();
test.TestMethod(callerArg);
Console.WriteLine(callerArg == calleeArg); // True
test.TestMethod2(new Other());
}
private static void TestBinder()
{
// MethodBinderWithArgument を使った呼び出し
Super calleeArg = null;
var test = new Test(x => calleeArg = x);
var binder = new MethodBinderWithArgument();
var callerArg = new Sub();
binder.Invoke(test, "TestMethod", callerArg); // ArgumentException となる
Console.WriteLine(callerArg == calleeArg);
binder.Invoke(test,"TestMethod2",new Other());
}
}
interface TestInterface
{
}
class Test
{
private readonly Action<Super> action;
public Test(Action<Super> action)
{
this.action = action;
}
public void TestMethod(Super arg) => this.action?.Invoke(arg);
public void TestMethod2(TestInterface t) => this.action?.Invoke(null);
}
class Super { }
class Sub : Super { }
class Other : TestInterface { }
にて動作確認いたしました><
from livet.
確認しました。
これで問題ないように思います。
修正ありがとうございました。
from livet.
ありがとうございました!
from livet.
Related Issues (20)
- nugetで2.1.0をインストールするときのエラー HOT 9
- 新しい Behavior ライブラリへの更新 HOT 7
- don't have English version readme HOT 2
- DispatcherCollection.Dispatcherはnull許容ですか? HOT 1
- README.mdの画像リンク切れ HOT 3
- Nuget ライブラリの更新 HOT 2
- DataGridHyperlinkColumnのEventTrigger HOT 4
- ViewModelA->ViewModelBのメッセージ通知 HOT 9
- Latest version Livet throws error on WPF. HOT 3
- .NET Framework のプロジェクトテンプレートが空のプロジェクトを生成する
- VisualStudio2019にて新規プロジェクトでLivetテンプレートを使用するとClickOnce発行ができません。 HOT 4
- CursorTypeAndBooleanConverter is not working HOT 4
- GitHub Actions 上での単体テストが常に失敗する
- FolderSelectionMessage cause FileNotFoundException in ver 3.2.3. HOT 4
- FolderSelectionMessageでの複数選択 HOT 3
- Working for .NET 6 and Visual Studio 2022
- FolderSelectionMessage cause InvalidOperationException in ver 3.2.3.2 HOT 4
- .NET 6 で FolderBrowserDialog を開こうとするとエラー HOT 3
- FolderSelectionMessage.Response の型 HOT 2
- 本家DataTriggerが初期値に対応しました
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from livet.