Comments (5)
We changed the implementation/behavior of IOptionsSnapshot entirely in 2.0, we basically repurposed the type name as its still meant to be used to capture the state of an options instance for the lifetime of a request, instead of having a lifetime timed to the IOptionsMonitor
I can help you migrate to 2.0 if you get stuck, IOptionsMonitor is still mostly the same in 2.0. Were you using snapshot for getting updating/reloading options?
from options.
Hey @HaoK - I'm quite well aware that the IOptionsSnapshot has changed, but in the process of changing, did the backwards compatibility break? Essentially, my old class libraries that I have just don't work with NetCore 2.0 apps. Let's say that I need my class libraries to remain as < 2.0 NetStandard apps.
Yes, originally, I was using snapshot for reloading options on the fly. Is that not what it does anymore? In the case, the documentation is a bit out of date and should reference that. Does this also mean that my old class library that has all of this functionality can only work with older versions of .net core, and not with newer ones?
I've come up with a number of fixes, and I got it working, but the fixes are hacky, and force me to use dynamic
everywhere so I can try calling .Value
, and if that throws I can try calling .Get(string.Empty)
, even though I'm in a NetStandard1.3 app that doesn't have that function. It's one way I've found of solving this problem. However, I'm just trying to report that something goes horribly wrong here.
Additionally, it only happens if the options are requested by a Service. If I just request the options themselves, not much is happening, but if I request a service, and in its constructor requests the POCO object I showed above, I consistently get this error about MissingMethodException
from options.
@Aurel yes, the 2.0 IOptionsSnapshot type is not backwards compatible with 1.0 at all
from options.
Interesting - I've found a fix locally that uses a bunch of dynamics so I don't have to know about the type I'm invoking, but can you explain to me then, why this might be happening? I don't understand why the get_Value()
method would be missing, when it's clearly there both in 1.1.2 and in 2.0.0! (In 2.0.0 it's inherited from IOption<T>
)
from options.
This issue was moved to dotnet/aspnetcore#2387
from options.
Related Issues (20)
- [Annoucement][Draft] IOptionsSnapshot is now a scoped service HOT 2
- Overload Configure with access to IServiceProvider HOT 3
- Inconsistent use of null vs DefaultName HOT 1
- Extension methods for more concise registration of IConfigureOptions/IPostConfigureOptions HOT 1
- Semi-Automatic options configuration improvements HOT 7
- IConfigureOptions isn't called for authentication (named) options HOT 7
- [Question] Get Options immediately after Configure HOT 5
- Add built in support for validating options HOT 4
- See if we can make it easier to implement IConfigureNamedOptions HOT 2
- 1st class support for Request options HOT 4
- Add Configure<TOptions, TService1...5>(Action<TOptions>, TService1...5) overloads HOT 1
- OptionsBuilder to chain configuration calls HOT 7
- Allow collections to be replaced, when defined in IConfiguration HOT 1
- DI exception is not raised when IOptions<Poco> is not configured. HOT 2
- Call AddOptions() from Configure/AddOptions HOT 1
- IOptionsSnapshot not working in docker container using bind mount HOT 2
- Make IConfigureNamedOptions.Configure async HOT 1
- IOptionsSnapshot is not working with singleton services HOT 1
- THIS ISSUE TRACKER IS CLOSED - use the Home repo issue tracker HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from options.