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 7184465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:12:29+00:00 2026-05-28T18:12:29+00:00

I think this one is silly question, but it was a bit strange for

  • 0

I think this one is silly question, but it was a bit strange for me to discover that i cant do the following:

EditingItem.FROM = EditingItem.TO = DateTime.Now;   // FROM, TO are DateTime   

after this manipulations, the program sometimes hangs, but sometimes it just works as i thought it should.
Here is the exception:

ContextSwitchDeadlock was detected Message: The CLR has been unable to
transition from COM context 0x478b80 to COM context 0x478dd0 for 60
seconds. The thread that owns the destination context/apartment is
most likely either doing a non pumping wait or processing a very long
running operation without pumping Windows messages. This situation
generally has a negative performance impact and may even lead to the
application becoming non responsive or memory usage accumulating
continually over time. To avoid this problem, all single threaded
apartment (STA) threads should use pumping wait primitives (such as
CoWaitForMultipleHandles) and routinely pump messages during long
running operations.

Changing the code to:

  EditingItem.FROM = DateTime.Now;
  EditingItem.TO = DateTime.Now;

helps in my situation.

Cant google the question properly, to see explanation, so can you help and explain why whis expression is wrong?
PS more discussion in comments.
Here are some results from experiments:

DateTime d = DateTime.Now;
EditingItem.FROM = EditingItem.TO = d;//hang

added loop for timing:

for (int i = 0; i < 100000; i++)
{
   i++;
}

DateTime d = DateTime.Now;
EditingItem.FROM = EditingItem.TO = d;//hang
  • 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-05-28T18:12:29+00:00Added an answer on May 28, 2026 at 6:12 pm

    Your problem is that there seems to be a lock happening – again code not provided so just a guess – where object is locked so that assigning a property from another property will deadlock on itself.

    If you are dealing with COM, this can be maginfied by the fact that COM objects are Single-Threaded Apartment objects.

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

Sidebar

Related Questions

Google results on this one are a bit thin, but suggest that it is
Forgive me if this is a silly question but I'm afraid that I don't
This I think may be a silly question, but I have become quite confused
I'm afraid that this is a very silly question, but I must be missing
I think this is going to be one of those simple-when-you-see-it problems, but it
This question is related to this one , though I think I was a
This might sound like a silly question but is there a manual or a
Hopefully this is a silly question but my brain is fried and I can't
Okay, Now admittedly this sounds like a silly question; But, I actually have a
Okay, this might be a very silly beginner question, but: I've got an ClassA,

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.