Skip to content

Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.

C#: count Directory.GetCurrentDirectory and Path.GetTempPath as reading the environment (#1364)

jakalijey8ff51b9f7667
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c7c97554..23b1f7d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -188,6 +188,10 @@
fails. Before, a Python unit built on `BeautifulSoup(html, "html.parser")`, which no crate
reproduces, could only meet the cap by dropping behavior. The skill and TASK.md tell the agent
to ask the user instead of writing one (#1189 by @sungkilhan221).
+- C#: `Directory.GetCurrentDirectory()` and `Path.GetTempPath()` count as reading the environment,
+ as `Environment.CurrentDirectory` already did, so `bridge` keeps a function that builds a path from
+ one in C# and `analyze` lists it. Before, its recording held this machine's folders (#1347 by
+ @jakalijey).
## 5.1.1 (2026-12-02)
diff --git a/src/lang/effects.rs b/src/lang/effects.rs
index c623d7b0..70266bb6 100644
--- a/src/lang/effects.rs
+++ b/src/lang/effects.rs
@@ -179,6 +179,8 @@ fn environment(lang: Lang) -> &'static [&'static str] {
"Environment.MachineName",
"Environment.UserName",
"Environment.GetFolderPath",
+ "Directory.GetCurrentDirectory(",
+ "Path.GetTempPath(",
],
Lang::Powershell => &["$env:", "[environment]::", "get-location", "$pwd", "$home"],
Lang::Swift => &["ProcessInfo", "FileManager.default.currentDirectoryPath"],
@@ -1543,6 +1545,18 @@ mod tests {
"<?php\nfunction f() { return lcg_value(); }\n",
Risk::ClockAndRandom,
),
+ (
+ Lang::Csharp,
+ "X.cs",
+ "class X { static string F(string n) { return Path.Combine(Directory.GetCurrentDirectory(), n); } }",
+ Risk::SharedState,
+ ),
+ (
+ Lang::Csharp,
+ "X.cs",
+ "class X { static string F(string n) { return Path.Combine(Path.GetTempPath(), n); } }",
+ Risk::SharedState,
+ ),
(
Lang::Csharp,
"X.cs",