none
Need Help! .Net 4.0 runtime crash because of MethodAccessException RRS feed

  • Question

  • I'm working on an upgrade project, the old one is based on .Net 3.5, it look like this:
    .Net Remoting Host -> LibraryInterface -> LibraryWorker (wrapper of COM object)

    Now the upgraded one is based on .Net 4.0:
    WCF 4.0 Host -> LibraryInterface -> LibraryWorker (wrapper of COM object).

    When I test it, the WCF host (be it console host or windows service host, it doesn't matter) just crashes (client receives SocketException - An existing connection was forcibly closed by the remote host), and 2 errors in event log on server:

    ---

    Event Type:    Error
    Event Source:    .NET Runtime
    Event Category:    None
    Event ID:    1026
    Date:        1/18/2011
    Time:        11:30:09 PM
    User:        N/A
    Computer:    X
    Description:
    Application: ConsoleHost.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.MethodAccessException
    Stack:
       at MS.Internal.PrintWin32Thunk.PrinterDefaults.!PrinterDefaults()
       at MS.Internal.PrintWin32Thunk.PrinterDefaults.Dispose(Boolean)
       at MS.Internal.PrintWin32Thunk.PrinterDefaults.Finalize()
    ---
    Event Type:    Error
    Event Source:    .NET Runtime 4.0 Error Reporting
    Event Category:    None
    Event ID:    5000
    Date:        1/18/2011
    Time:        11:29:50 PM
    User:        N/A
    Computer:    X
    Description:
    EventType clr20r3, P1 consolehost.exe, P2 1.0.0.0, P3 4d3685e4, P4 system.printing, P5 4.0.0.0, P6 4ba1f817, P7 a4, P8 0, P9 system.methodaccessexception, P10 NIL.

    ---

    It works fine under .Net 3.5 Remoting, , and the LibraryWorker is pretty much the same in 2 projects. I really have no idea why it fails so deadly in .Net 4.0 WCF... Any help will be great!

    Wednesday, January 19, 2011 8:13 AM

Answers

  • I found something, this is a bug of .Net Framework 4.0:

    https://connect.microsoft.com/VisualStudio/feedback/details/552520/methodaccessexception-when-printqueuecollection-disposed?wa=wsignin1.0

    • Marked as answer by Leishen Wednesday, January 19, 2011 8:40 AM
    Wednesday, January 19, 2011 8:31 AM

All replies

  • I found something, this is a bug of .Net Framework 4.0:

    https://connect.microsoft.com/VisualStudio/feedback/details/552520/methodaccessexception-when-printqueuecollection-disposed?wa=wsignin1.0

    • Marked as answer by Leishen Wednesday, January 19, 2011 8:40 AM
    Wednesday, January 19, 2011 8:31 AM
  • Thank you for sharing.
    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 20, 2011 2:26 AM
  • Hi,

    The link you provided expired... could you please help me out with this.. i'm also facing the same kind of problem. asp application pools crashed repeatedly.

    Friday, August 8, 2014 10:18 AM