Despite the recent hubbub about Microsoft diminishing its use of its C# programming language in favor of the Rust language, Microsoft says it remains committed to C#.
It all started when Rafly Gilang at MSPoweruser sniffed out a Microsoft job posting looking for Rust developers to help rewrite core components built with C#, a pivotal Microsoft programming language, in Rust.
The role would be to guide the technical transition of existing large-scale C# cloud services over to Rust code. This move is part of a broader Microsoft effort to adopt Rust for modernizing and optimizing global platform services. Rust provides memory safety and performance.
C# Ain’t Going Nowhere
However, Microsoft acknowledges its interest in Rust for various use cases, but C# isn’t going to be replaced, Microsoft said. Rather Rust is but another language in the company’s arsenal.
“At Microsoft, we use a variety of programming languages to develop and deliver products and services to our customers. C# continues to be a highly valued language for Microsoft, and we are committed to its ongoing growth and development,” a Microsoft spokesperson told The New Stack.
C# is a general-purpose high-level programming language designed by Anders Hejlsberg, Microsoft’s vaunted Technical Fellow, software toolmaker and programming language creator. Microsoft released C# in 2000.
Rust is a multi-paradigm, general-purpose programming language that emphasizes performance, type safety, and concurrency. Rust arrived on the scene in 2015 and is viewed as a more modern language. The Rust Foundation serves as the steward of the language.
“As Microsoft is a founding Rust Foundation Platinum Member, our team has consistently seen their dedication to the development and future success of the Rust programming language since our inception,” a representative for the Rust Foundation told The New Stack. “Nevertheless, we do not view Microsoft’s commitment to Rust as an indication of C# ‘abandonment’ as was suggested in recent reporting and commentary.”
The role Microsoft seeks to fill is in the company’s Substrate App Platform group, which is part of the Microsoft 365 Core Platform organization.
Rust Love
Rust programmers are in high demand these days as more organizations are turning to the language because of its safety and performance.
“It’s like people saying ‘Hey, why are we rewriting parts of the Linux kernel in Rust?’ These are big questions, because Rust is not developer friendly, compared with something like Python,” said Brad Shimmin, an analyst at Omdia. “But as a general-purpose language, it conveys some serious advantages compared with the C family of languages. And most of those advantages seem to revolve around one word, safety. More specifically, two words — memory safety.”
Rust ranked 18th in the most recent TIOBE Index of popular programming languages, while C# ranked fifth. Meanwhile, the 2023 Stack Overflow survey listed Rust as the most admired language, as more than 80% of developers who used it last year want to use it again this year. The 2022 Stack Overflow survey report showed similar results for Rust.
“You can write bare metal code that is as fast as C# without having to worry about all of the memory ‘gotchas’ that seem to accompany that family tree,” Shimmin told The New Stack. “I think for specific projects and modules within a broader application,Rustis absolutely a great choice, especially if performance and robustness are on the docket. For that reason, I’m seeing more and more Linux projects jumping toRust, beginning with terminal emulators and now moving to entire window managers as with Pop!_OS.”
Indeed for performance and robustness, Rust is a good choice.
“I would imagine it is the idea this is a better and more efficient way to code and also manage resources – the value ofRustis it is compiled, and it manages memory vs. C++ you manage the memory (security issues) but it is fast, C# manages the memory (garbage collector) but it is byte code dynamic compile not quite as fast or space efficient,” Thomas Murphy, an analyst at Gartner, told The New Stack in an email. “Rust manages the memory (new format, not garbage collector), and it is compiled so it is fast and more efficient. And this is primarily of value for things running on platforms in the cloud like O365.”
About the Benjamins?
As Microsoft seeks to revise the services code that runs in Azure, “I suspect they are keen to optimize that code because it costs them money,” said Richard Campbell, a prominent Microsoft MVP and Regional Director, and founder of Campbell & Associates.
That code was originally written in C# because it’s quick to develop and get out into the marketplace – only if it becomes popular do you consider the kind of extreme optimization thatRustcan bring to the table, Campbell noted. Only when services are in high demand would you consider this kind of optimization – if few people were using it, it wouldn’t be worthwhile.
“When you’re going after peak optimization, you tend to go to low-level languages — the kind that is ‘close to the metal’ so you can save every processing cycle possible, Campbell told The New Stack. “C# is a great language, but it lives in a managed runtime, which is optimized for reliability and simplicity of use. Certainly, it’s fast, but if you want to squeeze every bit of performance possible out of some code, you’ll need to switch to a lower-level language – typically to C++.”
The tradeoff is that the C++ code is much harder to write and debug — and it takes very skilled people to write highly optimized code like that.
“Rustrepresents a new generation of low-level programming that makes it easier to create quality code at that level,” Campbell said.
A Mistake?
However, it could be a mistake for a company to just rewrite its codebase inRust, Shimmin told The New Stack.
“First, competentRustdevelopers are a lot harder to find than those steeped in C#, React, etc.,” he said. “Second, some of the memory safety restrictions withinRustmight make that language harder to maintain over time, should large-scale changes come up.”
Yet, he said he can easily imagine why Microsoft is doing this.
“It’s the same reason Linus Torvalds allowedRustinto the Linux Kernel: performance and stability,” Shimmin said. “That’s why Linus started with drivers. They operate right there against the metal, and they’re highly modular. It’s a good fit. Just as writing in Python is a good fit for data science projects.”
Google ups the Rust Ante
Meanwhile, Microsoft is not the only big company taking a closer look at Rust. Earlier this month, Google pledged$1 million to theRust Foundationto improve the interoperability between theC++andRustprogramming languages.
Though the project is called the “Interop Initiative,” the goal is more unidirectional in nature, to get “organizations slowly migrate current C++ to Rust,” according to the announcement, my colleague Joab Jackson wrote.
And again, in this case, memory safety is a key concern.
“While Rust may not be suitable for all product applications, prioritizing seamless interoperability with C++ will accelerate wider community adoption, thereby aligning with the industry goals of improving memory safety,” wroteLars Bergstrom,who is both the Google director for the Android platform tools and libraries as well as the chair of the Rust Foundation Board,in a blog post.
For context, the use ofRustand Google’s implementation in Android was recentlychampioned by Cybersecurity and Infrastructure Security Agency (CISA) Director Jen Easterlyas a key way organizations and platforms can mitigate memory safety vulnerabilities.Around two-thirdsof known software vulnerabilities are a class of weaknessreferredto as ‘memory safety’ vulnerabilities, which introduce certain types of bugs related to how computer memory is accessed, according to CISA.
Moreover, Google has been a first mover in the implementation of Rust. To date, there have beenzero memory safety vulnerabilities discovered in Android’sRustcode, Google said. While Google has seen the most significant growth in the use ofRustin Android, the company is continuing to grow its use across more applications, including clients and server hardware, the company said.
Microsoft’s Rusty History
Meanwhile, Microsoft’s interest in Rust is not new. Back in 2020, Microsoft said it was gradually switching to Rust to build its infrastructure software, away from C/C++. In 2022, Mark Russinovich, Microsoft’s CTO of Azure, posted on Twitter (now known as X): “Speaking of languages, it’s time to halt starting any new projects in C/C++ and use Rust for those scenarios where a non-GC language is required. For the sake of security and reliability. the industry should declare those languages as deprecated.”
Last year, Russinovich posted on the same platform: “If you’re on the Win11 Insider ring, you’re getting the first taste of Rust in the Windows kernel!”
TRENDING STORIES
YOUTUBE.COM/THENEWSTACK
Tech moves fast, don't miss an episode. Subscribe to our YouTubechannel to stream all our podcasts, interviews, demos, and more.