CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2010
    Posts
    50

    type intitializer error in C# module

    Hello,

    I have a C# application created using VS 2008 , then those DLLs areimported to another application created using VS 2005. There were no build errors at all for all the application module.When I created an installer & distributed to non-development m/c's I got an error message saying "Error: the type initializer for <module> threw an exception" the module it points to is a C# DLL.

    Please let me know what care I should take to work it properly?

  2. #2
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: type intitializer error in C# module

    Is .NET framework is present on the non-development PC?
    Last edited by vcdebugger; August 9th, 2010 at 06:10 AM.

  3. #3
    Join Date
    Jun 2010
    Posts
    50

    Re: type intitializer error in C# module

    Yes,all required .NEt frameworks are present on Development & QA m/c's

  4. #4
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: type intitializer error in C# module

    Are all dependant DLLs present there ? i.e. the DLLs that you imported.
    Regards,
    Ramkrishna Pawar

  5. #5
    Join Date
    Jun 2010
    Posts
    50

    Re: type intitializer error in C# module

    Yes,All the DLL's are present .our development m/c has .Net framework 3.5 SP1 & QA m/c has .NET framework SP2 .is this anyway responsible for the issue?

  6. #6
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: type intitializer error in C# module

    This error is only seen when some of the DLLs are not passed on to machine where you are trying to run the app. So check again and make sure that these dlls are there.
    Regards,
    Ramkrishna Pawar

  7. #7
    Join Date
    Jun 2010
    Posts
    50

    Re: type intitializer error in C# module

    I checked availability of DLL's as well, all the required DLL'd are present still facing same issue.Kindly advice on the ways to troubleshoot this issue.

  8. #8
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: type intitializer error in C# module

    You need to use a tool like process explorer to see loaded DLLs on the source comp and then see on target comp for the application that you are running.
    Regards,
    Ramkrishna Pawar

  9. #9
    Join Date
    Oct 2009
    Posts
    577

    Smile Re: type intitializer error in C# module

    Quote Originally Posted by forstudy3 View Post
    Hello,

    I have a C# application created using VS 2008 , then those DLLs areimported to another application created using VS 2005. There were no build errors at all for all the application module.When I created an installer & distributed to non-development m/c's I got an error message saying "Error: the type initializer for <module> threw an exception" the module it points to is a C# DLL.

    Please let me know what care I should take to work it properly?
    Do you know the missing C# dll? Is it a VS2008 dll or a VS2005 dll? Can you spot it both on the developer and target machine?

    In case it is VS2008 dll it might use types that were not available (or not right version) on the target system. You then would need to install VS2008 redistributables to the target system.

    Regards, Alex

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured