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

  • Home
  • SEARCH
  • 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 101243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:44:01+00:00 2026-05-11T00:44:01+00:00

I am designing a helper method that does lazy loading of certain objects for

  • 0

I am designing a helper method that does lazy loading of certain objects for me, calling it looks like this:

public override EDC2_ORM.Customer Customer {     get { return LazyLoader.Get<EDC2_ORM.Customer>(             CustomerId, _customerDao, ()=>base.Customer, (x)=>Customer = x); }     set { base.Customer = value; } } 

when I compile this code I get the following warning:

Warning 5 Access to member ‘EDC2_ORM.Billing.Contract.Site’ through a ‘base’ keyword from an anonymous method, lambda expression, query expression, or iterator results in unverifiable code. Consider moving the access into a helper method on the containing type.

What exactly is the complaint here and why is what I’m doing bad?

  • 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. 2026-05-11T00:44:02+00:00Added an answer on May 11, 2026 at 12:44 am

    ‘base.Foo’ for a virtual method will make a non-virtual call on the parent definition of the method ‘Foo’. Starting with CLR 2.0, the CLR decided that a non-virtual call on a virtual method can be a potential security hole and restricted the scenarios in which in can be used. They limited it to making non-virtual calls to virtual methods within the same class hierarchy.

    Lambda expressions put a kink in the process. Lambda expressions often generate a closure under the hood which is a completely separate class. So the code ‘base.Foo’ will eventually become an expression in an entirely new class. This creates a verification exception with the CLR. Hence C# issues a warning.

    Side Note: The equivalent code will work in VB. In VB for non-virtual calls to a virtual method, a method stub will be generated in the original class. The non-virtual call will be performed in this method. The ‘base.Foo’ will be redirected into ‘StubBaseFoo’ (generated name is different).

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

Sidebar

Ask A Question

Stats

  • Questions 64k
  • Answers 64k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I would discourage you from trying regions. The problem is… May 11, 2026 at 10:44 am
  • added an answer Many ways lead to Rome: 1 way: LOAD DATA LOCAL… May 11, 2026 at 10:44 am
  • added an answer 'WHERE '' & str_a & '' '' & str_b &… May 11, 2026 at 10:44 am

Related Questions

I am designing a helper method that does lazy loading of certain objects for
I am designing a new System and I have a lot of Interfaces that
I am designing a game to be played in the browser. Game is a
I am designing a class for log entries of my mail server. I have
I am designing a contact management system and have come across an interesting issue
I am designing a simple internal framework for handling time series data. Given that
I am designing a system which will at some point require to send email
I am designing a web app and I intent to embed data on an
I am designing a web site but it is behind a firewall and such
I am designing a psychology experiment with java applets. I have to make my

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.