1

I need to set a breakpoint in the ConfigureAuth to debug an issue we are having.
The following article claims you can set a breakpoint but this article is C# and I need this to work in VB.NET
https://coding.abel.nu/2014/06/understanding-the-owin-external-authentication-pipeline/
I converted this:

app.Use(async (context, next) =>
{
  await next.Invoke();
});

To this:

app.Use(Async Function(context, [next])
            Await [next].Invoke()
        End Function)

but I get an error the following error:

Parameter count mismatch.

Here are a couple of problems.

  1. I assumed that "context" was "Microsoft.Owin.OwinContext" but that is an invalid assumption. "context" in the VB project I think it is "Microsoft.Owin.Security.Cookies.CookieAuthenticationMiddleware"
  2. I don't know what the type is for "next"
goroth
  • 2,510
  • 5
  • 35
  • 66

3 Answers3

1

Found here Is it possible to debug Global.asax?
per John Kelly

This lets me step into it from global.asx

  1. Attach the debugger to the IIS process.
  2. Open the global.asax file and put in a breakpoint.
  3. Add a space to the web.config file and save the file (this causes the current web application to reset);
  4. Refresh / goto a web page on the site.
  5. watch in amazement when the debugger stops at your breakpoint. :)
Community
  • 1
  • 1
goroth
  • 2,510
  • 5
  • 35
  • 66
1

I was having the same Parameter count mismatch issue and came across this https://github.com/aspnet/AspNetKatana/issues/84

Essentially the VB equivalent is written like this

AppBuilderUseExtensions.Use(app, Async Function(context, [next]) As Task
                                     Await [next]()
                             End Function)
cableguy
  • 51
  • 8
  • Thank you! I had converted the 'standard app.use' code from a C# app and could not work out why it was not working. This solved it for me in VB. – Stu Price Dec 07 '21 at 20:13
0

You can also use a Visual Studio plugin Attach To All The Things to attach to IIS or IIS Express, which enables you to set a breakpoint in Global.asax or the Startup.cs class.

See https://marketplace.visualstudio.com/items?itemName=thebread.AttachToAllTheThings

Stef Heyenrath
  • 9,335
  • 12
  • 66
  • 121