vendredi 13 octobre 2017

Has the behavior of reflection method GetFields() changed?

I have an application that has the following line of code that's been there for quite some time and has been working without issue.

FieldInfo[] fields = GetType().GetFields( BindingFlags.Instance | BindingFlags.Public );    

Recently we had a bug pop up that I traced back to this line and found that for whatever reason this particular line wasn't returning anything from reflection. I updated the line to look like this and functionality was restored.

PropertyInfo[] fields = GetType().GetProperties( BindingFlags.Instance | BindingFlags.Public )

Has something changed in a security patch where the way this reflection behaves would have been altered? I also upgraded from 4.0 to 4.5 in this app and thought the issue was related to that. I rolled back to 4.0 and still had the issue which is why I'm wondering if a patch might be the root cause. I realize this is a very narrow question but I did some research and didn't come up with anything.





Aucun commentaire:

Enregistrer un commentaire