.NET Development
GetManifestResourceStream corrupted intermittently
Gravatar is a globally recognized avatar based on your email address. GetManifestResourceStream corrupted intermittently
  Bob
  All
  Dec 14, 2018 @ 09:12am

Hello,

I have encountered a very strange problem with a winforms appilcation using EF 6.3. The application is compiled as x86 and running on Windows 10 x64 machines. The application works correctly most of the time but sometimes EF is not able to read the embedded XML files to setup the mapping of entities to database tables. I add the EF source code to the solution and pined down the problem to the code where EF extracts the embedded resource files. Sometime a tag like Name will be changed Naméy followed with some not printable characters. When you start the application again most of the time everything works as expected.

I checked my machine for viruses and RAM for any faults. No virus no faulty memory banks.

The problem does not only occur on my machine but multiple machines within the company. Strangely enough it does not happen on virtual machines which have the same setup.

Does anybody know what could interfere with GetManifestResourceStream intermittently?

Cheers,

Bob

Gravatar is a globally recognized avatar based on your email address. re: GetManifestResourceStream corrupted intermittently
  Rick Strahl
  Bob
  Dec 14, 2018 @ 01:57pm

Not sure - that sure sounds like memory corruption or perhaps a UTF-8 encoding issue? Make sure that you don't edit the EDMX files manually or if you do that you preserve the UTF-8 formatting and BOM (encoding) on the document.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: GetManifestResourceStream corrupted intermittently
  Bob
  Rick Strahl
  Dec 14, 2018 @ 02:18pm

Hello Rick,

thanks a lot for responding!

Like I wrote the memory is okay, the edmx is not changed.

The problem occurs with the compiled application, meaning I can start the application and all is good or not. There is no need to recompile. The problem happens randomly in production.

If it was encoding issue, the error should happen on every start of the application. But I can restart the application and it might work without any issues.

It is like Benders´s nightmare, some process is able to interfere with a core .Net method. But I have no clue how that is possible. If the problem would show with a certain build, I could pin it down to something within the development environment, but it happens with deployed version or does not.

I know that this problem is weired and bound to our environment, but I am trying to figure out what could interfere with a core .Net method.

Cheers,

Bob

Gravatar is a globally recognized avatar based on your email address. re: GetManifestResourceStream corrupted intermittently
  Rick Strahl
  Bob
  Dec 18, 2018 @ 02:24pm

No idea without a lot more info about what's happening at the point of error.

First thing to check is if it runs Ok on other machines - if it's really just this one machine then it seems that the problem is definitely localized.

I can think of a few things that would cause GetManifestResourceStream to fail:

  • Out of Memory (or application heap if the app is running up against its memory limits (32 bit mainly) )
  • File corruption (maybe a single byte that's bad and doesn't consistently trigger)
  • Anti-virus

The latter might actually be an issue as AV can interfere with file reads as they often add intermediary APIs for file processing to go through. Given that resources are compiled into the project itself that might have.

But all of this is conjecture until you have a repro case where you can actually examine the environment when the error occurs.

+++ Rick ---

© 1996-2024