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

WinForm:尝试读取或写入受保护的内存。这通常指示其他内存已损坏。


 DALFactory.MultiMs.bulidSmil(Application.StartupPath + @"\" + FL + "\\", fName + ".smil", alimge, altxt, alsound, alTime);
                string mmsInfo = DALFactory.MultiMs.readfilekb(Application.StartupPath + @"\" + FL);
                label16.Text = "您制作的彩信大小为" + mmsInfo.ToString() + ";彩信不能超过" + intSupportKB.ToString() + "kb!";
//没什么运行到label16.Text...这个位置就会报出异常提示“尝试读取或写入受保护的内存。。。”,并且在这句的前面如果执行一次MessageBox.show("1");  异常就不会出现
                string SubSize = mmsInfo.Substring(0, mmsInfo.Length - 2);
                MMSsize = Convert.ToDecimal(SubSize);



针对上述问题,请教各位,在下新人!谢谢 winform --------------------编程问答-------------------- 你用多线程了吧?
如果在读数据的时候用了多线程。你那时候还没取出值来。
sleep一下就好了 --------------------编程问答--------------------
引用 1 楼 lye2000000_super 的回复:
你用多线程了吧?
如果在读数据的时候用了多线程。你那时候还没取出值来。
sleep一下就好了


Y的 应该是使用皮肤文件的问题,然后没有释放的缘故吧,谢谢 --------------------编程问答--------------------
引用 1 楼 lye2000000_super 的回复:
你用多线程了吧?
如果在读数据的时候用了多线程。你那时候还没取出值来。
sleep一下就好了


错误标题:内部上传方法异常

错误信息:尝试读取或写入受保护的内存。这通常指示其他内存已损坏。

错误内容:   在 System.Windows.Forms.SafeNativeMethods.SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, 

Int32 x, Int32 y, Int32 cx, Int32 cy, Int32 flags)
   在 System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified 

specified)
   在 System.Windows.Forms.Label.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified 

specified)
   在 System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified 

specified)
   在 System.Windows.Forms.Control.set_Size(Size value)
   在 System.Windows.Forms.Label.AdjustSize()
   在 System.Windows.Forms.Label.OnTextChanged(EventArgs e)
   在 System.Windows.Forms.Control.set_Text(String value)
   在 System.Windows.Forms.Label.set_Text(String value)
   在 JXT.WinForm.MultiMs.UpdateMMS() 位置 D:\2.0.0.12\JXT\WinForm\MultiMs.cs:行号 730 --------------------编程问答-------------------- 你是怎么操作的?这个不是在主线程里操作的? --------------------编程问答-------------------- invoke 一下试试看看
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,