Reputation: 3983
This error occurred when build my solution in Visual Studio 2008.even run VS2008 as Admin but this error is not solved.
The "GenerateResource" task failed unexpectedly. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Drawing.SafeNativeMethods.Gdip.GdipSaveImageToStream(HandleRef image, IStream stream, Guid& classId, HandleRef encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(MemoryStream stream)
at System.Drawing.Image.System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo si, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
at System.Resources.ResourceWriter.WriteValue(ResourceTypeCode typeCode, Object value, BinaryWriter writer, IFormatter objFormatter)
at System.Resources.ResourceWriter.Generate()
at System.Resources.ResourceWriter.Dispose(Boolean disposing)
at System.Resources.ResourceWriter.Close()
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(IResourceWriter writer)
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(String filename)
at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFile)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, ArrayList inputs, ArrayList outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) Nezam.PresentationLayer
Upvotes: 1
Views: 4890
Reputation: 941635
WindowsCodec.dll is corrupted. for resolve this problem fix this dll
That's very unlikely to be the root cause. GdipSaveImageToStream() is a GDI+ function and implemented in gdiplus.dll. The one in the winsxs subdirectory, not system32. It doesn't use WIC and has no dependency on WindowsCodec.dll. If you see corrupted operating system DLLs then it of course isn't terribly unlikely that the damage is more widespread. You need to get your machine stable again, replacing the disk drive ought to be high on your list.
Perhaps you should not automatically assume disaster, given that you misidentified the cause. A corrupted image file in a .resx file is technically capable of tripping this exception as well. Delete resources from the .resx file until the problem disappears.
Upvotes: 2
Reputation: 3685
Probably one or more images in your resources file is corrupted. Image file corruptions are hard problems since many utilities just discard problems. Incomplete files generally filled with magenta/green where data is missing. My favorite is header problems, on data side there is no problem you have full image, but you have some inconsistencies in file header that causes only some applications to fail. A decade ago a flaw in Windows GDI+ allowed hackers to craft jpeg files with broken headers to attack systems. On that day I've lost about 20000 TIFF images since antivirus program thought these images had bad header so they are virus.
Try image info/checker tools.
Upvotes: 0