Dynamicmethod (JIT compiler encountered an internal limitation.) I still believe in Chinese

Source: Internet
Author: User

Errors at MicrosoftCommunityNo one can solve the problem. It seems that the foreign devils are not very good. No cnblogs are enthusiastic.

First, check the exception prompt:

JIT compiler encountered an internal limitation.

 

ProgramCode:

An exception occurred when running the delegate.

 

Code

Private   Decimal Productkpidata (type, String Methodname, guid userid, Int Year)
{
VaR Cache = Httpruntime. cache;
If (Cache [methodname] ! =   Null )
Return (Func < Guid, Int , Decimal > ) Cache [methodname]) (userid, year );

VaR dynamicmethod =   New Dynamicmethod ( " Gan " , Typeof ( Decimal ), New Type [] { Typeof (Guid ), Typeof ( Int )}, Typeof (Analyzeresultbll). Module );
VaR ilgen = Dynamicmethod. getilgenerator (); // Il Generator
// Push parameters to the stack
Ilgen. emit (Opcodes. ldarg_0 );
Ilgen. emit (Opcodes. ldarg_1 );
Ilgen. emit (Opcodes. ldarg_2 );
Ilgen. emit (Opcodes. Call, type. getmethod (methodname, New Type [] { Typeof (Guid ), Typeof ( Int )}));
Ilgen. emit (Opcodes. Ret ); // End and Return Value

// Generate Delegation
Func < Guid, Int , Decimal > Gan =  
(Func < Guid, Int , Decimal > ) Dynamicmethod. createdelegate ( Typeof (Func < Guid, Int , Decimal > ));
// Delegate to cache
Cache. insert (methodname, Gan );

//Call the delegate to return the result
ReturnGan (userid, year );
}

 

 

 

It is also a special reason for making such a junk method. If I am tired, I can't say it. I just stick it to the wrong part and stick it to the core of the problem.

If there are parameters and methods, other problems will be avoided. The core issue is exceptions. Permission? What is the solution?

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.