Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 23 21:14
    jonfortescue assigned #28206
  • Sep 23 21:13
    jonfortescue review_requested #28206
  • Sep 23 21:13
    jonfortescue opened #28206
  • Sep 23 21:13
    jonfortescue review_requested #28206
  • Sep 23 21:13
    jonfortescue review_requested #28206
  • Sep 23 21:13
    jonfortescue review_requested #28206
  • Sep 22 20:28
    rwkarg commented #8942
  • Sep 20 18:52
    zaytsev-victor removed as member
  • Sep 20 18:52
    yvanin removed as member
  • Sep 20 18:52
    WinCPP removed as member
  • Sep 20 18:52
    Suchiman removed as member
  • Sep 20 18:52
    poizan42 removed as member
  • Sep 20 18:52
    noamyogev84 removed as member
  • Sep 20 18:52
    mattwarren removed as member
  • Sep 20 18:52
    MarcoRossignoli removed as member
  • Sep 20 18:52
    lkts removed as member
  • Sep 20 18:52
    kbaladurin removed as member
  • Sep 20 18:52
    kant2002 removed as member
  • Sep 20 18:52
    jnm2 removed as member
  • Sep 20 18:52
    filipnavara removed as member
Hugh Gleaves
@Korporal
MS have made stuff very confusing over the past few years. Their documentation states Assembly names that code is in but never tells us if that assembly is part of framework or must be pulled from Nuget.
System.Net.Http is a framework assembly yet System.Net.Http.Json is not it seems.
I can't believe the jumping around I have to do just to submit a simple async HTTP put FFS
Hugh Gleaves
@Korporal
To use HttpClient all of this already tested and stable (except for async timing out after 100 secs) code must be replaced, why has MS had so much trouble with supporting HTTP operations that have been around since the days of Noah.
    private static HttpWebRequest CreateRequest(string Method, string Url, IDictionary Args)
    {
        string json = JsonSerializer.Serialize(Args);

        var request = (HttpWebRequest)WebRequest.Create(Url);

        request.Timeout = 10000;

        //((WebRequest)(request)).Timeout = 1000000;

        request.Method = Method;
        request.ContentType = "application/json";

        var bytes = Encoding.ASCII.GetBytes(json);

        request.ContentLength = bytes.Length;

        using (var stream = request.GetRequestStream())
        {
            stream.Write(bytes, 0, bytes.Length);
        }

        return request;
    }
