Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7819427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:56:57+00:00 2026-06-02T06:56:57+00:00

I apologize for this question length, but I think you’ll all find it worth

  • 0

I apologize for this question length, but I think you’ll all find it worth it. Before I begin, let me say that I was really trying to produce an isolated console application, but sadly that proved impossible. The bug does not happen in a console app. It doesn’t happen in a self-contained ASP.NET app. It only happens when run within IIS 7.5 on Windows 7.

The error seems related to the dynamic language runtime as it involves the combination of a __TransparentProxy (via WCF) and a dynamic variable (an int). The line that produces the problem is the invocation of a static method (that happens to contain no method body) passing in both the proxy and the dynamic int.

Once the method is invoked, the w3wp.exe process takes up the entire CPU and starts increasing memory very rapidly (for me about 100 megs per second, though it tapers off presumably due to GC’ing).

To reproduce this error, create a new ASP.NET web site in Visual Studio (“New” | “Project” “C#” | “Web” | “ASP.NET Web Application”). Then create a new site in IIS whose home directory is your new project. (also, give “Everyone” full read/write access to that folder and make sure the app pool is using .NET 4.0) Give the new site a specific port, like 7080. Finally, paste this code into Global.asax.cs:

public class Global : System.Web.HttpApplication
{
    void Application_Start(object sender, EventArgs e)
    {
        dynamic dynamicId = 5;

        var serviceUrl = "http://localhost:7182/FooServices.svc";
        ChannelFactory factory = new ChannelFactory<IFooServices>(new WSHttpBinding(), new EndpointAddress(serviceUrl));
        factory.Open();
        IFooServices fooServices = ((ChannelFactory<IFooServices>)factory).CreateChannel();

        BlowUpTheProgram(fooServices, dynamicId);  // This line hangs
    }

    [ServiceContract]
    public interface IFooServices
    {
        [OperationContract]
        void Bar();
    }

    public static void BlowUpTheProgram(IFooServices eventServices, int authorMailboxId)
    {
    }
}

Now access the site in your browser via http://localhost:7080 (or whatever port you chose). Have task manager ready because you’ll want to kill the w3wp.exe process after confirming the reported symptoms.

To confirm that the proxy and dynamic are working together to surface this bug, change this line:

dynamic dynamicId = 5;

To:

int dynamicId = 5;

Retry, and you’ll notice the problem has gone away and the page loads. Now change it back to dynamic and then change this line:

IFooServices fooServices = ((ChannelFactory<IFooServices>)factory).CreateChannel();

To:

IFooServices fooServices = null;

Retry, and you’ll again notice the problem is gone in this scenario too.

Finally, if I attach the debugger and break all, I can see what it’s doing while stuck in this method call. It seems to always show something like:

mscorlib.dll!System.RuntimeMethodHandle.GetDeclaringType(System.IRuntimeMethodInfo method) + 0x2f bytes
mscorlib.dll!System.Reflection.Emit.DynamicResolver.ParentToken(int token) + 0x1f3 bytes
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.Reflection.Emit.DynamicMethod.CreateDelegate(System.Type delegateType, object target) + 0x29 bytes
System.Core.dll!System.Linq.Expressions.Expression>.Compile() + 0xbb bytes
System.Core.dll!System.Runtime.CompilerServices.CallSiteBinder.BindCore>(System.Runtime.CompilerServices.CallSite> site, object[] args) + 0x10a bytes
System.Core.dll!System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3(System.Runtime.CompilerServices.CallSite site = {System.Runtime.CompilerServices.CallSite>}, WebApplication1.Global arg0 = {ASP.global_asax}, WebApplication1.Global.IFooServices arg1 = {System.Runtime.Remoting.Proxies.__TransparentProxy}, object arg2 = 5) + 0x3f0 bytes
WebApplication1.dll!WebApplication1.Global.Application_Start(object sender = {System.Web.HttpApplicationFactory}, System.EventArgs e = {System.EventArgs}) Line 19 + 0x1b8 bytes C#

For the record, I’ve tried it on three different machines and was able to repro only on the Windows7/IIS7.5 boxes. On the Windows Server 2008 / IIS7 box there was no problem.

The question is, how do I solve this problem and successfully invoke the method? Also, why is this happening? I’d hate to have to be overly careful about invoking things that will use the DLR because it will make IIS crash.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:56:58+00:00Added an answer on June 2, 2026 at 6:56 am

    I’m not able to answer Why this happens however casting your dynamic object to int when passing the parameter will work.

    DontBlowUpTheProgram(fooServices, (int)dynamicId); 
    

    Perhaps someone with more knowlege of the internals will wade in with a fuller explination.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize if this question was asked already before but I could not find
I apologize for the length of this question, but some background explanation is required.
I apologize for the subjectiveness of this question, but I am a little stuck
Hopefully no one has asked this question - didn't see it, but I apologize
I apologize ahead of time for the length of this question...It's a little involved.
First of all - I apologize if this question shows ignorance or I'm not
I apologize if this question was asked before I just couldn't correctly formalize it.
I apologize for the length of this question and give a pre-emptive thanks for
Again I apologize for a question that might be simple to all of you.
I know that this question has been asked loads of times, but I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.