dotnet-api-docs | NET API reference documentation (NET 5+, NET Core, NET Framework) | DevOps library
kandi X-RAY | dotnet-api-docs Summary
kandi X-RAY | dotnet-api-docs Summary
.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dotnet-api-docs
dotnet-api-docs Key Features
dotnet-api-docs Examples and Code Snippets
Community Discussions
Trending Discussions on dotnet-api-docs
QUESTION
I have a project which contains two files: book.xls
and book.xlsx
. If I run the following code (on .NET Framework) it finds both files as expected, despite only passing .xls
as extension.
ANSWER
Answered 2020-Sep-14 at 07:09It's a known issue which is reported at https://github.com/dotnet/dotnet-api-docs/issues/4052
QUESTION
I've seen several articles talking about not generating too many System.Random
instances too closely together because they'll be seeded with the same value from the system clock and thus return the same set of numbers:
- https://stackoverflow.com/a/2706537/2891835
- https://codeblog.jonskeet.uk/2009/11/04/revisiting-randomness/
- https://docs.microsoft.com/en-us/dotnet/api/system.random?view=netframework-4.8#instantiating-the-random-number-generator
That appears to be true for .net framework 4.8.
Looking at the source code for .net core, however, it looks like instances of System.Random
generated on the same thread are seeded from a [ThreadStatic]
generator.
So it would seem to me that, in .net core, you are now safe to do something like:
ANSWER
Answered 2019-Aug-23 at 18:29Is this true? Am I missing something?
I believe your reading of the source code is correct. But you shouldn't rely on this behavior unless it's documented. My guess is that the documentation simply hasn't kept up with the implementation, but you can open an issue here to get the docs updated.
.NET Core has lots of little enhancements like this that you might hesitate to make to .NET Framework for backwards-compatibility reasons.
QUESTION
This question is asked in the context of ASP.NET WebApi 2 (not ASP.NET Core). I have tried to do my own research on this topic, however I could not find the explicit answer to this.
The official MSDN documentation for the ConfigureAwait(...)
method parameter states following:
true
to attempt to marshal the continuation back to the original context captured; otherwise,false
.
Stephen Toub further explains the attempt
keyword as follows:
That means there may not be anything to marshal back to... there may not be a context to capture, e.g.
SynchronizationContext.Current
may returnnull
.
If I understand it correctly, then this is not the case for the ASP.NET WebApi 2, because there is AspNetSynchronizationContext
present, right?
Now lets take a look at following controller action method:
...ANSWER
Answered 2018-Nov-24 at 10:09When asked in the negative form like that the answer is, i think, pretty clear - there is no guarantee that the second half will be executed on a different thread to the first half. As you speculate, the original thread might well be the lucky next-to-be-picked available thread, when the continuation is up for executing.
Also important to note is that it's the context, not necessarily the thread, that is restored. In the case of a Windows message loop (e.g. WinForms UI thread), it is the UI thread running the message loop that picks up and executes the continuation, hence with ConfigureAwait(true)
, the same thread is guaranteed. With other SynchronizationContexts, though, there might be no particular reason to require or even prefer the original thread, as long as whatever is considered by them to be "context" is restored; e.g. HttpContext.Current
[, identity, culture] in ASP.NET.
There is also an at-least theoretical chance that HeavyIo()
completes synchronously, in which case there is no context-switching anyway, and the second half will simply continue on the same thread as the first. I can only assume from your choice of naming ("heavy") that you're implying this won't be an option.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dotnet-api-docs
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page