If you work with COM objects you may accidently attempt to use or create COM object in one thread and accidently use it in another thread. And then unless original thread is free threaded .NET will attempt to switch to original thread.
And from there you will see one of the following outcomes.
- If that thread pump messages, then .NET will attempt to send message to that thread to switch. Sometimes it can lead to deadlock or just long delay if that thread is busy. Main thread usually pumps messages, so usually .NET able to switch to main thread.
- You will get error that Interface is not supported. Sometimes you will get that cryptic message even that interface is clearly supported. You will get this message because .NET don’t know how to marshal to original thread, specially if this is some background thread. In this case .NET is not able to marshal, so it will ask object itself to marshal by requesting few interfaces and one of them is IMarshal. Most objects do not support these interfaces and you will see that error message
- When original thread was terminated, or if that was thread pool thread and it will clean its state on next request. In this case you will get this one from MDA: Managed Debugging Assistant 'DisconnectedContext' : 'Transition into COM context 0xed058 for this RuntimeCallableWrapper failed with the following error: The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED)). This is typically because the COM context 0xed058 where this RuntimeCallableWrapper was created has been disconnected or it is busy doing something else. Releasing the interfaces from the current COM context (COM context 0xec968). This may cause corruption or data loss. To avoid this problem, please ensure that all COM contexts/apartments/threads stay alive and are available for context transition, until the application is completely done with the RuntimeCallableWrappers that represents COM components that live inside them.'
[...Read More]
Few days ago, I was investigating why one of our servers in cloud stops responding. Basically, it was so bad that we have to force restart server. After some investigation I found that there is IIS server that processes requests and some requests starts external application. And in certain situations, this process starts to allocate a lot of non-paged pool memory. About 100 megabytes per second.
Non-paged pool is special type of memory that is never paged out to disk. It is must be non-paged because at certain times of processing requests paging is unavailable. For example, when interrupt is processing. Also, for example disk driver structures should be non-paged because obviously they cannot be paged out. And in general,
[...Read More]
Few days ago, my friend asked me to check iPad as it does not charge and does not work well. And today I got time to check.
Initially, I found that it does charge, it was discharged and displayed picture with battery. And as result it just take as lot of time to charge as it charges very slowly as there is pretty much no software control over charge current, duration etc. Honestly Apple can do better to put some text on that screen that explains what’s going on.
After it did charge it starts but showing famous Connect to iTunes picture. Ok, iTunes time. iTunes told me that I have to either Update it or Restore. Initially I did
[...Read More]
Recently I was investigating deadlock related to COM in .NET. In we have some engine that executes asynchronous requests. It is written in native code and use COM like interfaces. Nothing like true COM where you have some registration etc. We just use COM like interfaces for interop between .NET and native code. And I have following code:
00 00000001`4eeed7d8 00007ff9`184b8027 ntdll!NtWaitForMultipleObjects+0x14
01 00000001`4eeed7e0 00007ff9`1a583905 KERNELBASE!WaitForMultipleObjectsEx+0x107
02 00000001`4eeedae0 00007ff9`1a583665 combase!MTAThreadWaitForCall+0x115
03 00000001`4eeedbb0 00007ff9`1a5329c7 combase!MTAThreadDispatchCrossApartmentCall+0xc5
04 (Inline Function) --------`-------- combase!CSyncClientCall::SwitchAptAndDispatchCall+0x325
05 00000001`4eeedc00 00007ff9`1a581e94 combase!CSyncClientCall::SendReceive2+0x407
06 (Inline Function) --------`-------- combase!SyncClientCallRetryContext::SendReceiveWithRetry+0x25
07 (Inline Function) --------`-------- combase!CSyncClientCall::SendReceiveInRetryContext+0x25
08 00000001`4eeede00 00007ff9`1a530900 combase!DefaultSendReceive+0x64
09 00000001`4eeede60 00007ff9`1a581bc4 combase!CSyncClientCall::SendReceive+0x330
0a 00000001`4eeee090 00007ff9`1a5a2e4e combase!CClientChannel::SendReceive+0x84
0b 00000001`4eeee100 00007ff9`1b1d8b95 combase!NdrExtpProxySendReceive+0x4e
0c 00000001`4eeee130 00007ff9`1a5a0cbb rpcrt4!NdrpClientCall3+0x395
0d 00000001`4eeee490 00007ff9`1a61c5f2 combase!ObjectStublessClient+0x13b
0e 00000001`4eeee820 00007ff9`1a5268a9 combase!ObjectStubless+0x42
0f 00000001`4eeee870 00007ff9`1a59cd6f combase!CObjectContext::InternalContextCallback+0x259
10 00000001`4eeee990 00007ff8`c79fed60 combase!CObjectContext::ContextCallback+0x7f
11 00000001`4eeeea30 00007ff8`c79ffb42 clr!CtxEntry::EnterContext+0x295
12 00000001`4eeeec10 00007ff8`c789de97 clr!IUnkEntry::UnmarshalIUnknownForCurrContext+0xbd
13 00000001`4eeeecc0 00007ff8`c789dde2 clr!IUnkEntry::GetIUnknownForCurrContext+0x20cd8f
14 00000001`4eeeecf0 00007ff8`c76924c1 clr!RCW::SafeQueryInterfaceRemoteAware+0x20bab2
15 00000001`4eeeed50 00007ff8`c75f1f79 clr!RCW::CallQueryInterface+0x8d
16 00000001`4eeeedc0 00007ff8`c75f226f clr!RCW::GetComIPForMethodTableFromCache+0xb5
17 00000001`4eeeee80 00007ff8`c75f2716 clr!ComObject::SupportsInterface+0xfe
18 00000001`4eeeeff0 00007ff8`c75f2642 clr!Object::SupportsInterface+0x9e
19 00000001`4eeef060 00007ff8`c75f255a clr!UnmarshalObjectFromInterface+0x7a
1a 00000001`4eeef0a0 00007ff8`69a6a493 clr!StubHelpers::InterfaceMarshaler__ConvertToManaged+0xca
1b 00000001`4eeef240 00007ff8`c74b2e89 0x00007ff8`69a6a493
1c 00000001`4eeef290 00007ff8`c75f13b3 clr!COMToCLRDispatchHelper+0x39
1d 00000001`4eeef2c0 00007ff8`c74b2de7 clr!COMToCLRWorker+0x1b4
1e 00000001`4eeef380 00000001`3aeb49fb clr!GenericComCallStub+0x57
1f 00000001`4eeef410 00000001`3aeb4721 AsyncEngine.AsyncResult.PerformCallback+0x4b
[...Read More]
Last time when I wrote about Microsoft Skype, I was quite unhappy about it. But I was expecting that Microsoft will fix eventually all these problems. But unfortunately, not only they didn’t fix it, they made it pretty much unusable for me.
Let me explain my setup. I have home and work computer that running Skype with the same account. My iPhone also has Skype with the same account.
And about 2-3 month ago I found following problem on any of my computer: I typed some text and press Send button. Text disappeared from input text box, but it wasn’t added to list of my messages. If I restarted Skype, then I see that message added to list of
[...Read More]
At current day there are following most popular browsers for desktop: Internet Explorer, Google Chrome, Firefox and old Microsoft Edge. New Microsoft Edge uses Chromium project and many other browsers like Opera uses it too. Chromium project itself based on WebKit project that Apple uses for browser on Mac, iPhone and iPad. Internet Explorer is dead and only used in some corporations that developed a lot of inhouse software that requires it and port code to another browser will require a lot of money and time. Old Microsoft Edge will be quickly phased out. As result huge share of browsers will be taken by one of the variants of Chromium that is WebKit. And if we consider mobile browsers, that
[...Read More]
5 years ago, I bought iPad Air 2 for my wife. It worked just fine but about 2 years ago I started to get complains from her about battery. She is using iPad only to read books and she was saying that iPad can discharge battery in just few hours. Reading books is not something that should discharge batter that rapidly. So, I started investigation.
That time iPad has iOS 11 and I did install few tools that show battery degradation and battery was at perfect condition. I did check if battery charge is measured correctly and iPad switched itself off at about 0%. I did calibrate battery and many other things and asked my wife to check it. She
[...Read More]
Few days I got a complain from one of the users that he cannot install Windows update. I came and checked it and I can see that it is failed with error code 0x80073712. And then I started to research this problem. On one of the pages I found recommendation to execute following commands:
DISM.exe /Online /Cleanup-image /Scanhealth
DISM.exe /Online /Cleanup-image /Restorehealth
Well, this is simple, and I did execute these commands. Both these commands failed with error “The WOF driver encountered a corruption in the compressed file's Resource Table”. Interesting. Then I started searching for this error and found recommendation to execute following command:
sfc /scannow
After I executed this command I got this error
[...Read More]
I don’t know how I missed it but by default OpenWrt router will be accessed via http. Http means that when you login, data will be transmitted via plain text and in many cases it can received by other devices in your network (depending on how you access router, type of router and what is you network configuration).
Many people can say that they have only trusted devices in your network. But devices have vulnerabilities. You never know if your device is vulnerable. Sometimes you may add friend of guest to your network. You have no idea if they update their devices or if they care about security at all. And in any case defense should be layers, so failure
[...Read More]