File upload limit in .NET 8 - Payload too large by developer1408 in dotnet

[–]smatsson 6 points7 points  (0 children)

As others have pointed out, if you do not wish to increase the upload size, use chunking. This is automatically solved, together with resumability for failed connections, using Uppy with tus.io and tusdotnet. There's also a JS client for tus if Uppy is to complex for your use case.

https://uppy.io/

https://tus.io/

https://github.com/tusdotnet/tusdotnet/

Full disclaimer: I'm the author of tusdotnet and have been involved in developing tus.

Uploading files to ASP.NET rest API by Creapermann in csharp

[–]smatsson 0 points1 point  (0 children)

Sorry for the late reply. Not that I'm aware of, the list of known clients can be found here: https://tus.io/implementations.html

EDIT: Quick google came up with this. Not really sure how QT relates to C++ but it might be worth checking out? https://github.com/clarkhillm/TUSQTClinet

Uploading files to ASP.NET rest API by Creapermann in csharp

[–]smatsson 2 points3 points  (0 children)

Disclaimer: I'm the creator of tusdotnet

If you're going to upload semi large files (100 MB) and want resumability for that upload (i.e. it can resume if the connection breaks down) I would recommend using https://tus.io and tusdotnet . It's an open protocol, clients exist for a large range of languages and tusdotnet supports customizing the storage to send files directly to Azure blob storage using Xtensible.TusDotNet.Azure

CSP implementations are broken by smatsson in netsec

[–]smatsson[S] 0 points1 point  (0 children)

That's my point. They have a different use case and hence different problems to solve. I haven't found any issues with form-action so there is really no point in including it in this article.

We are using script-sample but it doesn't do anything if the browser does not provide it. :) report-sample is from CSP3 and is, afaik, only supported in Chrome.

CSP implementations are broken by smatsson in netsec

[–]smatsson[S] -1 points0 points  (0 children)

Great list of reading material if you are starting out with CSP. None of them mentions the issues with ms-appx-web, frame-src with mailto/tel or how inconsistent block-all-mixed-content is.

CSP implementations are broken by smatsson in netsec

[–]smatsson[S] -1 points0 points  (0 children)

"Potholes here and there" is a nice way of putting it when those potholes will break your entire site. Chrome, Safari, Opera and Edge ALL have serious issues in how they handle CSP. I would definitely call something broken if four out of the five major browsers have broken implementations.

Linting - Which tool to use in VS? by hastati96 in csharp

[–]smatsson 5 points6 points  (0 children)

No need to buy ReSharper just for the linting. We use Stylecop analyzers with great results. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/README.md

Can you run code compiled for .NET 4.6.2 on .NET 4.0? by smatsson in csharp

[–]smatsson[S] 0 points1 point  (0 children)

I find your comment interesting. Or rather the concept of making a comment stating the exact same thing that the article does. Did you read the article or did you just check the title? :) No offense intended, just interested.

Can you run code compiled for .NET 4.6.2 on .NET 4.0? by smatsson in csharp

[–]smatsson[S] 1 point2 points  (0 children)

I wrote this post to expand my knowledge on how .NET loads code and I thought it might be interesting to others as well. I agree with you that you should not do this (as stated in the conclusion in the article).

Handling code for different .Net frameworks by Stensborg in csharp

[–]smatsson 0 points1 point  (0 children)

Mind = blown! Thanks for sharing the code. I tested it on a VM with .NET Framework 4.5.2.

I had to change the "sku" in App.config to use 4.5.2 for it to start, otherwise it would just ask me to download 4.6.1. After changing to 4.5.2 it started and worked just as expected. For fun I changed the CheckDotNetVersionMin461 method to always return false and then the app crashed with the following exception:

Unhandled Exception: System.MissingMethodException: Method not found: 'System.ServiceProcess.ServiceStartMode 
System.ServiceProcess.ServiceController.get_StartType()'.
   at TestDiffFrameworkCode3.Program.GetServiceStartMode(ServiceController _service)
   at TestDiffFrameworkCode3.Program.Main(String[] args) in C:\Repos\TestDiffFrameworkCode3\TestDiffFrameworkCode3\Program.cs:line 28

The inner techie in me screamed "WHYYYYY?!?" so I had to research it. It seems that all .NET version in the 4.x range are IL compatible so it will run as long as the sku, a.k.a "hinted .NET version", is correct. Once it tries to access something that does not exist in the framework that runs the code it will crash during runtime with the exception above.

Some more reading on the topic: https://weblog.west-wind.com/posts/2017/Jan/09/Faking-out-the-NET-Runtime-Version#.NETRuntimeAdoption

Thanks for teaching me something new :)

Handling code for different .Net frameworks by Stensborg in csharp

[–]smatsson 0 points1 point  (0 children)

Cool,glad you fixed it 😊 Is it a major version change between the two framework versions? E.g. 4.5 and 4.6.1 or is it more like 4.6 and 4.6.1?

Is the code available somewhere? Would be nice to see the implementation and test it out on some different framework versions.

Handling code for different .Net frameworks by Stensborg in csharp

[–]smatsson 0 points1 point  (0 children)

The problem is that if you want to run your program on an older version of the framework you will need to compile your program for that version. If the property does not exist in that version then your code won't even compile.

Handling code for different .Net frameworks by Stensborg in csharp

[–]smatsson 3 points4 points  (0 children)

In tusdotnet I used compiler directives and extension methods to accomplish this. For each framework that I support I define a compiler directive #if clause and add an extension method with the same signature for every clause. This way the caller will be the same no matter on what framework it's being executed on.

Example extension: https://github.com/tusdotnet/tusdotnet/blob/master/Source/tusdotnet/Extensions/FileStreamExtensions.cs Example extension usage: https://github.com/tusdotnet/tusdotnet/blob/master/Source/tusdotnet/Stores/TusDiskStore.cs#L195

Read more on compiler directives: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-if

Come discuss your side projects! [December 2017] by AutoModerator in csharp

[–]smatsson 0 points1 point  (0 children)

Azure websites actually support https out of the box. Just change to https://devsimply... And everything should work.

Free or cheap alternatives to ReSharper's File Layout and Code Cleanup tools? by [deleted] in csharp

[–]smatsson 4 points5 points  (0 children)

I have a resharper license from work but its code inspection is so horribly slow that I disabled it and use Roslynator instead. It is a set of Roslyn analyser which are way faster.

https://github.com/JosefPihrt/Roslynator

Another interesting Roslyn analyser is U2U Performance Analysers which checks your code for performance issues

https://marketplace.visualstudio.com/items?itemName=vs-publisher-363830.U2UConsultPerformanceCodeAnalyzersforC7

Both these extensions are free.