top of page
Search

[Post Event]: .NET Developer Days, Warsaw, October 2019 – Part III

Internals of Exceptions – Adam Furmanek

  1. unfortunately, I had to skip this as the cold I caught did not let me sleep so the first thing in the morning I went to the nearest pharmacy which was in the opposite direction of the conference.

Most Common Mistakes in Using Tasks and in Asynchronous Code – Jiri Cincura


  1. Callbacks are hell => painful

  2. CPU bound – Parallel.For, Task.Run

  3. IO bound – async (real async code) – anything which is not CPU bound

  4. Due to scalability – creating and destroying threads take resources. 1 mb per thread creation on stack.

  5. Avoid tasks for simple operations – e.g . Task.Run(() => a + b) will be slower. Instead do Task.FromResult(a+b)

  6. Task is reference type, ValueTask is on stack => can be easier to work with it

  7. TaskCreationOptions.LongRunning – creates task and first await destroys it

  8. Use a queue processor. Use IsBackgrond to true to close the thread after closing app => better than abusing tasks

  9. Wait is blocking – waits for completion

  10. Await jumps back here as soon as the operation is completed – continuations and coroutines

  11. Sync over async, not a good idea – just use sync api directly

  12. Use async await everywhere, don’t use obj.AsyncMethod.Result from sync code

  13. Careful with Synchronization context

  14. Async everywhere / all the way up the code, don’t mix async with sync methods

  15. Use factory if you need async in constructor

  16. Async void is bad as the caller has nothing from the called method

  17. Beware of blocking

  18. Don’t cache the task itself


Overall impression: good content, good examples

Debugging Asynchronous Scenarios in .NET – Christophe Nasarre, Kevin Gosse

Thread pronounced as fret again 🙂



  1. ActionBlock .NET implementation of producer/consumer

  2. ActionBlock.Complete() – stop getting new things, finish processing what it began

  3. Use memory window visual studio to get address of specific object, find it in windbg

  4. Sosex (SOS Ex not So SEX) extension for windbg

  5. Find instances of ActionBlock to understand what happened

  6. Windbg cmd – printexception

  7. debug session with windbg


Overall impression: awesome session, hands on debugging, I hope I can get the recording though

Lunch Break – Highlight of the whole conference for me

As I wondered around the hall after I ate, I went to find some hot water so I can prepare my Coldrex drink to fight the cold I caught. I went by a table where there were several participants chatting + another guy, who was not engaged in the group, was more “isolated” at the table. I think that this guy had just taken one a available seat at a partially occupied table. This guy was heavily texting on his smartphone.

This guy, seemed very familiar, but from where? Then it hit me, it was Jeffrey Snover, father of PowerShell. At first I could not believe it, performed a google search and double checked. It was him! I was like OMFG :). He just stood there at the table, texting, while all other participants were too engaged in chit chat that they hadn’t noticed who joined their table (bummer for them, yay for me :D).

What to do? I wanted to meet him, but there I was with a cup of hot Coldrex to fight the cold. I decided to drink it ASAP and do something. It was too hot, went to the water cooler, added some cold water, drank a bit, added some more cold water until it was safe to drink. Bottoms up and I was back at the table in like under 2 minutes.

Mr. Snover was still busy on his smartphone. I asked if the seat next to him was taken and if I could join the table. The participants group responded that I can join, the seat was available (see setup below).


Table setup


I waited for a while for Mr. Snover to finish, as I didn’t want to be rude and interrupt his work there.

After a few minutes, the conference big raffle started, lots of talking, prizes etc. Then, Mr. Snover put his phone down. Just my luck, it was noisy but went for it :). I introduced myself and politely asked if he could provide some career advice. He was very open to help.

We talked for several minutes and I managed to further ask for a list of the most influential books he ever read. I received a list of three books (technical, business, leadership), which I’m willing to share with you => just contact me and I’ll share the titles. I want to see how many people are really interested in this.

Needless to say, I was honored to meet the father of PowerShell and get advice from him. This was the highlight of the conference for me! The final keynote he delivered was like a sequel to the conversation we just had, it “clicked”. Keep reading, I have highlights from the closing keynote as well.

