bradwilson,
@bradwilson@mastodon.social avatar

I think I'd expect the call to ReplaceNode to have failed if it wasn't able to replace the node, but Roslyn isn't always helpful in that regard. Normally I'd dig into this in the debugger via the unit test, but the unit test passes. So I'm a bit stumped about what to do next. I'm not sure how to debug this indirectly (i.e., let it fail "for real" inside Visual Studio and debug it there), since it doesn't actually throw in a catchable way.

Any Roslyn experts here?

3/3

KirillOsenkov,
@KirillOsenkov@mastodon.social avatar

@bradwilson have you enabled first-chance exceptions in the debugger when you debug the unit-test? Debug -> Windows -> Exception Settings, check all managed exceptions, and disable Just My Code in Tools Options

bradwilson,
@bradwilson@mastodon.social avatar

@KirillOsenkov The only exceptions I see are "Could not load file or assembly" for "Microsoft.CodeAnalysis.Features", "Microsoft.CodeAnalysis.CSharp.Features", and "Microsoft.CodeAnalysis.VisualBasic.Features". (I have no references to any of these.) Beyond that, everything runs and passes in the unit test as expected.

KirillOsenkov,
@KirillOsenkov@mastodon.social avatar

@bradwilson just tried locally, seeing the same. Try inserting a Debugger.Launch() in the constructor of AssertSingleShouldBeUsedForSingleParameterFixer , run it in the real VS, and when it shows the JIT debugger dialog, attach to that VS, and enable first-chance exceptions there.

KirillOsenkov,
@KirillOsenkov@mastodon.social avatar

@bradwilson is this the thing that fails?

How do you normally observe the failure? what are the symptoms you're seeing?

bradwilson,
@bradwilson@mastodon.social avatar

@KirillOsenkov Yes. Did you figure out what's wrong?

bradwilson,
@bradwilson@mastodon.social avatar

@KirillOsenkov Clicking the lightbulb (or the keyboard shortcut) shows this:

bradwilson,
@bradwilson@mastodon.social avatar

@KirillOsenkov I finally gave up trying to figure out why I couldn't do "InsertAfter" on something that I'd just inserted (or used in ReplaceNode). Instead I collected all the statements I wanted, did one InsertBefore and then RemoveNode'd the thing I wanted to remove.

Makes no sense, but it doesn't crash any more which is all I care about.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • dotnet
  • DreamBathrooms
  • ngwrru68w68
  • modclub
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • GTA5RPClips
  • JUstTest
  • tacticalgear
  • normalnudes
  • tester
  • osvaldo12
  • everett
  • cubers
  • ethstaker
  • anitta
  • provamag3
  • Leos
  • cisconetworking
  • megavids
  • lostlight
  • All magazines