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

Nested Interface will always be a proxy - even when nullable #162

Open
tekook opened this issue Jun 4, 2024 · 0 comments
Open

Nested Interface will always be a proxy - even when nullable #162

tekook opened this issue Jun 4, 2024 · 0 comments

Comments

@tekook
Copy link

tekook commented Jun 4, 2024

So I have a simple interface which I'm parsing from json.
The json file contains optional nested interfaces.
I just noticed that all nested interfaces are always replaced with the Castle Proxy.
Even when the Interface is nullable and even when the default value is set to null.
It even ignores the json value "null" and creates a proxie.

Is there anyway to receive null on a missing nested interface?

Simple example:

public interface ISubSettings {
    string SubTest {get;}
}
public interface ISettings
{
    string Text {get;}
    ISubSettings? Test { get; }
}

Corresponding Json:

{
  "Text": null,
  "Test": null
}

This resolves in iSettings.Text being null, but iSettings.Test will an instance Castle.Proxy.ISubSettingsProxy instead of null.

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

1 participant