« first day (3509 days earlier)      last day (1426 days later) » 

6:34 AM
Hi Guys! I need some help, please! My code was running perfectly on Friday and today I'm getting some error: "The underlying connection was closed: An unexpected error occurred on a send."
I've upgraded the code from .net framework 3.5 to .net framework 4.5 and added this ` ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
`
However, I'm getting the same error. The API endpoint I'm trying to reach hasn't changed anything... so this must be on the client (.net) side
what else should I be looking for ?
 
Morning o/
@AngelinCalu Usually you shouldn't have to touch .SecurityProtocol, as the two computers use the highest one available to both of them.
 
\o
 
Congratz on arriving in the almost today with going to 4.5 though.
 
@Squirrelkiller, Morning! So... what else could it be?
 
6:49 AM
Good question, and that error message is not at all helpful. Hosting in IIS?
Maybe the App pool isnt started or something
 
Well, I'm using .NET to create a library to be used in some software, and the recommended framework there is 3.5
 
"Almost today"? .NET 4.5 is 8 years old my man @Squirrelkiller
 
Sorry I'm biased, I upgraded our product from 4.5 to 4.6.2 like two weeks ago.
 
there's no "app pool" .. I'm not using ASP.NET, the API is some web based PHP application on some web domain...
 
I...wasn't aware PHP ran on .NET Framework.
 
6:52 AM
it doesn't
it will just provide the API endpoint for any client that would make requests ...
given that the right credentials are set
 
What kind of application is running in .NET Framework then? Can the PHP program call the .NET program?
 
the .NET Framework app is just making the requests to the API endpoint (it doesn't really matter if it's PHP or whatever)
it's a HttpWebResponse
var httpWebRequest = (HttpWebRequest)WebRequest.Create(urlPath);
 
Oh it's a client app! I was thinking the other way around all this time lol
 
sorry if I've miss-leaded you
 
Don't worry, I'm working with a .NET server so that's like my standard mindset :)
Could try doing the same request using an HttpClient, but that's just brainstorming. I guess that error could be lots of things.
 
6:58 AM
I've used insomnia and Postman to replicate the request
it works just fine
and from within the .net app the request is never hitting the API endpoint
 
I mean use HttpClient in .NET instead of WebRequest
 
the "client" is using Windows Server 2012 R2
 
That should have no TLS problems then
 
@AngelinCalu Did the env change? Can be on both client and server
 
nothing...
everything should be exactly the same.
I'm in control of the API side and did nothing there over the weekend
 
7:05 AM
Did you remove the added ServicePointManager.SecurityProtocol?
 
Only some installation on the "client" side could have been possible
haven't tried removing it
could that help ? I've only added the other options, but removing it entirely... could that help?
 
Morning
 
@bradbury9, Morning!
 
@AngelinCalu For sure, try it. You changed .NET3.5->4.5 AND added that.
Roll back the easy one and see what happens
 
I had it before but it only supported SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
 
7:12 AM
try that
 
and I wouldn't have changed from .NET3.5 -> 4.5 if I wouldn't have had this problem
 
?
It didnt work before?
 
on it, will let you know how it worked in a few moments
so, Friday it worked, and now it doesn't, and I hadn't updated anything during the weekend. The Friday version was on .NET 3.5 and with securityProtocolType SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls; as those are the only supported protocols in .NET3.5
I'm getting the same "The underlying connection was closed: An unexpected error occurred on a send." even when I've removed ServicePointManager.SecurityProtocol entirely
 
That's one fewer potential error source we have to worry about
 
:) what else could it be ?
I've excluded all the imported .dll files which belong to that software where I'm running my .dll and made a "standalone" version of it
which I'm referencing in a new .NET45 Console application. the request is going through perfectly
so that means it must be something related to the machine where the code is running, right?
maybe there is a way to check if my app cannot open sockets for requests to and from my endpoint API
something like a ban for my URL ?
 
7:36 AM
Do you use Git? Stash all your changes and go back to the .NET 3.5 version to see if that still works?
(The server can have changed w/o your knowledge)
 
I have a .dll version specific to what it was last Friday and it doesn't work...
 
7:57 AM
maybe the service you are calling changed
and it now only accepts tls2.0
 
^
 
Wait what we just updated to everything using tls1.2
 
Eh
Don't you mean 1.3
Although nobody would update to only that so quickly
1.2 was released in 2008 and it took 12 years for it to become the lowest widely supported protocol. 1.3 was only released in 2018 so 1.2 support is going to be fine for a while yet
 
8:13 AM
hmm... or 1.2
it is a while ago for me, so I dont remember everything clearly
 
So, you're saying if I'll switch to using HttpClient instead of HttpWebRequest then the tls version would not matter any more ?
 
the tls version would still matter, but maybe the default setting would change
 
8:33 AM
I've checked the registry key at: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols
I only have SSL 2.0 there
very strange
 
Well I don't have anything
So I don't think that's a reliable source
 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\ Release = 528049
which according to docs.microsoft.com/en-us/dotnet/framework/migration-guide/… should mean that I have .NET Framework 4.8 installed, right?
 
but, how are things really working? can I use a .dll which is made in .NET48 in an application which was made with .NET35 ?
I don't know why in the documentation they are saying that the .NET framework used for .dll files to extend the software's functionality should be .NET35...
 
Wait what
no you can't use a 4.8 assembly in a 3.5 app
 
8:46 AM
that's what I thought
 
Well, you can, but it'll be running in the 3.5 domain
So any newer features won't be available because the appdomain is running on 3.5
 
so, how can I use the tls12 protocol on .net35 ?
 
You can't
I'm guessing
 
nice :|
 
You do
There is a trick
 
8:47 AM
please, do continue :D
 
Why not update the base application so it's not targeting a 15 year old framework
 
that's not in my hands...
 
Instead using the enumeration that does not exist, hardcode the underlying value of the enumeration
 
Oh sorry it's only 13 years old
 
I've read something about this... like use the numerical value
 
8:48 AM
That is what I mean
Do note that whoever reads that in the future would think "WTF is this!"
 
I think nobody will read it in the future :D
but it might be so that the solution only works if the assembly is made with .NET40+
 
I mean why is it even targeting 3.5? Is your app running on windows 2000 or something?
 
it's running on windows server 2012 R2
 
omg
update your damn frameworek
 
The system has .NET framework 4.8 installed
 
8:51 AM
I'm running 4.8 apps and netcore 2.1, 3.0 and 5 apps on 2012 R2
 
the software that should run my .dll is not mine to modify in any way...
 
"I think nobody will read it in the future" well, once I wrote in the beginning of a stored procedure "welcome to hell, leave the taste for proper TSQL at home" in a very hacky procedure, and several months later, changing some logic I said "OMG I am screwed"
 
Tell the vendor to update their damn shit
 
@bradbury9 lol
@CaptainObvious they did, but they haven't thought about backward compatibility on some stuff, and the company I work in decided that the latest service packs for it won't be installed.
 
8:54 AM
+1 on the update suggestion
 
it's out of my "reach"
 
Looks like you have an ultimatum for them
"Install the service packs or this new functionality won't work"
 
I'm not a software developer
I'm just trying to make my life easier, by extending the software functionality and automate some tasks
 
waaaaaaaaaaaait
HES A FOREIGNER
 
8:55 AM
@AngelinCalu said in the c# chat of stackoverflow...
 
I can code... :D
I do PHP, Javascript, Python, ... little bit of everything
but I don't work as a software developer...
 
ew, ew, ew
you have bad taste
 
Maybe not a professional coder, but you are a coder.
 
yes, let's call me a non-professional coder :D
 
you only do coding for a hobby?
 
8:57 AM
How long have you been "non-professionally" coding?
oh
 
I also do it for work... to help myself through the tasks
 
christ, I've just thought about my answer to that question and now I feel old
 
since 2001 :)))
so, I've been coding non-professionally for almost 20 years
 
oof
I've only been playing with code for 11 years. But professionally for nearly 5
i'm 24
 
> I also do it for work
so, you are a professional software engineer?
;)
 
9:00 AM
Nah
 
naaah
 
He might be a professional coder
 
yaaaas
 
Because he codes for his job
 
have never coded an application for distribution
 
9:00 AM
But his job isn't primarily developing software, so I don't think that one works
 
is there a significant difference between software engineer and coder?
 
or for anyone else than my own interest...
 
The $
An engineer is paid much more allegedly for more responsability
 
I am an engineer, ... but not a software engineer
I design ships
 
I design shit
unfortunately, it often doesnt turn out to be shit
 
9:03 AM
as in.. structural analysis for vessel's steel structures
 
Thats... interesting
So what were you trying to automate/code
 
ohh... there's a ton of work which can be handled with a single click
 
I design software (but my titulation is not software ingineering) and I know more than many of my engineer coworkers
 
the only barier is the mentality
I think I found a good resource for my issue: support.microsoft.com/en-us/help/3154520/…
 
Looks like a decent result actually
 
9:06 AM
you could also specify that you want to use TLS 1.2 in your code rather than in your environment
 
Understanding KISS principle, usability and having an analytical mind is key. API's frameworks, etc... is just a matter of experience
 
Here's a fun question for everyone then, what do you develop? What sort of industries, users, etc
 
@Wietlol Indeed, hardcoding the 0x00000C00of the 1.2 enumeration
 
industry? insurances... all of them... and more stuff that is totally not related to insurances
users? pretty much everyone in ze netherlands
@bradbury9 no, no, no
there is something special
 
Oh and what do your softwares do too
 
9:10 AM
77
A: Update .NET web service to use TLS 1.2

John WuAdd the following code before you instantiate your web service client: System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; Or for backward compatibility with TLS 1.1 and prior: System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

this one
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
or
System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
our software (primarily) compares insurance products by various providers
we have websites for end users (people that want to do everything themselves)
we have websites (and a slightly bigger platform) for intermediaries... brokers? iDunno the english word, but people that would take care of all the insurance shit for you if you are too lazy or just dont want to bother
 
What do you code?: At the moment tax related TSQL procedures for the regional government. Before that about 10 years of coding corporate stuff (ERP, interfacing systems, BI, corporate websites) and also regional government websites
 
So like a comparison website?
 
on top of insurances, we also provide comparisons for energy providers and other similar products
 
guys, I can't even get the IT department to install Vistual Studio for me at work...
 
insurance related advisor Wietol
 
9:15 AM
some of them are not yet in production, so that is as much information as I may give
well... I dont know shit about insurances... I just make the system
 
Yeah there's a few companies which do that sort of thing over here
 
it is like a comparison website, but you can also order that particular product on that website
you never have to leave our website to get everything done
 
Yeah, that's the sort of thing I'm on about
Sounds like the same sort of thing as Moneysupermarket or Comaprethemarket
I work in warehousing & fulfillment, and my systems look after same day fully tracked picking and packing of thousands of orders for more thousands of stock items in multiple warehouses
 
moneysupermarket is pretty much what we do, yes
taking a quick look at their website
 
I enjoy my stuff because it's heavily multi user, but all actions affect other areas of the system and the changes have to happen realtime otherwise orders could end up being processed multiple times
 
9:20 AM
ok. I've managed to get the same error on my standalone environment
Now I have a Inner Exception
IOException: received an unexpected EOF or 0 bytes from the transport stream.
 
good morning
 
@CaptainObvious orders being processed multiple times?
 
@AngelinCalu You using webclient? Check this question with the same error
 
I'm only retrieving some key->value pairs as JSON from my API endpoint
no files are being copied...
and I have a WebRequest... which I think != webclient
 
9:48 AM
So, the issue is now FIXED
I've followed this support.microsoft.com/en-us/help/3154520/… to make it work
 
10:02 AM
and, I'll stop there. I'm embarrassed to say why it took so long to fix it :))
 
I have had easier issues that took longer to fix
no need to be embarrassed
 
@Wietlol Thanks for the nice words!
as it turns out, some other user was keeping my file locked for writing and I have some script which should overwrite the file whenever a new version is found...
and I just haven't thought about checking if the new versions are being "deployed"
:|
 
10:20 AM
Once I had a compiler error of a perfectly declared variable line. That line commented and put int the next line raised no errors. That troubleshooting took long (weird as fuck Visual Studio behavior)
 
10:42 AM
that might be a not trivial hidden character error, which usually takes a LOT of time to troubleshoot
 
(.
 
11:19 AM
"variable is not declared" Yeah, it is, right there! You moron compiler!
The funniest spinoff of that is once a coworker had, signing XML files, when validating because of the unprinted character in the XML declaration the validation raised it was not similar. My coworker did a visual check and asked for help. "Am I missing anything?" My answer was "nope, looks like identical, have you checked unprinted characters?"
 
@bradbury9 I had a compiler error yesterday, it took me about 20 minutes to figure out what the cause was... and it would have taken me much MUCH longer if I hadnt remember a problem from earlier that had a similar cause
 
Yeah, that was my point when saying that formal titulation is not enough. It helps yeah, but experience is key when coding
 
ye... but even then, I am trying to make a minimal example out of it because it is one of the horrors of an extremely useful language feature
it is definitely my most favorite language feature, but can lead to some interesting results
although, the issue this time was caused by interop
so... in simple terms, my code was like
add(TreeView(content, resourceManager).apply {
	isRootVisible = false
	showsRootHandles = true
	cellRenderer = CellRenderer(resourceManager, selectionColor)
	isOpaque = false
})

/* translated to C#:
var treeView = new TreeView(content, resourceManager);
treeView.IsRootVisible = false;
treeView.ShowRootHandles = true;
treeView.CellRenderer = new CellRenderer(resourceManager, selectionColor);
treeView.IsOpaque = false;
Add(treeView);
*/
now... I did this fiddling until I had it exactly how I wanted it to be... and since TreeView is a class of mine, I could set those settings at the constructor or initializer of the class
so, at the TreeView class, I put
init
{
	isRootVisible = false
	showsRootHandles = true
	cellRenderer = CellRenderer(resourceManager, selectionColor)
	isOpaque = false
}
and removed the apply stuff on the adding
now... stuff broke
it was a perfectly fine refactoring, except that the result was different
now... spot the issue
 
12:12 PM
@Wietlol Something fishy with your CellRenderer
 
nope
the resourceManager and selectionColor are properly passed to the CellRenderer
 
Anyone know of a commercially free to use image to pdf converter library?
 
the CellRenderer itself is also perfectly fine
 
We're currently using iTextSharp 4, before it was free to use then
@Wietlol oh right I forgot it's Kotlin code lol
 
ye, the C# translated code would be CellRenderer = new CellRenderer(resourceManager, selectionColor)
 
12:15 PM
The init never got called?
 
init gets called, and everything runs in the correct order
it runs after the constructor of TreeView and its parents, just as the first code snippet did
 
And you just went add(TreeView(content, resourceManager) in the outer function then?
 
ah, yes
forgot to snippet that part
cant you still use iTextSharp 4 considering it is still free?
just dont upgrade to iTextSharp 5
 
i accidently got some pepper spray on my hands
it burned for 2 day sstraight
although i washed my hand slike 20 times
 
"Pepper" spray
 
12:22 PM
cant imagine how it feels if you get that in your eyes
 
Why even have pepper spray when you're not a black man in the USA
 
woman?
or a black transgender woman?
 
I carry peper spray and a knife all the time
 
while we are at it
 
Fair enough. Hans is a woman then.
 
12:23 PM
who is also an immigrant
 
first i ll spray you ass then cut your head off
thats the plan
 
and perhaps has growth... thing... I forgot what it was called
 
@Wietlol Unfortunately, iTextSharp from 8 years ago doesn't know about HEIC, which was invented like 2 years ago.
 
what is HEIC?
 
where are the other squirrels
 
12:24 PM
Exactly
 
and the roach
and neil
 
Turns out it's a new lossy/lossless image format/codec
Made by MPEG, first widely adopted by apple.
 
hmm..
well... considering you use your stuff commercially... what stops you from paying for some solution that someone made?
how much does it cost you on a monthly basis?
 
Bosses don't like to pay. Will have to if there's no other solution though.
 
yet, your boss pays you to make solutions for him, and continues to pay for the hosting and storage and maintenance to keep them running
why should your boss not pay someone else who already completed the solution?
ofcourse, if you find another free solution, it would make much sense to just use that
but... you need to find that solution, possibly refactor a ton of applications to make them use that solution instead, which in total can sum up to quite a bit of development time
how valuable is that development time?
 
12:42 PM
We will see. For now I'll implement the usual images, and worry about HEIF then. If it doesn't work I will find alternatives anyway and give the company a choice about what to do. I'm just the guy using the resources I have. Company gets to decide about what resources I have.
 
!~shiba
 
ugh
!~shiba
 
1:15 PM
Hey All, may I please know if someone has the code for the IListExtension class? Basically, it needs to have RemoveRange, AddRange,etc., If yes, could you please send me the url to the website containing said extension class
 
Microsoft.ML.Probabilistic.Collections.IListExtensions?
Also I smell that smelly smell
||xy
 
1651
Q: What is the XY problem?

GnomeWhat is the XY problem? When asking questions, how do I recognize when I'm falling into it? How do I avoid it? Return to FAQ index

 
If you're wondering about the implementation of a framework method, you should usually take a step back.
 
remove range... add range... what are you doing with that list? what did that list ever do to you to deserve this?
 
1:37 PM
@Squirrelkiller Thank you. Also, I was looking through the API ( dotnet.github.io/infer/apiguide/api/… ), but I could NOt find a RemoveRange? Could you please tell me if there is an equivalent RemoveRange method within the Microsoft.ML.Probabilistic.Collections.IListExtensions API?
 
@crazyTech Maybe first find out which class specifically you're trying to learn about?
Because you haven't answered my question: Microsoft.ML.Probabilistic.Collections.IListExtensions?
Or another one?
 
I just need IList extensions for the standard System.Collections.Generic.List C# API
?
that's what I need
 
you can just use a.Except(b).ToList()
it does produce a new list tho instead of mutating the original
 
anyone use calilburn micro for WPF
 
btw, @Squirrelkiller the problem that I had was this
and visibility modifiers
so, in Kotlin, like C#, we have properties
the compiler generates a getter/setter function and a backing field
so, in C#:
 
1:51 PM
well it needs something to hold the value
 
public CellRenderer CellRenderer { get; set; }
 ==
private CellRenderer _cellRenderer;
public CellRenderer GetCellRenderer() => _cellRenderer;
public void SetCellRenderer(CellRenderer cellRenderer) { _cellRenderer = cellRenderer; }
in Kotlin (Java):
private CellRenderer cellRenderer;
public CellRenderer getCellRenderer() { return cellRenderer; }
public void setCellRenderer(CellRenderer cellRenderer) { this.cellRenderer = cellRenderer; }
so far no problems
when I do treeView.cellRenderer = x; in Kotlin, it invokes the setCellRenderer() method
however, in Java (where the parent of the TreeView class comes from), these properties do not exist, both the field and the getter/setter are declared and have different behavior sometimes
Kotlin would prioritize the direct field access if possible
the cellRenderer field happened to be protected
so, inside the TreeView class (which has access to the field), it directly wrote to the field
while outside the TreeView class, it wrote using the setter
I had to change the initializer to do
init
{
	isRootVisible = false
	setShowsRootHandles(true)
	setCellRenderer(CellRenderer(resourceManager, selectionColor))
	isOpaque = false
}
the rootVisible and opaque didnt have any different behavior for the setters
but the root handles and the cell renderer did have different behavior
that was the difference between the two seemingly identical pieces of code
this issue can only happen with interop with Java classes tho
since it needs to be a combination of a setter and an explicit backing field, and in Kotlin, you cannot make backing fields
 
@crazyTech Most if not all of the extension method on IList are actually on IEnumerable. They come with LINQ.
 
ok
 
What are you actually trying to do?
 
Thanks
just trying to reengineer some code that uses List<T>. But, I'm working on something else now
 
 
2 hours later…
4:23 PM
How to push a buggy feature into your stable branch?
Xamarin: call it a preview feature.
 
 
2 hours later…
6:22 PM
Hey all, is there a clever file naming convention for create/alter table sql server script? (For example, for update/insert rows or records, it's upsert) is the something clever like that?
 
 
4 hours later…
10:26 PM
 

« first day (3509 days earlier)      last day (1426 days later) »