-
Notifications
You must be signed in to change notification settings - Fork 934
TypeLoadException when generating proxies for custom collection types #1881
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
Comments
Related discussion on the development group: Discussion triggered from here. For me, this introduces bugs in the NHibernate proxy factory. @hazzik wrote:
I do not contest it matches what C# compiler generates for explicit interface members. I contest the member should be implemented as an explicit interface member. Doing so may cause a base implicit interface member to be not proxified, defeating the proxy purpose.
Why not if the patch was restricted to I have put "may" in my sentences because what will generate the proxy factory with the change will maybe be indeed something like: public interface IA
{
string SomeProperty { get; set; }
}
public class A : IA
{
public virtual string SomeProperty { get; set; } = "non-initialized";
}
public class FakeAProxy : A, IA
{
public override string SomeProperty
{
get => ActualState.SomeProperty;
set => ActualState.SomeProperty = value;
}
string IA.SomeProperty
{
get => ActualState.SomeProperty;
set => ActualState.SomeProperty = value;
}
internal A ActualState { get; set;} = new A { SomeProperty = "initialized" };
} This is because the proxy factory generates methods for all members of ancestors, classes and interfaces, without de-duplicating those present as both a class member and an interface member. (This does not create issues with current code because a special method for declaring members is (ab)used: In such case, the proposed change will not fix anything indeed: invalid code in the Enver's case will still be generated. |
…ating proxies Fix a broken test
…ating proxies Rmove some undue changes
…ating proxies Simplify broken test fix
Closing because of following:
|
Ran into this when trying to get our Envers integration updated.
The text was updated successfully, but these errors were encountered: