当前位置:编程学习 > C#/ASP.NET >>

GDI+ 中发生一般性错误。

这个问题让人纠结的地方就是, 昨天我在调试程序的时候遇到的, 结果我发现之前一直正常的程序也出现了这个问题。。。奔泪啊。

系统 win7 64     .net版本是3.5 - 4.0




未处理 System.Runtime.InteropServices.ExternalException
  Message=GDI+ 中发生一般性错误。
  Source=System.Drawing
  ErrorCode=-2147467259
  StackTrace:
       在 System.Drawing.Bitmap..ctor(Stream stream, Boolean useIcm)
       在 ConsoleApplication7.Program.Main(String[] args) 位置 D:\Test\ConsoleApplication7\ConsoleApplication7\Program.cs:行号 24
       在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
GDI+ 对象 .NET --------------------编程问答-------------------- 把buffer=null删掉 --------------------编程问答--------------------
引用 1 楼 51Crack 的回复:
把buffer=null删掉


试了不行。 --------------------编程问答--------------------
引用 1 楼 51Crack 的回复:
把buffer=null删掉


这段代码我已经用了很久了  之前也都的是正常的,, 就昨天有个项目上需要调试图片,,结果错误就出来了,, 测了下以前发布的版本 也同样有问题,。,
不知道是系统的问题 还是程序本来写的就不够严谨
--------------------编程问答-------------------- 读完之后,buffer的长度是多少? --------------------编程问答--------------------
引用 4 楼 51Crack 的回复:
读完之后,buffer的长度是多少?


长度为226594    ,这个是正常的,,因为图片是我们自己做的相机抓拍出来的,  可能与解码有关系。 --------------------编程问答-------------------- 试试Image bit = Image.FromStream(ms)正不正常? --------------------编程问答--------------------
引用 6 楼 51Crack 的回复:
试试Image bit = Image.FromStream(ms)正不正常?


一样有问题。。 哎。。。崩溃了
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,