Share via


Corrupt .resources file. Unable to read resources from this file because of invalid header information. Try regenerating the .resources file.

Question

Friday, November 2, 2018 10:34 AM

Please help me to fix this exception.

Corrupt .resources file. Unable to read resources from this file because of invalid header information. Try regenerating the .resources file.

************** Exception Text **************
System.BadImageFormatException: Corrupt .resources file. Unable to read resources from this file because of invalid header information. Try regenerating the .resources file. > System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.__Error.EndOfFile()
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadInt32()
   at System.Resources.ResourceReader._ReadResources()
   at System.Resources.ResourceReader.ReadResources()
   at System.Resources.ResourceReader.ReadResources()
   at System.Resources.RuntimeResourceSet..ctor(Stream stream)
   at System.Resources.ManifestBasedResourceGroveler.CreateResourceSet(Stream store, Assembly assembly)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture, Boolean wrapUnmanagedMemStream)
   at GoogleAPIIntraction.AccountSelectionTwo.InitializeComponent() in C:\Users\netelixir\Desktop\31July_Pro_Local\GoogleAPIIntraction\Forms\Accounts\AccountSelectionTwo.designer.cs:line 70
   at GoogleAPIIntraction.AccountSelectionTwo..ctor() in C:\Users\netelixir\Desktop\31July_Pro_Local\GoogleAPIIntraction\Forms\Accounts\AccountSelectionTwo.cs:line 17
   at GoogleAPIIntraction.Forms.AdwordsAnalytics.btnaddaccount_Click(Object sender, EventArgs e) in C:\Users\netelixir\Desktop\31July_Pro_Local\GoogleAPIIntraction\Forms\Accounts\AdwordsAnalytics.cs:line 58
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

The error occurred in this line..

this.chk_adwords.Image = ((System.Drawing.Image)(resources.GetObject("chk_adwords.Image")));

Thanks,

Gayatri KD

All replies (5)

Monday, November 5, 2018 2:21 AM

Hi,

**>>System.IO.EndOfStreamException…

Try this:

1: From the main menu click on -> Build

2: Click on Clean solutions

3: Click on Clean 'ProjectName'

4: Then finally Re-build your project

**>>System.BadImageFormatException…

Check the following thread:

System.BadImageFormatException when target framework is 4.0

Regards,

Stanly

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].


Monday, November 5, 2018 5:35 AM

Tried clean and Re-build of the project,but did not work.

I am using target framework 4.6.1

The error occurred in this line,should i have to change anything in the following line.

this.chk_adwords.Image = ((System.Drawing.Image)(resources.GetObject("chk_adwords.Image")));

Please help me,

Thanks in advance.


Tuesday, November 6, 2018 2:56 AM

Hi,

Could you provide a simple demo to reproduce your problem?

Regards,

Stanly

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].


Thursday, November 8, 2018 10:59 AM | 1 vote

Hi,

I removed the corrupted images from resources folder,now it is working.

Thanks,

Gayatri


Monday, November 12, 2018 9:26 AM

Hi Gayatri,

Congratulations, and hope you can close this thread by marking the reply as answer as this will help others looking for the same or similar issues down the road.

Regards,

Stanly

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].