Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SaveChangesAsync throws MissingManifestResourceException when run in Release mode #1037

Closed
drasticactions opened this issue Nov 9, 2014 · 5 comments
Assignees

Comments

@drasticactions
Copy link

When using EF7 in a Windows Phone 8.1 project, with the debug solution configuration set, calling SaveChangesAsync to save the entity changes runs as expected and saves the changes.

When it's switched to release mode, it throws the following in StateManager.SaveChangesAsync:

System.Resources.MissingManifestResourceException occurred
  HResult=-2146233038
  Message=Exception of type 'System.Resources.MissingManifestResourceException' was thrown.
  Source=mscorlib
  StackTrace:

  {System.Resources.MissingManifestResourceException: Exception of type 'System.Resources.MissingManifestResourceException' was thrown.
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at System.Resources.ResourceManager.GetString(String name)
   at Microsoft.Data.Entity.Relational.Strings.GetString(String name, String[] formatterNames)
   at Microsoft.Data.Entity.Relational.Strings.get_RelationalLoggerCommittingTransaction()
   at Microsoft.Framework.Logging.RelationalLoggerExtensions.CommittingTransaction(ILogger logger)
   at Microsoft.Data.Entity.Relational.RelationalTransaction.Commit()
   at Microsoft.Data.Entity.Relational.Update.BatchExecutor.<ExecuteAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at System.Threading.Tasks.TaskExtensions.CultureAwaiter`1.GetResult()}

Again, this only happens when I set the solution to release. In debug mode, it saves fine. This also only seems to occur in my Windows Phone 8.1 solution. Running the same functions under Windows 8.1, in either configuration, works as expected.

@ArturAlekseev
Copy link

I have the same problem. It only exist in release mode deployed to device. In emulator debug & release work fine. Also it looks like it happens mostly for the first SaveChanges (when first record is inserted).
I have this problem with SaveChangesAsync and with SaveChanges calls.

@bricelam
Copy link
Contributor

This looks like a general issue with resources in portable class libraries. See this StackOverflow question. I can easily repro outside of EF:

  1. Create a PCL with resources
  2. Create a Phone App that references the PCL
  3. Call into the PCL down a codepath that accesses resources

@bricelam
Copy link
Contributor

I've got to the bottom of this. While bundling the app, all resources in dependencies that are not for a language used by the main app are stripped out. To prevent EF's resources from being stripped out, add the following assembly-level attribute to your app.

using System.Resources;

[assembly: NeutralResourcesLanguage("en-US")]

Or, if you are using resources in your app, make sure at least one is for the en-US culture.

@bricelam
Copy link
Contributor

I'll follow up to see if we can get this behavior changed to not strip out the neutral resources in dependencies.

@bricelam bricelam removed this from the 1.0.0-beta2 milestone Nov 18, 2014
@rowanmiller rowanmiller added this to the Investigation milestone Nov 19, 2014
@bricelam
Copy link
Contributor

Closing as external. Please see Visual Studio and .NET Framework Feedback #991028 on Microsoft Connect.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants