I have an issue while using reflection to get the value of a readonly static
field ViewDepartmentCompareReport
from a static class .
This code works fine in most of systems that I have tried including a few in production environments but get an error
An object reference error occurred
I have created a sample fiddle of this code here https://dotnetfiddle.net/aHCoLb
The error is thrown when casting of the value Value = (BitMask)val
takes place.
Please have a look at the code and point out if there is anything wrong that I am doing which could result in an object reference error when accessing the ViewDepartmentCompareReport
field via reflection.
Could this error be system specific say code being executed on a x86 system behaves differently than executing on x64 system?