Dev Tunnels: A Game Changer for Mobile Developers


  • Staff

 Microsoft .NET Blog release:

Are you a mobile application developer who faces challenges when building a back end for your apps? If you’re using .NET, particularly ASP.NET Core, then you’ve probably encountered the issue of debugging locally on your machine versus using emulators or physical devices. But fear not, because Visual Studio 2022 has introduced a great feature called Dev Tunnels that change your development process forever!


The Problem: Localhost vs Emulators/Devices​

When you’re developing mobile applications, having a smooth debugging experience is crucial. However, things can get a little tricky when you need to test your app on emulators or physical devices. These devices have their own network stack and often can’t directly communicate with your local machine. This becomes a roadblock when trying to access the local back end of your app running on localhost. While it is possible, it is quiet a bit of work to get setup and maintain as you work with several services.

Enter Dev Tunnels​

Dev Tunnels is a game changer for mobile developers and even web developers. It provides a solution to the problem mentioned above by creating a unique URL that acts as a loopback to your local machine. This URL is accessible from the internet, allowing you to expose localhost to emulators, devices, or even share it with others. It has several authentication and access options based on what your requirements are.

Setting Up Dev Tunnels in Visual Studio 2022​

Dev Tunnels was officially released with Visual Studio 2022 v17.6, so simply update to the latest version and you are ready to go. You can setup a new Dev Tunnel from the debug dropdown menu inside of Visual Studio to configure it for the active project.

Debug dropdown showing dev tunnels option with Create tunnel selected

Upon opening the Dev Tunnels window, you’ll see options to create tunnels. You can choose a name for the tunnel, specify its lifespan (persistent or temporary), and decide whether it should be private, organizational, or public. The public option allows the tunnel to be accessed by anyone on the internet with the URL.

Configuration window for a dev tunnel

After creating a tunnel, run the backend and you’ll be provided with a unique URL for your local back end. You can also open the Dev Tunnels window, to see all of your tunnels and change configurations.

Browser showing a dev tunnel url

Now test out your API, call it from your mobile app, or debug it with a colleague. Set a breakpoint in your API and when the API is called it will get hit because the tunnel is talking to your local machine.

How I Use Dev Tunnels with .NET MAUI​

Suppose you have an ASP.NET Core web API back end running on your local machine and a .NET MAUI application that needs to communicate with this back end. With Dev Tunnels, you can easily expose localhost to the internet and interact with your back end from emulators or devices.

By running the ASP.NET Core back end and creating a Dev Tunnel, you’ll be assigned a unique URL. You can then use this URL in your .NET MAUI application to connect to the back end. Whether you’re using an Android emulator, an iOS device, or any other platform, Dev Tunnels will allow you to seamlessly debug and access your back end.

Other Use Cases for Dev Tunnels​

Dev Tunnels isn’t limited to just mobile application development. It can also be utilized for debugging Azure functions, sharing local web projects with colleagues, build Teams apps, and much more. The flexibility and convenience it offers make it a valuable tool for developers working with various technologies.

Beyond Visual Studio with the Dev Tunnels CLI​

No Visual Studio? No Problem? Dev Tunnels have a full CLI that can run everywhere enabling unique scenarios from your favorite code editors and more.


Conclusion​

Dev Tunnels in Visual Studio 2022 have revolutionized how I debug my applications and I think it will for you as well. By providing a unique URL that acts as a tunnel to your local machine, you can easily expose localhost and access your back end from emulators or devices. This feature brings convenience and efficiency to the development process, allowing for seamless testing and debugging.

So, why not give Dev Tunnels a try? Get the latest version of Visual Studio 2022, create your own tunnels, and experience the benefits firsthand. Share your thoughts in the comments below and let us know how Dev Tunnels have enhanced your development workflow. Happy coding!



 Source:

 

Attachments

  • Visual_Studio.png
    Visual_Studio.png
    8.9 KB · Views: 0
DEV Tunnels would be a great way for somebody like MS to "steal"... apps?

Honestly, it kind of worries me that all roads lead to Microsoft.
If it isn't already the case, soon, every app will sit only on MS servers.


Then.... Skynet will be born. o_O
They won't even "need" Terminators. MS will just be able to push a button.
And the user will be sent back to the 50's.

Color me concerned.


Microsoft:

Cheeseburger Cat - blank.png
 

My Computers