Turbocharged: Writing High Performance C# and .NET Code – Steve Gordon


  1. Performance is contextual

  2. Performance and readability compromise – take into consideration based on how many people maintain the code and how often

  3. We need measurements – optimization cycle – use realistic scenarios – start with worst performers

  4. Optimize and measure again to prove that the change is faster

  5. App performance measure

  6. Visual studio diagnostic tools – debugging

  7. visual studio profiling / PerfView / dotTrace / dotMemory

  8. Ilspy / just decompile / dot peek

  9. Monitor production metrics and monitoring

  10. Benchmark code with Benchmark .NET – library for net micro benchmarking – available via nuget

  11. High precision

  12. Extra data available

  13. Compare performance on different platforms, architectures, jit versions and gc modes

  14. Similar with unit test, add attributes eg MemoryDiagnoser

  15. Get summary of execution in nanoseconds

  16. See in what generation in heap do they live for before going in next gen for gc

  17. Span<t>

  18. Cannot be sent as param, can use Memory<t> and access span from there

  19. Original code ~ 1 page length vs optimized code ~ 4-5 page length – maybe more => optimized code is ugly 🙂


Overall impression: good content, good explanations

What Every Developer Should Know About SQL Server Performance – David Berry


  1. Find the slow query (think of orm)

  2. Log sql query from ef

  3. Miniprofiler

  4. Dynamic management views

  5. Sql server profiling

  1. If query is slow, get execution plan of query

  2. Lifecycle of sql statement: parse, query optimization, execution phase

  3. Explore execution plan: button from SQL Management Studio => look at cost to compare multiple statements

  4. Compare with other statements from system to check which ones are slow

  5. Exec plan is read from right to left

  6. Green text helps us with contextual advice (eg missing index)

  7. SQL saves data in a tree structure

  1. How SQL uses indexes

  2. Another tree structure organised by another criteria (eg id)

  3. Create index significantly improves query perf (costs)

  1. This guy had an interesting twist, instead of aaaa hhhmmm at the end of a sentence he produced a sound similar with snoring, I thought there was somebody snoring behind me at first 🙂

  2. Enable these via SQL commands

  3. Set statistics io on – show more data regarding queries

  4. Set statistics time on – show ms required to parse, compile, and execute statements

  5. Look for scan operations => as that implies you are not using data efficiently

  6. Clustered index scan = reads all table

  7. First columns of table should appear most frequently in where clauses and should me made into indexes

  8. Index selectivity – if index is not unique, performance is poor. Eg have index on email address instead of sex (m/f, status codes)

  9. Create indexes on foreign keys and search columns is a good idea. The primary key is indexed by SQL server by default => great start with only these

  10. Dynamic management views

  11. Queries available on github

  12. An index is costly, more indexes = more cost. We need to keep a balance on the maintenance cost for an index

  13. Index usage statistics – candidates to be removed after investigating why they were created

  1. SQL tracing

  2. SQL profiler is obsolete and affects your system

  3. Use Extended events – ETW (Event Tracing for Windows) based are the new way to investigate – from SQL management studio – create new session from UI, choose a template, apply filters for narrowing results

  4. Performance best practices

  5. Test with a production size

  6. Keep SQL statements focused

  7. Single Responsibility Principle applies to queries too, always leads to bad performance when querying too many things at once – d’oh


Overall impression: a nice refresh with some more additions regarding how SQL server works and how to make queries faster. Very good content, enjoyed it

Closing Keynote: M365: The People OS for Your Organization – Jeffrey Snover


  1. Ship frequent – it would wait until sp1, 1 year, next version etc before installing it to organizations. Fast delivery solves this issue

  2. Focus of Microsoft: Azure and Office 365

  3. 10x amplification => reference to The 10x Rule book?

  4. Microsoft pushes new versions to everyone as is easier to maintain => previously this did not happen => referred as broken ecosystem due to multiple versions they needed to maintain

  1. M365 – the people OS

  2. based on integrations => brings value to customers, helps them being successful, this can be monetized. For every dollar which goes to Microsoft, partners earn 10. Create dependencies on integrations to keep users focused and in their ecosystem.

  3. MS Graph – common api that brings all together. Resource oriented graph, rest. Uses odata

  4. Give awkward name so people don’t understand as this gives the opportunity to explain and avoids assumptions – Microsoft Substrate

  5. Teams has a feature to transcribe audio and save it to substrate

  6. Mechanism to add other apps mandatory to any os (plus some default tools)

  7. M365 protects resources of the people – users, docs, messages, calendars

  8. Virtual water cooler (discussions) – discover recent files of others

  9. Microsoft mission is to help others achieve more


Overall impression: Pretty cool, even though it was a marketing presentation, it made sense and it also “clicked” with my previous discussion with Mr. Snover.

And this was the conference! I hope you enjoyed the summaries, it took some time to put them together :). Really hoping to go to this conference or others next year!


Comments


bottom of page