Whatever happened to the concept we we're all lectured about for years, you know that concept?
"reuse".
This isn't reuse, this is rewrite, that's another OO promise that's been abandoned.
Michał Zegan
@webczat
what 100 sec timeout?
Hugh Gleaves
@Korporal
WebRequest.GetResponseAsync is throwing a WebException that's a timeout.
Its abstract, that actual class is HttpWebRequest but it does not override the async methods, so these are all in the base class
setting HttpWebRequest.Timeout seems to have no effect (hence its commented out in that code fragment above)
Michał Zegan
@webczat
so what's the problem with HttpClient instead?
Hugh Gleaves
@Korporal
Changing the above code to rely on HttpClient takes time that's all, and retesting and may itself uncover oddities.
that code returns an HttpWebRequest, that'll change so all callers must change etc etc.
Michał Zegan
@webczat
well HttpClient is really the way to go, it's an api designed differently etc, more composable for example
Hugh Gleaves
@Korporal
I'm sure its better Michal, no problem with that but our work these days is just non-stop jumping around, rewriting stuff over and over - as I said, whatever happened to the promise of "reuse" we we're lectured about by the OO and .Net gurus.
Michał Zegan
@webczat
well there is reuse. they didn't remove the old api :) if you really need it you can use it
but then if the api is too limited for use cases whatever then the only thing you can do is rewrite sometimes
Hugh Gleaves
@Korporal
In addition, since I have no real idea why the timeout occurs, it might not be in the HttpWebRequest area at all, until I rewrite the code and retest I won't know. If the timeout has some other cause (like for example ServicePoint details). If I rewrite yet continue to see the problem, all of the time spent studying HttpClient and rewriting the code is a total waste of resources.
All too often we hear "Well just use XXX" as if this were a five minute tweak, it often isn't and the costs, time, impact is huge - this is especially true of fixed deadline projects (which I hasten to add, "agile" is utterly useless for).
Sorry to gripe, but this is what development has become.
I have hard deadlines of Dec 1 for a bunch of stuff, hitting fixed deadlines requires planning something agile is weak at (because - incorrectly - the term "planning" is taken to mean "waterfall" which is not true).
Hugh Gleaves
@Korporal
Is PresentationCore.dll part of .Net Std ?
Jesper Hansen
@jespersh
@Korporal no, it is windows specific for wpf
Joseph Musser
@jnm2
@Korporal Did you try my suggestion of setting Connection: close instead of the default keep-alive header that HttpWebRequest adds? That solved the timeouts for me. Then I moved to HttpClient anyway.
Hugh Gleaves
@Korporal
Hi, no actually, I didn't see you post that - I will perhaps try that later, many thanks
Joseph Musser
@jnm2
@Korporal :point_up: October 16, 2020 6:55 PM
Source Code Poetry
@poetry_code_twitter
@poetry_code_twitter
Hello, guys we want to share our non-profit coding challenge! Enjoy it! https://www.sourcecodepoetry.com
And if you can please share a challenge with your friends or social media followers, that would help us to unite programmers from all over the world.
Hugh Gleaves
@Korporal
I have a question, when I create a console app I can use Console class methods to interact with the user or within an existing command window a user can invoke my app as a command. Is there a similar thing for power shell? Can I write an app that interacts with the user in a power shell command window? for example could I position the cursor, prompt for keyboard input and so on...
I've barely ever used powershell, seems I can invoke a .exe in power shell, if I prefix with .\myapp.exe it runs and can manage cursor and KB input exactly as the ordinary cmd window does...
HaloFour
@HaloFour
cmd.exe and powershell.exe are just console apps, the OS provides the console window
Joseph Musser
@jnm2
Yes, conhost.exe
Hugh Gleaves
@Korporal
I see, yes a console app (once invoked) can interact with the user in the same way whether its invoked from a command window or a power shell window.
the same cursor control code behaves identically.
Joseph Musser
@jnm2
The new Windows Terminal is my console host of choice.
Before that, ConEmu
Egil Hansen
@egil
Hey folks, I cannot figure out what version number to pass to GitHub Actions actions/setup-dotnet@v1 to get 5.0.0-rc.2 installed. Anybody knows?
Joseph Musser
@jnm2
Perhaps 5.0.100-rc.2.20479.15 ("full version" from https://dotnet.microsoft.com/download/dotnet/5.0)?
lukaepti
@lukaepti
How do I find out the path to coreclr and dotnet sdk on Linux+GNU?
John Cullen
@john-cullen
Is there a good resource for reading about how Assembly loading works?
Brent Arias
@brentarias
@john-cullen I learned originally from Jeffrey Richter when he was writing back in the .Net 3.5 days-ish. For .net core the fusion log viewer I don't think works...but I know there is an environment variable you can set that will cause .net core to start spewing out TONS of log info to console-out that tells you in nauseating detail what assemblies it is loading and where it is searching for them.
Brent Arias
@brentarias

If I have a JSON blob like this:

{
 'foo' : {'hey' : 40},
 'boo' : {'there' :50}
}

...what is the fastest way to load this into a dictionary<string,string> with entries like "foo":"{'hey' :40}". So ya, I don't want the object value de-serialized...I want it kept as a string.

Joseph Musser
@jnm2
I think the new .NET Core JSON APIs let you obtain objects as strings and UTF-8 byte spans, but I don't remember how you would do it.
Alex Yakunin
@alexyakunin
Just want to thank anyone who worked on .NET 5 - the perf. boost I see so far is beyond any expectations: https://twitter.com/alexyakunin/status/1326438626901729280
ChinnasamyM
@ChinnasamyM
Yes. Great and awesome efforts. Thanks @alexyakunin for pointing out this. Good explanatory samples
Edinei Cavalcanti
@neiesc
@alexyakunin thanks
Chris Ochs
@gamemachine
What is the idiomatic way to log by application feature? Using Microsoft.Extensions.Logging but in a very custom server setup. So we have an AppLogger class with static methods that proxy to the system wide logger. We have no good reason for separate logger instances. So I threw together a LogScoped method that takes an AppLogScope enum. That grabs a LogLevel constant defined for the scope.
DI would be nice but it's not so simple, multiple context's we would have to create injectors for. So atm DI for logging just not a good bang for buck
Chris Delpire
@Delpire
If I have a .NET Core exe referencing a .NET Framework Dependency, and that .NET framework dependency has another .NET framework dependency, is it possible to redirect that 3rd dependency. We can't use GAC/policy files, but is there some kind of file I can use to do a .NET Framework assembly binding redirect even if I am running in .NET Core 3.1?