question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueFactory attempted to access the Value property of this instance

See original GitHub issue

.NET 5.0 | Prism.Wpf 8.0.0.1909

While overriding the CreateContainerExtension() method in App.xaml.cs, I get the following error ValueFactory attempted to access the Value property of this instance.

Code:

        protected override IContainerExtension CreateContainerExtension()
        {
            return ContainerLocator.Current;
        }

Trace:

System.InvalidOperationException
  HResult=0x80131509
  Message=ValueFactory attempted to access the Value property of this instance.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Prism.Ioc.ContainerLocator.get_Current()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)

  This exception was originally thrown at this call stack:
    [External Code]
    Fss.Searcher.App.CreateContainerExtension() in App.xaml.cs
    [External Code]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
SijyKijycommented, Jan 14, 2021

You should be calling PrismContainerExtension.Init()

image

Details:

System.InvalidOperationException
  HResult=0x80131509
  Message=ValueFactory attempted to access the Value property of this instance.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Prism.Ioc.ContainerLocator.get_Current()
   at Prism.DryIoc.PrismContainerExtension.Init(IContainer container)
   at Prism.DryIoc.PrismContainerExtension.Init(Rules rules)
   at Prism.DryIoc.PrismContainerExtension.Init()

  This exception was originally thrown at this call stack:
    [External Code]
    Fss.Searcher.App.CreateContainerExtension() in App.xaml.cs
3reactions
dansiegelcommented, Jan 11, 2021

You should be calling PrismContainerExtension.Init()

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - InvalidOperationException in my Lazy<> value factory
ValueFactory attempted to access the Value property of this instance. I don't see anything in my "value factory" method that accesses the Value ......
Read more >
ValueFactory attempted to access the Value property of this ...
Hi. Thank you for ASP.NET API Versioning. I get System.InvalidOperationException: ValueFactory attempted to access the Value property of ...
Read more >
ValueFactory attempted to access the Value property of this ...
I cannot run the project as the above error is shown. REQUIREMENT : I want to show dyanmic created values in PermissionManagement screen...
Read more >
Blazor TypeClient `AddHttpMessageHandler` emits ...
WebAssemblyRenderer[100] Unhandled exception rendering component: ValueFactory attempted to access the Value property of this instance.
Read more >
ValueFactory attempted to access the Value property of this
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found