MSDN > 論壇首頁 > Common Language Runtime > System.InvalidProgramException
發問發問
 

問題System.InvalidProgramException

  • 2008年2月21日 上午 04:44Sanjukta 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
     

    Hi,

    I have a console application which uses Team Foundation APIs. It works perfectly well on my system, but when deployed onto a server, throws weird errors.

    This is the exception:

    System.InvalidProgramException: Common Language Runtime detected an invalid program.
       at Microsoft.TeamFoundation.Client.TeamFoundationServerFactory.GetServer(String name).

     

    This is the statement that throws the exception:

    TeamFoundationServer objTFS = TeamFoundationServerFactory.GetServer("http://"+strApplicationServer+":8080");

     

    I read about this exception and turned off Optimisation hoping that would resolve the problem. It did not help. I even used the PE Verifier to verify the MSIL, and it showed no errors.

     

    Now, I have no clue how to fix the problem. Please help.

     

    Thanks.

     

所有回覆

  • 2008年8月13日 下午 02:39Scott Piegdon 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     包含代碼
    Have you found any resolution to this problem?  I am experiencing the same issue.  My code is a bit different, because I switched from the factory to the constructor during the debugging of this, but still the first time I try to reference the object generated I get it also:

    System.InvalidProgramException: Common Language Runtime detected an invalid program. at Microsoft.TeamFoundation.Client.TeamFoundationServer.op_Equality(TeamFoundationServer tfs1, TeamFoundationServer tfs2) 

    // Connect to the team foundation server
    TeamFoundationServer tfs = new TeamFoundationServer(
         ConfigurationManager.AppSettings["tfsServer"],
              new System.Net.NetworkCredential(
                   ConfigurationManager.AppSettings["tfsUser"],
                   ConfigurationManager.AppSettings["tfsPassword"],
                   ConfigurationManager.AppSettings["tfsDomain"]));

    if
    (tfs == null)
         throw new Exception("Unable to connect to TFS Service");

    I am very stuck at this point, I have made some very cool sharepoint add-ins that communicate with TFS, however even in a stand alone web application, I cannot seem to access TFS from the server via code.

    Please let me know if anyone has any ideas.

    Thanks!
    Scott Piegdon

  • 2008年8月15日 上午 10:19nobugzMVP, 版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    If you are running this code on a 64-bit OS, force the CLR to run in 32-bit mode with the Build, Platform = x86 override.
    Hans Passant.
  • 2008年10月7日 上午 10:33Dickie Howarth 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    Hi,

    I'm having the same probelm when trying to connect to the TF Server.

    Did you find a resolution to your problem? I'm not running a 64bit OS, and I have had this code working on the server when running through VS Team edition on the server.

    Now I have migrated the code to a client, could there be a licence issue, as I do not have the Client licence on the machine contacting the server?

    I would have thought there would be a more meaningful error message if it was this though,

    I would be grateful for any comments,

    Thanks.
  • 2008年10月8日 上午 03:34sm0kkie 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    I am having the same issue running against TFS 2008 while programming in C# in either VS 2005 or 2008.  My error, however, is being thrown while trying to create a new instance of TeamFoundationServer. I am running on x86 and have forced the platform as such. Any ideas?
    • 已編輯sm0kkie 2008年10月8日 上午 03:36
    •  
  • 2008年10月9日 下午 01:47Michael Bird from Sharp Dudes 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
     Are the TFS client DLLs present on the machine you're deploying the code to? Does the licensing even allow you to put them there if they are not?
    Please mark the post if it answers your question.
  • 2008年10月10日 上午 12:14Tim ChenMSFT使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     

    You have to verify the IIS Server have Team Explorer 2008 installed in order for the code to run.

    Tim