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

Error Generating Migrations #30

Closed
DOTang opened this issue Oct 10, 2016 · 4 comments
Closed

Error Generating Migrations #30

DOTang opened this issue Oct 10, 2016 · 4 comments

Comments

@DOTang
Copy link

DOTang commented Oct 10, 2016

I noticed an error when generating migrations which caused me to be unable to run the migration generated. When I try I get this error:

Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MyProject.Migrations.MyMigrationName.resources" was correctly embedded or linked into assembly "MyProject" at compile time, or that all the satellite assemblies required are loadable and fully signed.

I notice then, in the initial migration generated by your tools the designer file looks like this:

public sealed partial class InitialCreate : IMigrationMetadata
{
        string IMigrationMetadata.Id
        {
            get { return "201610061952137_InitialCreate"; }
        }

        string IMigrationMetadata.Source
        {
            get { return null; }
        }

        ...
}

Then in my second migration it looks like this:

private readonly ResourceManager Resources = new ResourceManager(typeof(UpdatedEntities));

string IMigrationMetadata.Id
{
      get { return "201610102027102_UpdatedEntities"; }
}

string IMigrationMetadata.Source
{
      get { return Resources.GetString("Source"); }
}

So the error is clear here, it's referencing resource manager that I am not using, removing that line and setting the IMigrationMetadata.Source to return null, as in the original migration fixed the problem. But it seems to be an error in generating it.

As an aside, in the package manager to download your package, only 1.0.4 and 1.0.6 show up. You can update project.json with 1.0.5 and it works, but it doesn't show in the package explorer UI.

@mrahhal
Copy link
Owner

mrahhal commented Oct 11, 2016

Yes something is definitely wrong here. The string IMigrationMetadata.Source property should always be returning null. Don't worry about the private readonly ResourceManager Resources = new ResourceManager(typeof(UpdatedEntities)); line, I should be removing it from all the files but it's a bug, it's not harmful though.

So it's the problem of IMigrationMetadata.Source not returning null. This worked for you before, right? Anything you did differently in this project?

I think I can guard against this in all cases and check if there's a "Source" resource along with the "Target" resource. But I'm curious to know why the "Source" property is not returning null in your case.

As an aside, in the package manager to download your package, only 1.0.4 and 1.0.6 show up. You can update project.json with 1.0.5 and it works, but it doesn't show in the package explorer UI.

Yeah I do that sometimes when I release 2 versions in close intervals. 1.0.5 is still there but it's just hidden. 1.0.6 includes 1.0.5, I guess it just makes it easier to read.

@mrahhal
Copy link
Owner

mrahhal commented Oct 11, 2016

I checked the EF6 source, it seems it does add a "Source" resource sometimes. I'll make a fix in all cases.

@mrahhal
Copy link
Owner

mrahhal commented Oct 11, 2016

Fixed in 8204b0b, included in 1.0.7.

Thanks for reporting this!

@mrahhal mrahhal closed this as completed Oct 11, 2016
@DOTang
Copy link
Author

DOTang commented Oct 11, 2016

Wonderful, thanks!

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

2 participants