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

[BUG] crash when resolve an object after async function in maui app #3144

Closed
ceasor opened this issue May 18, 2024 · 3 comments
Closed

[BUG] crash when resolve an object after async function in maui app #3144

ceasor opened this issue May 18, 2024 · 3 comments

Comments

@ceasor
Copy link

ceasor commented May 18, 2024

Description

It looks DryIoc.Container will crash when try to resolve object after async function.
s1

Steps to Reproduce

  1. debug the sample code MauiApp1. I attched the code:
    MauiApp1.zip

  2. Click button 'click me'
    s2

  3. will crash in code

Platform with bug

.NET MAUI

Affected platforms

Windows

Did you find any workaround?

try to avoid resolve object after an async function.

Relevant log output

No response

@dansiegel
Copy link
Member

This is an error in your own code. There's just a lot of mess here... and I'm not sure what you're trying to accomplish but I am betting that if you're passing around the DI container you need to re-evaluate your architecture. While this is indeed sometimes necessary it is much more the exception that you should be using the DI container directly. Remember that you can do things like inject Lazy<T> or Func<T> by default with Prism.

Bottom line though if you new up another instance of your Tool and then don't set the IContainerProvider you shouldn't be surprised when you get a NullReferenceException.

@ceasor
Copy link
Author

ceasor commented Jun 8, 2024

Thanks for comments. I think I didn't reproduce the original problem. Sorry for wasting your time.

1 similar comment
@ceasor
Copy link
Author

ceasor commented Jun 8, 2024

Thanks for comments. I think I didn't reproduce the original problem. Sorry for wasting your time.

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

No branches or pull requests

2 participants