Comments (9)
coming in 2.0.30
from cauldron.
from cauldron.
This link could be of interest: https://github.com/tom-englert/AutoProperties.Fody/blob/master/BackingFieldAccess.md
from cauldron.
Thanks for the link... But I don't think this is the same issue... Getting the backing fields of Auto-Properties is very easy, because of their naming convention. But getting the backing field of "custom" properties is another thing... Constructs like the following (Which I have seen already) make it a lot harder:
private int languageIndex;
public string LanguageName { get{ return Language[languageIndex]; } }
public int? LanguageIndex
{
get { return languageIndex; }
set {
if(value == null || Language.Length < value)
return;
languageIndex = value;
}
}
The first property is something I wont be able to intercept at all, because I would have a hard time getting the backing field. I can surely just pass Language[languageIndex] to the interceptor. This requires a different logic than the current one though.
The second property is easier... I can get the backing field from the getter... I have only to make sure that it also exists and used in the setter. But there will be some stuff going on with Nullable in there, which does not make it easy to get the proper field.
That is only one example of all possibilities that can be done with getter and setter... I can implement some of the more standard ones... Like the following:
private string backingField;
public string Property
{
get{ return backingField; }
set{
if(backingField == value)
return;
backingField = value;
}
}
This case is actually easy to detect.
from cauldron.
Btw.. I did some testing... The last example works with the current implementation. I may add it in the next release.
from cauldron.
Great. Is support for constructor interception something you may be interested in?
FYI, I'm using your package to do native DLL version checks with attributes. https://github.com/mfkl/LibVLCSharp/blob/master/LibVlcSharp/LibVLC.cs
from cauldron.
from cauldron.
I will leave this open for a maybe better implementation of backing-field detection.
from cauldron.
Perhaps focus on property interception for computed properties (ie. no backing field)?
from cauldron.
Related Issues (20)
- Async Method Weaving: OnEnter() is called multiple times HOT 3
- Async Method Weaving: InvalidOperationException at runtime HOT 18
- [Cauldron.Interception.Fody]Assembly wide AttributeDecorator build error HOT 2
- [Cauldron.Interception.Fody] build error on Mac HOT 4
- IConstructorInterceptor causes assembly to fail verification (and won't run) HOT 7
- Forcing Inject to use ContratType on contracts that implements... HOT 2
- Documents "404 - File not found" for all links including !!! ???? HOT 1
- [Cauldron.Interception.Fody] Wrong version of Cauldron.Interception.Fody referenced HOT 3
- Factory does not work correctly in ASP NET CORE
- Cauldron.Interception reference not getting added to project. HOT 3
- Works compiling from VisualStudio, fails compiling through dotnet command HOT 3
- Reform & Re-throw Exception on OnException Method in IMethodInterceptor
- IPropertyInterceptor combine with IMethodInterceptorOnExit
- Why no nuget package for TimedCache ?
- Fody: Cauldron.Interceptors not found HOT 13
- Install-Package : External packages cannot depend on packages that target projects.
- Questions regarding Capgemini.Cauldron.Cryptography
- Debug breakpoint not working
- Cauldron.Interception.Fody 3.2.3 crashed when building a project
- Capgemini.Cauldron.Cryptography RAM Leak
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 cauldron.