« first day (2894 days earlier)      last day (2056 days later) » 

2:00 PM
@jsonGPPD You can't, nor should you
 
Protip
Create this class
 
Make the server return something different or extract it yourself after it's parsed
you can't do anything different
 
            var task = await httpClient.GetStringAsync("http://something.com/api/whatever");

            return JsonConvert.DeserializeObject<List<Whatever>>(task);
 
class Deserialisey
{
    List<Whatever> result;
}
 
Create the classes/structure matching to the original json intead altering it to what you spect it to be
 
2:01 PM
I thinking before I deserialize it, I should remove the "result" but I'm not sure how to achieve it
 
Then return JsonConvert.DeserializeObject<Deserialisey>(uri);
Problem sovled
 
Oh let me try that sir
 
Next customer.
 
There's nothing wrong with receiving an object.. it lets you add optional error codes or whatnot
that's considered best practice
receiving an array is another story
 
Okay fine then
 
2:02 PM
You could send an array of objects that contain arrays and possibly optional errors
 
@jsonGPPD maybe next time you could write your whole issue as one message instead of distributing guess work over 15 lines. I think you would avoid people getting frustrated of the obvious issues instead of answering what you intended to ask. just a suggestion of course
 
class Deserialisey<TresultType>
{
    TresultType result;
    string error;
}
 
How about this?
 
Which is remareably close to what I use anyway
 
But name is just my sample sir @Squirrelkiller I could have many properties
 
2:04 PM
Yay Generics
 
is the name Deserialisey have meaning or something sir @LeeButler?
Because I'm about to name my the same as that hehe
 
Yes, it's the class I made a couple of messages before
 
It's a speaking name...it's a class that exists solely to be deserialized into
 
Call it whatever you lik,e
 
call it LeeButler!
it has special meaning
 
2:06 PM
Oh haha thank you sir. Let me try to make changes on my codes
 
WhateverYouLike
 
There's the code which I actually use which does basically the same thing
 
Oh thank you sir for the reference.
 
You have a lot of comments going on.
 
But I'm wondering how will I put it on my DeserializeObject
 
2:08 PM
XMLDocs are cool
 
Have I mentioned Excel is shit?
 
@Wietlol yes
 
At least, Excel is shit
 
        /// <summary>
        ///
        /// </summary>
public DateTime ReturnTime;
k
 
Shhhhh
 
2:08 PM
/// <summary>
///
/// </summary>
/// <param name="data"></param>
public ReturnObject(object data)
 
In fairness, I didn't create the class, I just consume it
 
Because I tried this
 
public ReturnObject(object obj) { return obj; }
 
var taskResult = new DeserializeLoveTeamOfTheYearResult<task>();
and I get an error on task
 
and you want to know what the error is?
or us to guess it?
 
2:10 PM
Why does the one ctor go Success = failed that confusing
 
@Squirrelkiller it accepts an exception
 
it says, can't resolve symbol 'task'
 
so sounds reasonable something went wrong
 
@Default The ctor taking a dictionary and a bool?
 
2:12 PM
Success = failed; shouldn't that be inverted, i.e. Success = !failed?
 
        var task = await httpClient.GetStringAsync("http://something.com/api/whatever");
        var taskResult = new DeserializeLoveTeamOfTheYearResult<task>();
        return JsonConvert.DeserializeObject<List<Whatever>>(taskResult );
That error is on the task in line 2
 
oh, sorry @squ, just saw it :D
 
It's only used once
 
So...what does failed mean?
And is it a success when it fails?
 
I think we were expecting it to have more uses, and it being a success or failure kinda depended on the request
 
2:13 PM
public class DeserializeLoveTeamOfTheYearResult<TResultType>
{
    TResultType result;
    string error;
}
I used the same
 
In the instance where it is called, it's a failure because it identified multiple items the request could be acting on, so it's a failure and gives options as a result.
I'm not actually sure it ever fires
 
That's what I got fro mthe message and the dictionary - but what failed
Since it kinda fails and offers possible SKUs, is it failed or not?
 
what should I do sir?
 
The requested operation, which in the only instance it is used is trying to move an item in the warehouse, because "the item" is ambiguous
It definitely fails, but gives options for potential matches. I think the client is then meant to resubmit the request after the user has chosen which sku it was meant to be
 
So when can failed be....uh..true I guess?
In your case: is it true?
 
2:17 PM
tbh I don't even know why it would be false.
It's a retarded case.
I'm fairly certain it never returns because the client provides a sku which will match a single item, so it never has to happen
 
I'm just still hanging myself on the possible logic behind Success = failed
 
Yeah it's stupid
I wrote the client, the other guy wrote the service
 
I think he did the meth
 
Success = failed? Oh.. oh god.. Now I have to re-evaluate my life choices..
 
