{"id":21028906,"url":"https://github.com/chamons/evil-print","last_synced_at":"2025-10-26T00:11:02.749Z","repository":{"id":87165292,"uuid":"119476760","full_name":"chamons/evil-print","owner":"chamons","description":"Quick example showing an evil use of .NET's symbol resolution","archived":false,"fork":false,"pushed_at":"2018-01-30T03:31:55.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-19T05:50:20.312Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chamons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-30T03:26:06.000Z","updated_at":"2018-01-30T03:29:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"c7738781-ea8e-4834-8a1c-f55297af1a93","html_url":"https://github.com/chamons/evil-print","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chamons/evil-print","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chamons%2Fevil-print","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chamons%2Fevil-print/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chamons%2Fevil-print/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chamons%2Fevil-print/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chamons","download_url":"https://codeload.github.com/chamons/evil-print/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chamons%2Fevil-print/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281039676,"owners_count":26433831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T11:59:34.971Z","updated_at":"2025-10-26T00:11:02.705Z","avatar_url":"https://github.com/chamons.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# evil-print\nQuick example showing an evil use of .NET's symbol resolution. \n\nWhen two different symbols of the same name are conflicting, if one is less nested it is preferred silently. This can be abused for awesomeness or as shown here other purposes. \n\nThe code in Main.cs appears to use the System WriteLine method:\n\n```\n$ cat Main.cs \nusing System;\n\nnamespace MyProject\n{\n\tpublic static class EntryPoint\n\t{\n\t\tpublic static void Main ()\n\t\t{\n\t\t\t// These first two will be redirected\n\t\t\tConsole.WriteLine (\"First\");\n#if USE_LIBRARY\n\t\t\tConsole.WriteLine (Math.Adder.Add (2, 2));\n#endif\n\t\t\t// But this one will not\n\t\t\tSystem.Console.WriteLine (\"Last\");\n\t\t}\n\t}\n}\n```\n\nBut as the example shows, when you reference a library, that resolution can change unexpectingly.\n\n```\n$ make\ncsc Main.cs /nologo\nmono Main.exe\nFirst\nLast\ncsc Adder.cs -t:library /nologo\ncsc Main.cs /nologo -r:Adder.dll -d:USE_LIBRARY\nmono Main.exe\nEVIL\nFirst\nEVIL\n4\nLast\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchamons%2Fevil-print","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchamons%2Fevil-print","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchamons%2Fevil-print/lists"}