kitamstudios / rust-analyzer.vs

Rust language support for Visual Studio 2022
https://marketplace.visualstudio.com/items?itemName=kitamstudios.RustAnalyzer
Other
138 stars 10 forks source link

Using the run button on Rust code that binds or opens a UDP socket immediately panics #14

Closed recatek closed 1 year ago

recatek commented 1 year ago

Well, here's a strange one:

/test/Cargo.toml

[package]
name = "test"
version = "0.0.0"
edition = "2021"

/test/src/main.rs

use std::net::{SocketAddr, UdpSocket};

fn main() {
    let bind_addr = SocketAddr::from(([127, 0, 0, 1], 54321));
    let x = UdpSocket::bind(bind_addr).unwrap();
    eprintln!("{:?}", x);
}

Running this code gives me

Exception thrown at 0x00007FFB7B34CD29 in server.exe: Microsoft C++ exception:  ?? ::st_panic at memory location 0x000000A01290EF20.

on startup. Commenting out the bind call prevents the panic. Wonder if it's something with the debugger hooking in?

Visual Studio Community 2022 (64-bit) Version 17.5.1 rustc 1.67.1 (d5a82bbd2 2023-02-07) cargo 1.67.1 (8ecd4f20a 2023-01-10) Building on stable-x86_64-pc-windows-msvc

parthopdas commented 1 year ago

this is very strange

  1. cargo build --profile dev, run exe gives UdpSocket { addr: 127.0.0.1:54321, socket: 236 }
  2. cargo build --profile dev, open exe in vs and run under debugger gives the same as above
  3. Open folder (i.e. using this extension) F5 however panics.
recatek commented 1 year ago

I'm wondering if it's something about the MSVC execution environment that doesn't support sockets in Rust? I've been looking for reports of similar issues but haven't found anything.

parthopdas commented 1 year ago

thanks for reporting this.

should be available in today's release v2.0.x