Since he left I've noticed some weird logic paths in there, but it mostly makes sense
 
2:21 PM
isn't there some language where you can redefine true and false?
 
some horrible horrible language? Yes, there are plenty
 
Functionally it works fine, it's just some instances where the business logic is wonky
 
You used to be able to redefine true and false in javascript
 
ah. that's probably the one I was thinking about
 
2:22 PM
such evil
 
There's loads you can do it in
 
oh
 
no u
 
01101000 01100001 00100000 01101000 01100001 00100000 01101000 01100001 00100000 01101000 01100001 00100000 01101000 01100001 00100000 01101000 01100001 00100000 01101000 01100001
 
2:25 PM
01000001 01101100 01101100 00100000 01111001 01101111 01110101 01110010 00100000 01100010 01100001 01110011 01100101 00100000 01100001 01110010 01100101 00100000 01100010 01100101 01101100 01101111 01101110 01100111 00100000 01110100 01101111 00100000 01110101 01110011
 
Zero wing is trash
 
I've found a solution
 JObject.Parse(task)["result"].ToObject<List<Whatever>>();
It's under the Newtonsoft.Json.Linq :)
 
Why must you always hack something like a madman when there's an elegant solution
 
2:40 PM
I just asked on the Stackoverflow if Newtonsoft has something to solve it
Gladly someone commented and JObject is from Newtonsoft
 
You should check if !string.isnullorempty(JObject.Parse(task)["error"])
 
I dont think that is supposed to be a string though
 
3:03 PM
Hurrrrrr why
 
because its a json value, and not all json values are strings
jObject["error"]
should return a String | Double | Boolean | JObject | JArray | Null
 
No not you, the "solution"
 
oh
no u
 
3:21 PM
@Default just saw what?
@RoelvanUden i get it
 
what you meant
 
3:31 PM
Why don't my descriptions show up in browser?
some of them are empty, others have some ridiculous descriptions
 
that looks odd to configure like that
 
it is annotation above method
 
I don't know what you mean :o
anyways ima gone aswell
 
Is there an easy way to deserialize an XElement if the name of the element isn't the same as the class i'm trying to deserialize to, but the properties and the elements in the XElement are the same?
 
@Taurib yes, but a 400 could be because the datetime input is unable to be parsed or because the language code isnt recognized
400 could have many different messages
how would it know which one to use?
 
3:41 PM
I set description in annotation
I could also set it this way
 
have a nice day
 
This should serve documentation functionality
 
mr5
@Taurib why are you mixing Java style constants
 
3:58 PM
I'm not sure what you mean
But this should be result
almost this
I put different methods here
[SwaggerResponse(statusCode: (int)HttpStatusCode.OK, type: typeof(GroupListDto), description: "Get list of groups")]
        [SwaggerResponse((int)ErrorsEnum.UserB2CMissing, type: typeof(ErrorDto), description: "User B2CId is missing")]
        [HttpGet]
        [Route("")]
Ahh, I'll look into it tomorrow
 
Am I missing something here
Fucking stack chat is all over the place today
 
Hey yo.
 
@LeeButler goode jobbe
you either have two dependencies with the same namespace.namespace...class
or you have corrupted IDE
restarting/clearing cache should work for the second case
 
I'd like to organize my projects and could use some basic advice cause I'm a noob. I have two projects that are dependent on a third project, a class library. I'm currently pointing the dependent projects to the DLL in the bin/release folder of the library project. Continued...
 
Yeah apparnetly
 
4:07 PM
> cause I'm a noob
and you assumed we are not?
 
I'd like to know how to manage in TFS so that my colleague can get latest and the project will work without having to pass him the bin folder contents. And I'd like to be able to work in the dependent projects and have the class project debuggable.
 
Hmmmmmmmmm
 
@SeaCharp try putting your lib in nuget
 
So can I add the three into a single solution? And how does that affect them separately?
 
referencing libs without nuget is horrible imo
 
4:08 PM
I could do NuGet that would be really neat, but wouldn't allow me to debug the class library when running the dependant ones.
 
it does take some time to set up though
but after that, its all fun and games
 
Nuget packages are a pain to set up
 
@SeaCharp my Rider decompiles libraries
 
Especially if you've got CI building and packaging and publishing them for you
 
OK, so there are two diff issues. I have the library, I wrote it, I don't need to decompile it.
 
4:09 PM
today, I was searching through EPPlus lib because they have an error
that causes it to break on stupid excel files
putting breakpoints in those decompiled files also works
 
But if you do do that, you just push any changes to master, wait about 30 seconds and then you've got a nice fresh update in nuger
 
which is fun
 
If I open a project how can I get the other project to debug at the same time? Can a project be a part of multiple solutions at once?
 
