« first day (1758 days earlier)      last day (3205 days later) » 

12:00 AM
(DateTime?)callTiming.LineUpLastRefresh
 
Will it throw an exception @KendallFrey?
 
I don't think so
 
Good xD
Why do you prefer boxing with (DateTime?) instead of as?
 
lastRefresh = callTiming?.LineUpLastRefresh; // C# 6 :D
@diemaus that doesn't box
 
@KendallFrey it doesn't cast tho...?
 
12:02 AM
But if it did, as would too
 
I personally prefer to avoid as for anything that's not a reference type
@diemaus Yes, I know, I get it, I'm late to the party
 
@KendallFrey as do I. But i personally thin as is clearer.
@KendallFrey It's okay, I still love you! :)
 
OK good, you can stop pinging me now
 
@KendallFrey will do ;)
 
12:06 AM
Perhaps you don't understand the meaning of the word "now"
 
I didn't mean to be rude. Sorry if i offended you somehow.
 
nah, just annoying
<3
no homo
 
Good! :)
Question, or... rather... i don't know what to google. Would the following:

var file = new FileStream(path, FileMode.OpenOrCreate);

await data.CopyToAsync(file).
ContinueWith(a => { data.Dispose(); }).
ContinueWith(a => { file.Dispose(); });

be considered bad practice?
 
yes
use await
 
But i am?
 
12:10 AM
But you're also using ContinueWith
Actually, use using
then you can skip the dispose code entirely
 
Yes. If i wrap the "await" call in a using, the data-stream gets disposed before it's finished copying.
 
wait, really
 
Yes, even with await.
Let me show you
 
It doesn't for me
 
Hmm
pastebin.com/jNxGsxha could have to do with my task-list.
Kind of new to the whole async-thing
"Cannot access a disposed object. Object name: 'ReferenceReadStream'"
I know why, but it's mostly because i'm retarded
 
12:18 AM
?
 
I add my result to the saveResults and then use Task.WaitAll on the collection. But the using will dispose the data-stream before it has been awaited.
 
Yeah, that shouldn't be too hard to fix
 
So lesson learned. Don't add stuff that has disposable things in them to a Task-list with a using around it...
 
12:36 AM
@diemaus Well, it has nothing to do with the list
 
It has to do with the using.
 
Just always wait for a task to finish before disposing resources it uses
 
Well, i was using Task.WhenAll for awaiting everything in my task-list. Anyways, i solved it.
 
OOC, how?
 
By not using Task.WhenAll and by just awaiting one at the time instead. As such:
                using (var data = file.OpenReadStream())
                {
                    var result = await ImageRepository.AddFileAsync($"{fileName}.{extension}", data);

                    results.Add(result);
                }
 
12:38 AM
yep, looks nicer
 
I kinda liked the WhenAll-pattern i had going on. But it doesn't go well with Disposables.
 
It's not that it doesn't go well
You were just using it wrong
 
Well, i was iterating over multiple uploaded files. Then adding them to a list. What i would have to do, if i wanted to keep the WhenAll-approach is i had to either add all the streams to another list (or create a wrapper-class for them + the task) and then iterating over them, disposing one at the time, after the WhenAll had been awaited.
At least that's the approach i would've taken. Have any sweeter ideas? :)
 
Disposing them in the task would also have worked
It's hard to say what the best solution is without seeing more code
 
Yep, but that meant that i "lost control" over the data. And could not mess around with it after it had been saved
This is the action as it stands now:
 
12:47 AM
That's suboptimal, just saying
 
Maybe. What would be your approach?
 
It would probably be faster to have tasks running in parallel
i.e. don't await a task until you need the result
 
You mean, sort of like i had with the list?
 
Yes, I know, but just fix the way you do Dispose
 
Could i use ContinueWith (or similar) to dispose it?
 
12:49 AM
I'd suggest breaking up your method into smaller chunks
@diemaus Don't use ContinueWith, please
 
The AddFileAsync-method?
Then i will not.
 
@diemaus The other one
Or, you could pass file into AddFileAsync instead of data
 
Okay. I've already reduced it from ~150 lines, to what it is now.
Hmm, i could. But i'm using a base-class which takes a Stream-object.
But i could also add an abstraction-layer.
 
Don't make it more complicated than it needs to be
 
Of course not, just thinking of possible solutions.
 
12:52 AM
Disposing in a task sounds like the way I'd go
 
