question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[C#] Latest nightly C# code gen produces awful looking code

See original GitHub issue

From the inception, the main differentiator for AutoRest (as opposed to other code generators) has been that it produced beautiful code that always compiled and looked like it was hand written. Unfortunately the latest changes in the C# code generator go completely against this paradigm.

// Construct URL
var _baseUrl = this.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "status").ToString();
// Create HTTP transport objects
System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
System.Net.Http.HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url); 

Please bring back “usings” and find a better way to avoid type conflicts.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
olydiscommented, Nov 17, 2016

fixed as of #1617

0reactions
fearthecowboycommented, Sep 27, 2016

Agreed. We’ll prioritize the fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask HN: What's the largest amount of bad code you have ever ...
It is close to 25 million lines of C code. What an unimaginable horror! You can't change a single line of code in...
Read more >
Invalid LLVM coverage data produced when compiled with -C ...
I tried this code: use num_integer::Roots; fn main() { let a:u32 = 54321; ... new version in the works, so generating both Rust...
Read more >
10 Key Learnings in Rust after 30000 Lines of Code
10 Key Learnings in Rust after 30,000 Lines of Code. I used to love C and C++. If we date back to the...
Read more >
In 10 years, Clang has become 2x slower, but generates code ...
According to this, Clang has become 2x slower and runs a highly manually-optimized, largely C-like codebase (see earlier blog post, "Is C++ fast ......
Read more >
Suspected bad code generation for x64 Release build
C :\Users\Nobody\source>cl Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25835 for x64 Copyright (C) Microsoft Corporation. All rights reserved. usage: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found