zoukankan      html  css  js  c++  java
  • ="公共语言运行库检测到无效的程序。"???? 是微软的bug吗?

    用户代码未处理 System.InvalidProgramException
      Message="公共语言运行库检测到无效的程序。"
      Source="WindowsApplication1"
      StackTrace:
           在 WindowsApplication1.Winvoker.Invokess[T](Control ctrl, Invokes`1 i, T value)
           在 WindowsApplication1.Form1.Set() 位置 D:\我的文档\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs:行号 25
           在 System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
           在 System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
           在 System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

    代码
    using System;
    using System.Collections.Generic;

    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace WindowsApplication1
    {
        
    public partial class Form1 : Form
        {
            
    public Form1()
            {
                InitializeComponent();
            }

            
    private void button1_Click(object sender, EventArgs e)
            {
                
    new Pixysoft.MultiThread.AsyncMethodHelper(Set).Do();
            }

            
    private void Set()
            {
                Winvoker.Invokess
    <string>(label1, SetText, "asdf");

            }

            
    private void SetText(string mes)
            {
                label1.Text 
    = "sdf";
            }
        }

        
    public class Winvoker
        {
            
    public delegate void Invokes<T>(T value);

            
    private delegate void DInvokes<T>(Control ctrl, Invokes<T> i, T value);

            
    public static void Invokess<T>(Control ctrl, Invokes<T> i, T value)
            {
                
    if (ctrl.InvokeRequired)
                    ctrl.Invoke(
    new DInvokes<T>(Invokess<T>), new object[] { ctrl, i, value });
                
    else
                    i(value);
            }
        }
    }
  • 相关阅读:
    SQL Server临时表的使用方案
    SqlServer 临时表
    SqlServer 数据表数据移动
    IQ/OQ/DQ/PQ
    (转)C# WebApi 跨域问题解决方案:CORS
    (转).Net高级进阶,在复杂的业务逻辑下,如何以最简练的代码,最直观的编写事务代码?
    (转)C#动态webservice调用接口
    (转)wsdl文件用SoapUI快速创建WebService,CXF生成客户端代码
    (转)C# Oracle数据库操作类
    (转)C#连接Oracle数据库(直接引用dll使用)
  • 原文地址:https://www.cnblogs.com/zc22/p/1739732.html
Copyright © 2011-2022 走看看