@SeaCharp there shouldnt be a notable difference between the decompiled code and the source code
the worst thing you would have to deal with is formatting
 
But I HAVE the source code. I don't need to decompile it.
 
4:11 PM
you might be able to include the pdb file into the nuget reference
 
Decompiling is tragically painful on winforms projects
 
@SeaCharp but you dont share the source code through nuget
you only share the compiled code
 
Forget the BIN and reference issue for a moment.
 
@LeeButler I'd say that is winforms fault
in any case, im off
latar
 
if I have two solutions that contain two projects, and one is dependent on the other, can I run them BOTH in debug at the same time? I mean I just thought of it, can I even run a class library and have it debugging in a different VS instance while running the dependant project?
This room isn't being very helpful recently, lol. Love you anyway.
 
4:18 PM
On the same machine? No. You can have a project in multiple solutions
I don't understand why you'd want to debug them seperately at the same time though. You can debug both when you debug the one which is dependent on the other
 
OK, so I can just share the project in multiple solutions? Where would the solution be kept, at the top of the whole folder tree? How would that affect TFS if I already have those projects checked in independently? It sounds... dubious.
Lee, if I can include both in a separate solution without affecting the independently managed solutions, it's not really an issue I guess, but...
 
Now I don't use TFS so I don't really know about that part, but I have my folders laid out like this
 
OK, I'll have to just experiment, I just don't want to hear my coworkers whining about it, lol.
 
(Root Git Folder)
    (Solution 1)
        (Project 1)
        Solution 1.sln
    (Solution 2)
        (Project 2)
        Solution 2.sln
etc
Each Solution folder is a git repo. But Project 2 may have Project 2 as a dependency. Solution 2.sln will open both projects 1 and 2
 
Oh, I see. I know it looks obvious to you but I think seeing and hearing you describe it makes it clear what I should do.
Thanks.
 
4:33 PM
I don't know that that's a good way of doing it, I just know that's the way we do it here.
 
5:30 PM
Why do people like my answer to that so much
I guess it's admittedly not obvious where you would put async in a lambda expression
 
6:26 PM
Can anyone explain the rationale behind step 3 and the first line of step 6 in this answer? stackoverflow.com/a/15432333/2364796 What does "remember the TransparencyKey?" mean? Is there something special about SystemColors.InactiveBorder here or is it just an arbitrary color choice? Setting the BackColor of the TextBox changes its appearance as expected, but I don't see any difference when I set the form's TransparencyKey to the same color versus leaving it at the default.
 
TransparencyKey is a color that the windowing system will treat as transparent
You could just as easily set it to something else easy to remember
(And that you'd never want to use)
 
Ohhh, so these steps are an alternative to setting the Opacity of the Form.
 
It lets you chroma key out. They're using a second form overlaying the first to acheive the desired effect here.
 
Okay, that makes sense now, thanks.
 
As he mentions, this is a fairly straightforward way of doing this... but I don't see it as very flexible or extensible. You may also want to consider the answers on the question this question is marked a duplicate of.... They suggest subclassing TextBox and setting a styling property of the class, which would allow this pretty simply, too.
 
6:42 PM
I'm actually doing something slightly different, making the TextBox semi-transparent. So I'm just setting the Opacity of Form2 instead of setting the TransparencyKey.
The downside is that the text is necessarily also made semi-transparent this way, but that shouldn't be super important for i.e., 90%+ Opacity.
 
7:36 PM
Anyone here really sharp with C#? I'm trying to figure out a problem with my inheritance and generic classes.
 
!!dontask
 
Jul 3 at 19:41, by Kendall Frey
Don't ask if you're allowed to ask a question. Don't ask if anyone's available or knows how to use what you're using. Don't say you're going to post a question. Just ask your question.
 
Okay.
Suppose I have a class that is declared as such
public class PersonalEntry : SchedulerEntry<PersonalApproval>
And Scheduler entry is defined so
public abstract class SchedulerEntry<TIApprovableResponse> : IApprovable<TIApprovableResponse>
    where TIApprovableResponse : IApprovableResponse
What do I do if I want to cast an instance of PersonalEntry down to SchedulerEntry?
 
7:56 PM
You should be able to cast it no problem, no?
 
8:19 PM
I get this error:
Error CS0039 Cannot convert type PersonalEntry' to SchedulerEntry<IApprovableResponse>' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion
 
Oh, that's because it's a SchedulerEntry<PersonalApproval>
classes cannot be covariant
 
Right
I wanted to add these to an IList to be serialized, and I figured out I could just downcast the whole thing to Object and it works well, but I would like to know what I could have done if I needed to do the cast as originally intended.
 
If it's an interface you can make it covariant and the compiler will verify that you're never violating the inheritance
 
Ah
Can't do that either
 
But it's not smart enough to handle classes
 
8:25 PM
The interface definition looks like this:
public interface IApprovable<TIApprovableResponse>
{
    IEnumerable<TIApprovableResponse> Responses { get; }

    Task Respond(TIApprovableResponse response);
}
 
I'm not sure how a cast would affect serialization anyway
casts are a compile time thing, and serialization is runtime
 
If I try to declare the type covariant, then it tells me that I can't use the type as a parameter to the "Respond" method that I declare.
 
Oh yeah, that's for pretty obvious reasons
 
I actually don't understand.
Coviarance means that I can substituate a more derived type.
So I would think that the method should be able to use a more derived type as a parameter.
 
Because it would let you pass the base type to a class expecting the derived type
covariance means you can treat a derived type as if it was a base type, but that only works for values coming from the class, not being passed to the class
 
8:29 PM
At times like this, I'm glad that my client-side stuff is all in JavaScript without all this type hierarchy.
Oh, did I ever mention that I don't like TypeScript?!?!
 
what why
it's glorious
 
TypeScript is Javascript for people who don't like Javascript
Javascript is yummy, if an acquired taste.
 
Type systems are created for a reason
JS is mostly great but its type system is shit
 
Although I will admit that Brenden Eich fumbled object inheritance in Javascript so badly that we ended up using Object.assign isntead.
 
In this case, the C# type system is blocking you for a good reason, because otherwise you could do clearly erroneous things
 
8:31 PM
Aren't you glad I'm not on your team? ;-)
 