System One System Two

  • OS
    Win 11 Home ♦♦♦22631.3527 ♦♦♦♦♦♦♦23H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Built by Ghot® [May 2020]
    CPU
    AMD Ryzen 7 3700X
    Motherboard
    Asus Pro WS X570-ACE (BIOS 4702)
    Memory
    G.Skill (F4-3200C14D-16GTZKW)
    Graphics Card(s)
    EVGA RTX 2070 (08G-P4-2171-KR)
    Sound Card
    Realtek ALC1220P / ALC S1220A
    Monitor(s) Displays
    Dell U3011 30"
    Screen Resolution
    2560 x 1600
    Hard Drives
    2x Samsung 860 EVO 500GB,
    WD 4TB Black FZBX - SATA III,
    WD 8TB Black FZBX - SATA III,
    DRW-24B1ST CD/DVD Burner
    PSU
    PC Power & Cooling 750W Quad EPS12V
    Case
    Cooler Master ATCS 840 Tower
    Cooling
    CM Hyper 212 EVO (push/pull)
    Keyboard
    Ducky DK9008 Shine II Blue LED
    Mouse
    Logitech Optical M-100
    Internet Speed
    300/300
    Browser
    Firefox (latest)
    Antivirus
    Bitdefender Internet Security
    Other Info
    Speakers: Klipsch Pro Media 2.1
  • Operating System
    Windows XP Pro 32bit w/SP3
    Computer type
    PC/Desktop
    Manufacturer/Model
    Built by Ghot® (not in use)
    CPU
    AMD Athlon 64 X2 5000+ (OC'd @ 3.2Ghz)
    Motherboard
    ASUS M2N32-SLI Deluxe Wireless Edition
    Memory
    TWIN2X2048-6400C4DHX (2 x 1GB, DDR2 800)
    Graphics card(s)
    EVGA 256-P2-N758-TR GeForce 8600GT SSC
    Sound Card
    Onboard
    Monitor(s) Displays
    ViewSonic G90FB Black 19" Professional (CRT)
    Screen Resolution
    up to 2048 x 1536
    Hard Drives
    WD 36GB 10,000rpm Raptor SATA
    Seagate 80GB 7200rpm SATA
    Lite-On LTR-52246S CD/RW
    Lite-On LH-18A1P CD/DVD Burner
    PSU
    PC Power & Cooling Silencer 750 Quad EPS12V
    Case
    Generic Beige case, 80mm fans
    Cooling
    ZALMAN 9500A 92mm CPU Cooler
    Mouse
    Logitech Optical M-BT96a
    Keyboard
    Logitech Classic Keybooard 200
    Internet Speed
    300/300
    Browser
    Firefox 3.x ??
    Antivirus
    Symantec (Norton)
    Other Info
    Still assembled, still runs. Haven't turned it on for 13 years?
This is just effectively creates a VPN tunnel between your mobile device and your local machine, not sure how it means that Microsoft will be able to steal your mobile app(s)?

Besides that, Microsoft now own GitHub which arguably one of the largest code repositories so they could very simply "steal" any app code if they really wanted to.

Dev Tunnels sounds like a very useful feature which I wish I had access to when I had to develop a mobile app which connected to one of our web APIs.
 

My Computer

System One

  • OS
    Windows 11, Windows 10, Linux Fedora Cinnamon
This is just effectively creates a VPN tunnel between your mobile device and your local machine, not sure how it means that Microsoft will be able to steal your mobile app(s)?

Besides that, Microsoft now own GitHub which arguably one of the largest code repositories so they could very simply "steal" any app code if they really wanted to.

Dev Tunnels sounds like a very useful feature which I wish I had access to when I had to develop a mobile app which connected to one of our web APIs.




Yes, all these new fangled MS things sound useful. Azure, Teams, Copilot, DEV Tunnels, Github, Cloud... etc., etc., etc.
And all these things will live on MS servers.

And let's not continue to believe that MS can't just read anything that passes through those Apps, as easily as reading a book.
I'd bet they have entire depts. that do nothing BUT that.


At the water cooler...

MS1: Hey Fred, you should see the nifty little tool that came across my desk today.

MS2: Lemme guess. You're gonna grab it, call it an MS App and sell it in the MS Store?





I'm gonna make some t-shirts to sell. I'm gonna print on them...


LOCAL.png
 
Last edited:

My Computers

System One System Two

  • OS
    Win 11 Home ♦♦♦22631.3527 ♦♦♦♦♦♦♦23H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Built by Ghot® [May 2020]
    CPU
    AMD Ryzen 7 3700X
    Motherboard
    Asus Pro WS X570-ACE (BIOS 4702)
    Memory
    G.Skill (F4-3200C14D-16GTZKW)
    Graphics Card(s)
    EVGA RTX 2070 (08G-P4-2171-KR)
    Sound Card
    Realtek ALC1220P / ALC S1220A
    Monitor(s) Displays
    Dell U3011 30"
    Screen Resolution
    2560 x 1600
    Hard Drives
    2x Samsung 860 EVO 500GB,
    WD 4TB Black FZBX - SATA III,
    WD 8TB Black FZBX - SATA III,
    DRW-24B1ST CD/DVD Burner
    PSU
    PC Power & Cooling 750W Quad EPS12V
    Case
    Cooler Master ATCS 840 Tower
    Cooling
    CM Hyper 212 EVO (push/pull)
    Keyboard
    Ducky DK9008 Shine II Blue LED
    Mouse
    Logitech Optical M-100
    Internet Speed
    300/300
    Browser
    Firefox (latest)
    Antivirus
    Bitdefender Internet Security
    Other Info
    Speakers: Klipsch Pro Media 2.1
  • Operating System
    Windows XP Pro 32bit w/SP3
    Computer type
    PC/Desktop
    Manufacturer/Model
    Built by Ghot® (not in use)
    CPU
    AMD Athlon 64 X2 5000+ (OC'd @ 3.2Ghz)
    Motherboard
    ASUS M2N32-SLI Deluxe Wireless Edition
    Memory
    TWIN2X2048-6400C4DHX (2 x 1GB, DDR2 800)
    Graphics card(s)
    EVGA 256-P2-N758-TR GeForce 8600GT SSC
    Sound Card
    Onboard
    Monitor(s) Displays
    ViewSonic G90FB Black 19" Professional (CRT)
    Screen Resolution
    up to 2048 x 1536
    Hard Drives
    WD 36GB 10,000rpm Raptor SATA
    Seagate 80GB 7200rpm SATA
    Lite-On LTR-52246S CD/RW
    Lite-On LH-18A1P CD/DVD Burner
    PSU
    PC Power & Cooling Silencer 750 Quad EPS12V
    Case
    Generic Beige case, 80mm fans
    Cooling
    ZALMAN 9500A 92mm CPU Cooler
    Mouse
    Logitech Optical M-BT96a
    Keyboard
    Logitech Classic Keybooard 200
    Internet Speed
    300/300
    Browser
    Firefox 3.x ??
    Antivirus
    Symantec (Norton)
    Other Info
    Still assembled, still runs. Haven't turned it on for 13 years?
Back
Top Bottom