private void ReadResources() { BinaryFormatter formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.Persistence | StreamingContextStates.File)); this._typeLimitingBinder = new TypeLimitingDeserializationBinder(); formatter.Binder = this._typeLimitingBinder; this._objFormatter = formatter; try { this._ReadResources(); } catch (EndOfStreamException exception) { throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"), exception); } catch (IndexOutOfRangeException exception2) { throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"), exception2); } }
[System.Security.SecurityCritical] // auto-generated private void ReadResources() { Contract.Assert(_store != null, "ResourceReader is closed!"); #if FEATURE_SERIALIZATION BinaryFormatter bf = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.File | StreamingContextStates.Persistence)); #if !FEATURE_PAL _typeLimitingBinder = new TypeLimitingDeserializationBinder(); bf.Binder = _typeLimitingBinder; #endif _objFormatter = bf; #endif // FEATURE_SERIALIZATION try { // mega try-catch performs exceptionally bad on x64; factored out body into // _ReadResources and wrap here. _ReadResources(); } catch (EndOfStreamException eof) { throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"), eof); } catch (IndexOutOfRangeException e) { throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"), e); } }