I ran into this error “Unable to generate an explicit migration because the following explicit migrations are pending”.
Common causes include:
- You really have some pending migrations. You can do “update-database –verbose” to apply the pending migrations.
- Your solution have multiple projects (e.g. WebAppProject, DataModelProject) and the wrong project is set as the start up project. So just go to Visual Studio and select the right project and then set it as a startup project.
- You changed the ContextKey value in the Migrations\Configuration.cs. You can always check the [dbo].[__MigrationHistory] entries to see if the ContextKeys match. If Configuration.cs does not have a ContextKey, that should be fine.
I have 2 .tiff image files and I want to merge them into one .tiff file. I use TIffBitmapEncoder. I use TiffBitmapDecoder to decode the file memory stream and add to encoder.Frames.
When I try to use the encoder to Save() to the output filestream, I get an argument exception saying “The image has corrupted metadata header.” with an inner exception “The image metadata header is unrecognized.”
Load the input memory stream into a bitmap and save it to another temporary memory stream. It seems to fix the header. Then you use this fixed memory stream for the decoder.
Below is some of my partial code. You need to create the output filestream and close all the memory stream and dispose, etc.
1: TiffBitmapEncoder encoder = new TiffBitmapEncoder();
3: encoder.Compression = TiffCompressOption.Default;
5: MemoryStream convertedMemoryStream = new MemoryStream();
6: var bitmap = new Bitmap(ms); // input memory stream
8: bitmap.Save(convertedMemoryStream, ImageFormat.Tiff); // save it again as a tiff, hoping it fixes the header meta data
9: ms.Position = 0;
10: convertedMemoryStream.Position = 0;
12: var decoder = new TiffBitmapDecoder(convertedMemoryStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
13: bitmapSource = decoder.Frames;
17: encoder.Save(sTiff); // sTiff is a FileStream to the output file