-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static method requires null instance, non-static method requires non-null instance. #542
Comments
Hello @GF-Huang, thanks for using EmbedIO! While this could be a bug in Can you post the exception's stack trace? It will probably help determine the exact cause of the issue. |
BTW, does |
Hello @GF-Huang, sorry for the late answer. EmbedIO does no model validation as of now. It will probably be easier to add it in version 4, because the deserialization APIs will be more open. For more details, keep an eye on #546. As for the original issue, I think it may have to do with the actual value of |
I'm not sure, but this depends on |
@GF-Huang thanks for the link. I've had a look at both the docs and StyletIoC's source code. If I understand correctly, you register How it generates the factory function is the interesting part IMHO: it uses types in the There are actually no "functions" in .NET, only methods. A method, as you know, may be static or non-static; a non-static method requires a "this" reference at runtime. Every method has some associated metadata, among which there's an "IsStatic" flag that tells whether the method needs a "this" reference (IsStatic = 0) or not (ISStatic = 1). When you generate methods using When In other words, this is most probably a bug in Stylet. The delegate usually works because, despite it being non-static, never references "this" in code. Your workaround (enclosing a call to the delegate in a lambda, Closing this issue since it doesn't seem to be a bug in EmbedIO after all. Feel free to reopen if further examination proves me wrong (which is totally possible, as I'm no expert when it comes to IL code and |
Got it, and thanks your detailed analysis. 🌹 |
I use Stylet as MVVM framework, it contains a IoC component for DI.
Screenshots
This work:
This not work:
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: