Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 27 23:08

    JRahnama on 3.1

    moving projects to correct serv… (compare)

  • Sep 27 22:50
    carlossanlop commented #43133
  • Sep 27 22:16
    JRahnama commented #43133
  • Sep 27 11:55
  • Sep 26 16:57
    danmoseley commented #43133
  • Sep 25 04:24
    dnfadmin commented #43138
  • Sep 21 12:05
  • Sep 19 09:02
    dnfadmin commented #43138
  • Sep 18 06:29
    ansergeyg starred dotnet/corefx
  • Sep 17 05:17
    dnfadmin commented #43138
  • Sep 17 03:50
    koki-nakamura22 starred dotnet/corefx
  • Sep 14 18:45

    carlossanlop on 3.1

    Merge in 'release/3.1' changes Merge in 'release/3.1' changes Update dependencies from https:… and 4 more (compare)

  • Sep 14 18:45
    carlossanlop closed #43160
  • Sep 14 18:45
    carlossanlop commented #43160
  • Sep 14 17:29
    carlossanlop reopened #43160
  • Sep 14 17:29
    carlossanlop closed #43160
  • Sep 14 17:29
    carlossanlop commented #43160
  • Sep 14 14:42
    AdamOswald starred dotnet/corefx
  • Sep 14 10:53
    wujiyu115 starred dotnet/corefx
Matthijs ter Woord
@mterwoord
net47 doesn't seem to understand portable format for that
Jose
@pepone
I'm using 5.0.1 on Linux
Matthijs ter Woord
@mterwoord
ah, not sure then..
Joseph Musser
@jnm2
@pepone the PDBs from your library don't get included into the application that uses your library IIRC
If you wanted to force the issue, you could use DebugType=embedded
I don't like embedded PDBs in libraries that I use in redistributable apps
Jose
@pepone
Thanks, @jnm2 I using portable with source indexing and this works great for debugging, but having exceptions stack traces annotated with line numbers would be great to have, this will help to track issues that happen once the application is deployed
Jan-Willem Spuij
@jspuij
@pepone Just stating the obvious but you are creating symbol packages and distribute them as well?
Magnus Grindal Bakken
@magnusbakken

Hello,

I have a System.Text.Json problem. I recently upgraded my API code to .NET 5, and I'm looking into converting the serialization provider from JSON.NET to System.Text.Json. Standard serialization/deserialization works fine, but I'm having trouble converting a particular pattern.

In my API I have a few places where I distinguish between null inputs and undefined in the input JSON. Specifically, null means "remove this value" and undefined means "keep this value as it is".

The way I've implemented this is with the approach described here: https://github.com/alberto-chiesa/SettableJsonProperties. I have a type Optional<T> which distinguishes between null and undefined, an OptionalJsonConverter which converts literal null properties to null and omitted properties to undefined, and a custom contract resolver that relies on the ShouldSerialize-metod, as described here: https://github.com/alberto-chiesa/SettableJsonProperties/blob/master/SettableContractResolver.cs.

STJ doesn't have custom contract resolvers (dotnet/runtime#31257, dotnet/runtime#36785 ), nor any sort of equivalent of the "ShouldSerialize" pattern, as far as I can tell. I can't figure out a decent workaround, so I'm basically stuck here. Has anyone else done anything similar?

Jose
@pepone
Hey guys, what package do I need to use source code generators with .NET 5.0, I added Microsoft.CodeAnalysis.Common" Version="3.8.0" but getting generator.dll: Could not load file or assembly 'System.Runtime, Version=5.0.0.0'
Joe4evr
@Joe4evr
@pepone I believe source generators have to target netstandard2.0 because they're loaded in-proc
Jose
@pepone
@Joe4evr but can I reference the generator in anet5.0 project?
Matthijs ter Woord
@mterwoord
yes
the compiler loads it, not your process.
you can use source generators in .net5 projects, but also .net core 3.1, or .net framework projects. you just need language level 9
Jose
@pepone
not working for me with Visual Studio 2019, I getting the above error when referencing the generator from a .NET 5.0 project
Matthijs ter Woord
@mterwoord
reference is correct?
how is the reference done?
Jose
@pepone
seems that because I first target .NET 5.0 with the generator, the DLL was still loaded, now is loading fine
I cannot navigate to the generated code but that is probably a different issue
akima15
@akima15

Can someone please explain what things you guys take into consideration when deciding whether to use[MethodImpl(MethodImplOptions.AggressiveInlining)]?

It's used very often in methods that are extremely small and I'd expect the JIT to inline them always but I'm guessing that there are cases where this wouldn't happen without this attribute? perhaps if its called many times in a single method?

akima15
@akima15

I have a method whos code size in IL is 34 bytes that is getting inlined but another simliar one that isnt getting inlined and its IL code size is 30 bytes. So far my conclusion seems to be the JIT is dumb and I should use this attribute in most cases where I want performance.

I need an expert to shime in and please correct me if I'm wrong.

HaloFour
@HaloFour
JIT takes a lot more into consideration than just code size
Matthijs ter Woord
@mterwoord
i'd definitely say jit is very smart, but it can be wrong on occasion
Note that it isn't exhaustive and for the classic framework
Matthijs ter Woord
@mterwoord
you want it to inline the Reset1 method? i think there's hardly anything to gain here
only overhead is 1 call and 1 return
akima15
@akima15
@mterwoord Unnecessary overhead and it takes more ASM instructions than would otherwise be required if the call to Reset1() was inlined. Usually not inlining a method and instead calling it gets you less executable binary bloat.
The point is that the JIT doesnt seem very smart here.
In fact the Reset1() method doesnt use anything that is listed in the article given by @jspuij which would 100% prevent the JIT from inlining it.
masonwheeler
@masonwheeler
File an issue then.
akima15
@akima15

Ok but I asked because I needed an answer for now not for .NET 7.

There also should be a way to JIT compile a specific method without calling it or all methods at runtime.

I've tried Ready2Run but everything runs slower and NativeAOT is still experimental.
Paul M Cohen
@paul1956
What do I need to access System.Windows.Automation from a Core project? I am porting from Framework. I am looking to use AutomationElement and Connection and the Framework Interop NuGet package I was using doesn’t support Core.
it looks to be part of wpf
Paul M Cohen
@paul1956
But my app is WinForms. Is there any way to still use it? I have same issue with Media API.
Joseph Musser
@jnm2
@paul1956 You need to set <UseWPF>true</UseWPF> in your project file along with <UseWindowsForms>true</UseWindowsForms> if you want to access WPF assemblies.
Paul M Cohen
@paul1956
Thanks no idea you could specify both.
Matthijs ter Woord
@mterwoord
I'm pretty sure it's a bit off topic here, but: We're having difficulties with our linux build agent. suddenly it cannot download tasks. timeouts occur after 20 minutes. Anyone experienceing this?
Paul M Cohen
@paul1956
I just installed VS 16.9 Preview 4 and it can't find 5.0.100-alpha1-015536 SDK. when I look in C:\Program Files (x86)\dotnet\sdk it only has Rollback. Where can I download the SDK?
dotnet --list-sdks list none
Paul M Cohen
@paul1956
The one I want to use is 5.0.200-preview.21079.7
When I run dotnet --list-sdks I get below
5.0.103 [C:\Program Files (x86)\dotnet\sdk]
Light
@PylotLight
Looking for the correct room for WinUi3, attempting to update UI thread, but having trouble.
Michael Fry
@nth-commit
Does anyone know of any good docs on writing custom LINQ implementations. It's really hard to search for because everyone's asking about IEnumerables when talking about LINQ. There's definitely some magic there that I've been prodding away at, and would really benefit from a proper understanding of. The only thing I've found which mentioned this was like "see an example of this in the AsEnumerable docs". The AsEnumerable() docs: https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.asenumerable?view=net-5.0
8 replies
masonwheeler
@masonwheeler
If you want a good explanation of how Linq works, look up Jon Skeet's Edulinq series of blog posts.
1 reply
Isobel Cullen
@isobel-cullen
I cannot believe that this use-case is unsupported: https://dotnetfiddle.net/elSDwz (System.Text.Json + Record Types)
Michał Zegan
@webczat
seems to be the reference handler limitation, not actual not supporting of records