Page 1 of 2 12 LastLast
Results 1 to 40 of 44

Thread: Type initializer for <Module> threw an exception

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Unhappy Type initializer for <Module> threw an exception

    Hi,

    When I launch VB2010 Express, I get an error message saying "Type initializer for <Module> threw an exception".
    I think it has something to do with the .NET framework, but I'm not sure.

    I have Windows 7 Ultimate 32 bit (.NET framework 4.0).
    Does anybody know what could be the problem?

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Type initializer for <Module> threw an exception

    Sounds like a broken .Net to me.

    Tough break there. Starting with Vista Microsoft chose to preinstall several .Net versions as part of the OS, making them difficult to impossible to repair.

    Could be time to reformat the hard drive and reinstall Windows from scratch.


    See How to repair the .NET Framework 2.0 and 3.0 on Windows Vista. It applies to Win7 as well.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    I already have installed Windows 7 from scratch.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    Well, what i could try, is replacing the system32\mscoree.dll file with version 4.0.30319, my current .NET version.
    Because when I install .NET 4.0 the system32\mscoree.dll file doesn't update to the right version.
    But I can't find the mscoree.dll file version 4.0.30319 online.
    Maybe you could help?

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Type initializer for <Module> threw an exception

    Sorry, no answers here.

    How can "version 4.0.30319" be your current .NET version if you can't get it anywhere?

    Exact versions numbers are never stable anyway. .Net is such a gigantic malware attack surface that new security patches from 20MB to 120MB in size arrive monthly.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    Sorry, I haven't been very clear.

    See my previous thread (http://www.vbforums.com/showthread.p...-2908-amp-1935).
    I had recently installed .NET framework 4.0 but system32\mscoree.dll didn't update, its version remained 2.0.
    This also prevented me from installing VB2010.
    Later I replaced mscoree.dll version 2.0 by mscoree.dll version 4.0, which I found on the internet.
    That made the installation succeed.
    But now, when I launch VB2010 it gives me the type initializer error.

    So I thought maybe the error showed up because the downloaded mscoree.dll file has a slightly different version (4.0.40305) than my .NET (4.0.30319).
    That's why I wanted to try to find the correct version, to see if that works.
    Last edited by Superthijs; Jun 28th, 2013 at 04:03 PM.

  7. #7
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Quote Originally Posted by Superthijs View Post
    So I thought maybe the error showed up because the downloaded mscoree.dll file has a slightly different version (4.0.40305) than my .NET (4.0.30319).
    That's why I wanted to try to find the correct version, to see if that works.
    The version of the "mscoree.dll" I have will VS2010 installed successfully on Windows 7 is "4.0.4.035.0". Although, I am unsure how I come by it.

    Edit:

    Looking at the uninstall list of programs on my pc I have

    Microsoft .NET Framework 4 Client Profile
    Microsoft .NET Framework 4 Extended
    Microsoft .NET Framework 4 Multi-targeting pack

    I am not sure which of those are responsible nor if those files are responsible at all.
    Last edited by Nightwalker83; Jun 28th, 2013 at 09:08 PM. Reason: Adding more!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    What should I do now?
    I tried everything and nothing works...

  9. #9
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Quote Originally Posted by Superthijs View Post
    What should I do now?
    I tried everything and nothing works...
    So you have tried installing the framework mentioned in the previous post?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    I can't find the .NET framework 4.0.4.035.0 installer, as mentioned in post #7.

  11. #11
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Try this!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    Didn't work either, tried that a couple of times a few days ago.

  13. #13
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    I am installing VS2010 on a Virtual Machine running Vista which, currently has mscoree.dll version 2.0.50727.1434 installed.

    Edit:

    Just finished installing, and VS2010 loaded without any errors. It also updated mscoree.dll was updated to 4.0.31106.0. Also, the version of Windows Vista I was using was a completely new install, no other programs installed.
    Last edited by Nightwalker83; Jun 30th, 2013 at 08:52 AM. Reason: Adding more!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    But I'm using Windows 7, that's not the same as Vista.

  15. #15
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Quote Originally Posted by Superthijs View Post
    But I'm using Windows 7, that's not the same as Vista.
    Since you are only using the 32bit version of Windows 7 there wont be many differences if any at all.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    Wow. I have the same mscoree.dll version as you, and yet it doesn't work for me...
    Could the problem be something else rather than mscoree.dll?

  17. #17
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    When the error mentioned in the first post is thrown is there a more details button/link? If so it might offer some extra useful information in there.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  18. #18

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    No, only the error message itself and the OK and Cancel button.

  19. #19
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Does the message mention the module name, if so what is it?

    Edit:

    See if The type initializer for '<Module>' threw an exception works.
    Last edited by Nightwalker83; Jul 3rd, 2013 at 07:56 PM. Reason: Adding more!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  20. #20

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    No, the only text in the error box is "Type initializer for <Module> threw an exception".

  21. #21
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Quote Originally Posted by Superthijs View Post
    No, the only text in the error box is "Type initializer for <Module> threw an exception".
    Was the site I linked to in post #19 any help?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  22. #22

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    Nope

  23. #23
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Quote Originally Posted by Superthijs View Post
    I already have installed Windows 7 from scratch.
    Was Visual Studios the first program you installed after this?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  24. #24

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    No, could that be the cause of the problem?

  25. #25
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Quote Originally Posted by Superthijs View Post
    No, could that be the cause of the problem?
    Not sure! Might as well try it and see what happens.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  26. #26

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    Sorry for the late reply!

    Well, I've installed Windows 7 on a new partition.
    First thing I did was run the Visual Basic 2010 Express installer.
    After downloading all the necessary files it started installing, and when it tried to install 'Microsoft Visual Basic 2010 Express' this error came up:

    Name:  2.png
Views: 3045
Size:  20.0 KB

    Then the installer quit.
    Last edited by Superthijs; Jul 15th, 2013 at 12:39 PM. Reason: Wrong image...

  27. #27
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  28. #28

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    Didn't work

  29. #29
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Where did you download the installer from and how bigger is the one you downloaded compared to how big it says the file is suppose to be? It looks like you been to download it again.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  30. #30

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    What do you mean by 'how big it says the file is supposed to be'?

  31. #31
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Quote Originally Posted by Superthijs View Post
    What do you mean by 'how big it says the file is supposed to be'?
    What the site says the size of the file is compared to the size of the file downloaded on to your computer.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  32. #32

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    The website where I downloaded it from (http://www.microsoft.com/visualstudio/eng/downloads) doesn't mention the installer size.
    But every Visual Studio install (2010, 2010 Express, 2012, 2012 Express, etc.) fails, it's not just this one.

  33. #33
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Visual Studio Express Readme - Downloads - Microsoft have you read that read me file?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  34. #34

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    The link doesn't work?

  35. #35
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Quote Originally Posted by Superthijs View Post
    The link doesn't work?
    I have edited the post now try the link.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  36. #36

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    It says 'There are no known issues' under every Visual Basic 2010 express section.

  37. #37
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    I am confused in post #6 the post you link to you say you finally got VB Express to install and it is broken again?

    Quote Originally Posted by Superthijs View Post
    It works!!!
    Finally!

    C:\WINDOWS\system32\mscoree.dll was the problem.
    See, I have .NET framework 4.0 installed and the version of this file was not 4.0 but 2.0.
    So, I fixed it as follows:
    1. Downloaded a correct version of mscoree.dll
    2. Booted from the Windows 7 installation disc
    3. Started the command prompt
    4. Renamed system32\mscoree.dll to something else (I did mscoree.dll.old)
    5. Copied the downloaded mscoree.dll file to system32\
    When I restarted the computer, logged in and (once again) ran the VB2010 Express installer, it worked!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  38. #38

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    I made quite a mess of this thread I think
    The link in post #6 describes my workaround for the installation problem in that thread.
    After that VB2010 never worked because I kept getting this type initializer error when launching.

    The other installation attempt in post #26 never even succeeded.

    It's also kind of hard to explain things clearly in English because it isn't my native language... :S
    Last edited by Superthijs; Jul 21st, 2013 at 10:32 AM. Reason: Extra information

  39. #39
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Type initializer for <Module> threw an exception

    Seeing as we don't have access to your computer I have downloaded the VB Express you link to (and I assume) you are using! I am attempting to install and run it to see if I face the same problems.

    Edit:

    Just tried the VB Express (web install 3.1MB) and it installed and run perfectly but still had a number of updates such as those mentioned in post #7 installed. Will try on a new (completely fresh) Windows 7 32 bit Virtual Machine and see what happens.

    Again, I had no problem installing Visual Basic 2010 Express on Windows 7 Professional 32bit! I hate to say this but there is something suspicious about your set up.
    Last edited by Nightwalker83; Jul 21st, 2013 at 11:24 PM. Reason: Adding more!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  40. #40

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Re: Type initializer for <Module> threw an exception

    So could it have something to do with my Windows 7 installation disc?
    Because I did a fresh reinstall on an empty partition and VB threw errors.

Page 1 of 2 12 LastLast

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