Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF Exception
Hi
 
I get the below exception when I try to add/insert/remove to a collection (or any operation that changes the collection).
The collection is initialized and the item inserted is not null and of the same type as the collection T.
 
Can any one give me a clue as to why this happens?
 
Thanks
 
The runtime has encountered a fatal error. The address of the error was at 0x60f41744, on thread 0x231c. The error code is 0x80131623. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
 
Update:
The collection is an ObservableCollection and I managed to get down to know that it happens on the notify part of the collection changed.
This happens on the UI thread inside a task with the TaskScheduler.FromCurrentSynchronizationContext() option.
 
The weird thing is if I remove this (TaskScheduler.FromCurrentSynchronizationContext()) option the add/insert/remove action, all seems to work good.
Posted 6-Jan-13 1:34am
Shahare860
Edited 6-Jan-13 3:17am
v2
Comments
OriginalGriff at 6-Jan-13 6:50am
   
Without the relevant code fragments? Probably not.
Use the "Improve question" widget to edit your question and provide better information.
Shahare at 6-Jan-13 8:17am
   
I improved my current findings but I`m not happy with the not understanding part.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Are you manipulating the collection from an asynch event handler running on another thread?
 
Error 0x80131623 is COR_E_FAILFAST - which is a very generic error generated by Environment.FailFast() which is called when your application is causing an internal invariant to be violated.
 
Best regards
Espen Harlinn
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 381
1 Sergey Alexandrovich Kryukov 265
2 Praneet Nadkar 237
3 Marcin Kozub 225
4 /\jmot 189
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100