Then that is the way i will go
Tasks are a bit odd...
Well, I'm off to bed. Cya all. Nice chatting with you Kendall. Thanks for your help! :)
 
@KendallFrey mind checking the haskell room?
 
1:42 AM
Anyone have any experience with working on UWP apps?
 
 
4 hours later…
6:04 AM
aww yeah, working on a sunday \o/
monday will suck even more
 
6:39 AM
does anyone know how to configure visual studio to use a public symbol server but ignore any xunit symbols on that server?
I don't want to step through xunit code
I just want to debug my failing tests
 
6:57 AM
oh there's an option to blacklist assemblies from loading symbols
 
 
3 hours later…
9:40 AM
I still wonder that there is no chat room for windows azure
 
 
3 hours later…
1:00 PM
good morning!
 
whats up
 
waiting for appveyor to do its thing
 
whats that
 
1:03 PM
ah
 
but they're so slow
 
im putting off writing these unit tests, i wrote all the stubs, just gotta fill them in now, ugh
 
don't do it
 
2:03 PM
Hello party people! :)
 
hey!
 
I'm still having massive issues with a task-list (still not sure if this is a good design-pattern) where await doesn't actually await. It's kind of odd.
I discussed it with Kendall Frey the other night, he helped out a bunch.
 
@diemaus what are you observing and what were you expecting?
 
Has anybody had similar issues?
Hmm, let me upload some code.
If i remove the "ContinueWith"-part, it doesn't "wait" until the task is completed. It disposes the data-Stream before the task is completed.
Kendall really adviced against using ContinueWith so I'm trying not to.
 
2:18 PM
Hmm. I wonder if file is somehow grabbing data and disposing it when it is itself disposed
I'm also not sure what I would expect to happen if you don't await a result. I guess that means the method can complete immediately, because there is nothing that depends on the result of CopyToAsync
 
@TomW can you expand on that?
 
My understanding is that methods which await continue immediately until they hit a line that depends on the result of the awaitable. Since this awaitable has a result type of void (clumsy terminology I know) I'm not sure what happens, I don't think that method has anything to stop it from completing and every local variable going out of scope
 
Oh, i get what you mean now Tom, thanks. I guess my "continuewith" forces the Task to complete then?
 
I guess so. I only have quite a vague understanding of how Tasks work, so that could be nonsense
 
@TomW still better than nothing i guess! ;)
 
2:26 PM
As a hack, could you try holding a reference to data somewhere else, and remove the ContinueWith? I think doing that would prove whether or not it's data being finalized that's causing it to be disposed prematurely
somewhere outside the method, I mean. If it's not local to that method, it won't be collected
 
Gonna try it. :)
alternatively, add the streams to another collection, and dispose them manually after the Task.WhenAll has been awaited. But it feels even more hacky...
Gotta go for a minute!
 
 
2 hours later…
4:49 PM
what's the longest statement you can come up with using only language keywords?
mine is yield return this as object;
 
@StevenLiekens yield return this as object as object as object as object as object as object as object as object as object as object as object as object as object as object as object as object as object as object as object as object [...];
 
that's cheating
 
statement meaning syntactically valid?
 
5:06 PM
39
A: What is the longest legal statement block you can make with only C# keywords?

