Skip to content
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

Type Initializer throwing an error #45

Closed
SezMe opened this issue Dec 5, 2020 · 3 comments
Closed

Type Initializer throwing an error #45

SezMe opened this issue Dec 5, 2020 · 3 comments

Comments

@SezMe
Copy link

SezMe commented Dec 5, 2020

For a wpf Window called GeoElements with a grid column named C0, I have:

Trackr.Configure(Of GeoElements)().Property(Function(g) New With {Key g.C0.Width}).PersistOn(NameOf(GeoElements.Closing)).StopTrackingOn(NameOf(GeoElements.Closing))

This throws an error at run-time:

Inner Exception 1:
ArgumentException: Expression must project properties as an anonymous class e.g. f => new { f.Height, f.Width } or access a single property e.g. f => f.Text.
@anakic
Copy link
Owner

anakic commented Dec 9, 2020

It's due to VB.NET generating a different expression tree than C# for anonymous type projections. VB.NET wraps the expression tree in an additional cast expression which Jot was not expecting.

I've updated Jot to handle the expression trees that VB.NET generates and have pushed the updated code to GitHub and an updated NuGet package to nuget.org.

Let me know if the update solves it for you.

@anakic
Copy link
Owner

anakic commented Dec 14, 2020

Closing this as the latest commit resolves the problem. @SezMe please let me know if you still have issues with this.

@anakic anakic closed this as completed Dec 14, 2020
@SezMe
Copy link
Author

SezMe commented Dec 20, 2020

I still get an error, but it now raises a new one:

Inner Exception 1:
ArgumentException: Expression must be writeable
Parameter name: left

This is the code that throws the exception:

Trackr.Configure(Of Window)().Id(Function(w) w.Name, SystemInformation.VirtualScreen.Size).Property(Function(w) w.Top).Property(Function(w) w.Left).Property(Function(w) w.Height).Property(Function(w) w.Width).PersistOn(NameOf(Window.Closing)).StopTrackingOn(NameOf(Window.Closing))

I'm using 2.1.8 which NUGet says is the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants