Something wrong with "Use 'throw' expression"

Answered

I'm running ReSharper 2016.3.2

Considering the following code

if (store == null) throw new ArgumentNullException(nameof(store));

this.store = store;

RS's suggestion is to replace the 1st line with Use 'throw' expression, which will looks like this after use

this.store = store ?? throw new ArgumentNullException(nameof(store));

However, after refactoring ?? is highlighted with an error "Expression expected"

Could you please advise if there's some way to fix that?

2 comments
Comment actions Permalink
Official comment

Hello Ivan,

Please try disabling ReSharper via Tools | Options | ReSharper Ultimate | Suspend Now - will "Use 'throw' expression" suggestion still be in Code Editor? It looks like a Roslyn suggestion.

ReSharper will support such construction in R# 2017.1 https://youtrack.jetbrains.com/issue/RSRP-461788. 

Thanks! 

Please sign in to leave a comment.