Marc GravellFor 6: new protected internal unsafe virtual decimal Foo() {...} Edit for 7: new protected internal unsafe virtual extern decimal Foo(); If we allow brackets and braces... (edited the "lock", "new object()", "as" and "string" were contributed by others; see comments) decimal Bar() { l...

 
For many upvotes, write a method that determines the answer by consuming some object graph representing C#'s grammar and map/reduce or whatever
 
5:24 PM
is there a name for that proxy pattern where you implement IList and then delegate all members to a private field of type List?
also is IReadOnlyList<T> still relevant?
ehh I guess it doesn't hurt to implement it
 
HOW COULD IT POSSIBLY BE?!
 
sarcasm?
 
^ random blog I found googling IReadOnlyList<T>
 
5:33 PM
"IReadOnlyList<T> is strangely not a subtype of IList<T>"
...duh
 
No. Since IList<T> implements mutation, no subtype of it could possibly be read-only
Unless throwing InvalidOperationException or something shitty like that
 
what bothers me is that IList doesn't implement IReadOnlyList
now I have to remember to do it myself
 
I'm surprised someone who blogs and comes in on the first page of a google search would make such a nonsensical statement
 
Ok i have a question do you know the best way to lear ios development with swift. Maybe any courses or books which helped you?
I have done so far basic swift course with Skip Wilson and i am not sure where to next
 
troll?
 
5:38 PM
me?
no
 
I'm wondering why you'd ask that in the C# room?
 
you can't just walk into a C# room with a droid avatar and ask about iOS
that's suspicious af
anyway, sorry, I know nothing about swift
 
:D oh no i just started swift 3 days ago i am sick of android and C3
..c is preety close to swift
so i just thought
that somebody might know
 
@AndroidFreek C# is quite far from swift in many ways.
It's lipstick on Objective-C.
 
6:04 PM
@TomW that blogger dude is building his own C# compiler
but lol
 
@StevenLiekens Then I really don't understand how he could get that wrong
 
his code looks like it was generated by a tool
 
HA
 
oh it probably was
at least that's what the headr says
 
6:15 PM
I'm not wrong, am I?
The statement I'm picking on doesn't make any sense, right? I'm not stupid?
 
7:01 PM
@TomW IReadOnlyList<T> : IList<T> would be a gross violation of liskov's substitution principle
so, no
you're not stupid
I just see no reason why they couldn't have done IList<T> : IReadOnlyList<T>
I was thinking maybe it would break explicit implementations
that's probably it
yeah because if you explicitly implement IList.Count and then IList is changed to implement IReadOnlyList then you're missing an implementation for IReadOnlyList.Count
 
7:33 PM
Can anyone tell me if I should use a ConcurrentDictionary or a Dictionary to hold a list of string and int's?
211 int's never to be changed...
 
@AshSimpson how is the dictionary populated?
 
7:51 PM
How do you mean?
 
What don't you understand?
 
8:16 PM
@StevenLiekens Because not all lists are read-only.
All of C#'s .*ReadOnly.* classes and interfaces are wonky. It's weird to implement the absence of behavior... I'm sure @JohanLarsson can attest to this ;)
 
the interfaces are ok imo
immutablecollections are ok also
but there are gross things :)
 
@JohanLarsson Hm. I think it's weird since IReadOnlyList<T> is basically "I'm a list that you can't modify" - but interfaces don't have a way to specify some sort of contract that it can't be modified. You could write, for example, public class MyList<T> : List<T>, IReadOnlyList<T> { }, and it'd be perfectly valid.
 
@Jeremy think of IList as IReadWriteList
IList is a superset of IReadOnlyList
from an OO perspective, one should inherit the other
 
@Jeremy Still nice to expose something immutable to the outside no?
I use IReadOnlyList<T> for enumerated IEnumerable<T>
 
@JohanLarsson I agree with that. But class design around interfaces specifying immutability seems fundamentally different, since they're interfaces that specify a lack of behavior, not the presence of it.
Why can't I spell
 
8:27 PM
IReadOnlyList doesn't promise that the object is immutable
 
@StevenLiekens Then why does the interface exist at all?
@JohanLarsson Ah, yeah, that's clever.
 
for APIs that require list input and promise to only read from it
 
@StevenLiekens Oh, right.
 
Is it possible to get PEverify what kind of error each issue is? Some of them only apply for partial trust programs, while others are just invalid.
 
Ohhhhhhhhhhhhhhhhh
I've been getting the purpose of ReadOnly collections all mixed up
 
8:33 PM
List<T> implements the readonly interfaces but IList<T> does not
but it should
 
Yes it is all very inconvenient.
 
but they didn't because it would break existing code -.-
 
In practice, those interfaces are completely useless because they're not integrated into the language properly :/
 
true
that's why I asked if they're still relevant
but it's really no trouble to implement them alongside IList so I guess it's whatever
 
 
2 hours later…
10:49 PM
int[] table; // not int table[]; -- I see this on MSDN explaining arrays... what is the difference?
 
11:15 PM
@bsapaka int table[]; is not valid. int[] means array containing integers. int table[]; would mean (if not a syntax error) an int named "table[]".
 
posted on August 09, 2015 by Scott Hanselman

I have a Surface Pro 3, an iPad 2, and an iPhone 6+. I also have a few Android devices for development. Sometimes I'm on a plane and want to do email, or I'm playing a game on my iPad and I've got my iPhone off to the side. You know, various combinations like you do. For a while I used the Microsoft Universal Mobile Keyboard. It's universally well-reviewed and with discounts is as low as U

 

« first day (1758 days earlier)      last day (3205 days later) »