I don't think so?
 
Because my thinking is obviously so completely wrong. I'd probably write a horrible mess of spaghetti code for you to clean up. :-D
 
Just use dynamic and ExpandoObject for everything and your basically got js
 
Wil
Guys, I guess this is 100% subjective, but, I wanted to ask C# people - how do you find the stability of Windows for software development?

I'm really fed up, a few updates down the line and my Explorer is crashing non stop - pretty standard build along side Visual Studio install with loads of addons (including Android Emulator) and Vmware Workstation.

I wondered if there are "Funky things" going on, and, I've been cursing Windows for months, but, I have a surface and also a really cheap Windows Tablet and neither have ANY issues like this (other than updates)!
I remember going back 10+ years that various games had loads of crashes when I installed the Direct X SDKs, and, I just can't help but feel something like that may be going on here - or, do Windows updates screw around with VS/Vmware causing stability problems...
 
Windows is fine, VS is crashy
 
Wil
8:44 PM
It's just beyond a joke since the last update...
Tried using debug tools, but, can't figure out the correct way to figure what's causing crashes... useless crash dumps (or me being useless), it's just beyond frustrating at the moment...
 
 
1 hour later…
9:57 PM
Since Windows 8, my Windows very rarely crashes, except for those crashes that tend to happen immediately after waking from hibernation.
Visual Studio is a bit crashey, but the newer versions tend to be more stable than what I used 10 or so years ago.
 
A lot can change in a year, let alone 10
 
Oh yes!
And my observation is that Visual Studio is still a bit crashey, but not like it used to be!
 
@Squirrelkiller EW!
 
I find 2017 to be a vast improvement for VS
 
@KendallFrey my windows crashes more often than my VS
 
10:10 PM
Luckily my Windows doesn't crash every other day
 
but then again, I refuse to install VS
 
10:35 PM
I am encountering the dreaded BadImageFormatException in a console application with several other project assemblies referenced. One of the class-library project assemblies appears to be the culprit. In Fusion log, I see the following for that offending assembly: Invalid assembly platform or ContentType in file (hr = 0x8007000b)
All projects are being built as x64.
All target frameworks are the same version (4.5).
 
what ide do you use?
 
Visual Studio 2017. This is happening on a test machine, and not the dev machine.
Dev machine runs fine
 
we had that exact issue on Rider recently after upgrading from 17.x to 18.x
turns out it reset the path to the iis executable
and it was set to the (x86) version
 
Hmm.
 
might be worth checking if you run everything in x64
 
10:37 PM
Well in our case this is a console app, so no IIS.
 
im not sure if a similar issue could exist for console apps though
 
OK, so here is an oddity:
 
Wil
Hmm, thanks guys - wonder if I should dump vmware workstation and go hyper-v... it must be something low-level system related, crashing is just driving me crazy
 
I ran Corflags on both the console app, and the assembly being referenced
problem assembly says PE: PE32+
Console app says PE: PE32
Also Console app says 32BITPREF: 1 whereas the problem assembly is 0.
WTH?
 
10:54 PM
In the past, Visual Studio would always prompt me to rebuild my solution before starting the debugger and would warn me if the build failed.

Somehow, I now have it set so that it doesn't automatically rebuild. I've been digging for that setting and can't find it. Anyone know how to fix this?
 

« first day (2894 days earlier)      last day (2056 days later) »