text:
Event Loop Is Closed crash

Summary
Event Loop Is Closed prevents starting bot.
Reproduction Steps
Use the current version
Start your bot
Code
bot.run(token=token)

Expected Results
The bot starts up
Actual Results
this error:
Traceback (most recent call last):
File "K:\coding\Other\notificationBot\sb.py", line 117, in
bot.run(token=token)
File "K:\coding\Other\notificationBot\venv\lib\site-packages\discord\client.py", line 938, in run
asyncio.run(runner())
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "K:\coding\Other\notificationBot\venv\lib\site-packages\discord\client.py", line 927, in runner
await self.start(token, reconnect=reconnect)
File "K:\coding\Other\notificationBot\venv\lib\site-packages\discord\client.py", line 857, in start
await self.login(token)
File "K:\coding\Other\notificationBot\venv\lib\site-packages\discord\client.py", line 698, in login
data = await state.http.static_login(token.strip())
File "K:\coding\Other\notificationBot\venv\lib\site-packages\discord\http.py", line 991, in static_login
await self.startup()
File "K:\coding\Other\notificationBot\venv\lib\site-packages\discord\http.py", line 562, in startup
self.super_properties, self.encoded_super_properties = sp, _ = await utils._get_info(session)
File "K:\coding\Other\notificationBot\venv\lib\site-packages\discord\utils.py", line 1446, in _get_info
bn = await _get_build_number(session)
File "K:\coding\Other\notificationBot\venv\lib\site-packages\discord\utils.py", line 1474, in _get_build_number
build_url = 'https://discord.com/assets/' + re.compile(r'assets/+([a-z0-9]+).js').findall(login_page)[-2] + '.js'
IndexError: list index out of range
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000001FF7C6C38B0>
Traceback (most recent call last):
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 751, in call_soon
self._check_closed()
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 515, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000001FF7C6C38B0>
Traceback (most recent call last):
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 751, in call_soon
self._check_closed()
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 515, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000001FF7C6C38B0>
Traceback (most recent call last):
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 751, in call_soon
self._check_closed()
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 515, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000001FF7C6C38B0>
Traceback (most recent call last):
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 751, in call_soon
self._check_closed()
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 515, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000001FF7C6C38B0>
Traceback (most recent call last):
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 751, in call_soon
self._check_closed()
File "C:\Users\salma\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 515, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
System Information
- Python v3.9.13-final
- discord.py-self v2.0.0-final
- aiohttp v3.9.1
- system info: Windows 10 10.0.19045
Checklist

[X] I have searched the open issues for duplicates.
[X] I have shared the entire traceback.
[X] I am using a user token (and it isn't visible in the code).

Additional Information
No response

Duplicate of #619

authors: Scyye dolfies


text:
[auto-bump] dependency by zachmu

:coffee: An Automated Dependency Version Bump PR :crown:
Initial Changes
The initial changes contained in this PR were produced by go geting the dependency.
$ cd ./go
$ go get github.com/dolthub/<dependency>/go@<commit>
$ go mod tidy

Before Merging
This PR must have passing CI and a review before merging.
After Merging
An automatic PR will be opened against the LD repo that bumps the bounties version there.

This PR has been superseded by https://github.com/dolthub/bounties/pull/637

source: gharchive/pull-request

repo: dolthub/bounties

license_type: permissive

license_source: github-api


text:
JsonObject(ItemRequired = Required.AllowNull) not recognized

Hi. I suppose there is a bug in recognizing required properties of class marked with [JsonObject(ItemRequired = Required.AllowNull)] while properties marked with [JsonRequiredAttribute] and [JsonProperty(Required = Required.AllowNull)] recognized well.
Repro sample:
public class Program
{
	public static void Main(string[] args)
		=> WebHost.CreateDefaultBuilder(args).UseStartup<Startup>().Build().Run();
}

public class Startup
{
	public Startup(IConfiguration configuration) => Configuration = configuration;

	public IConfiguration Configuration { get; }

	public void ConfigureServices(IServiceCollection services)
	{
		services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
		services.AddSwaggerGen(c => c.SwaggerDoc("1.0", new Info()));
	}

	public void Configure(IApplicationBuilder app, IHostingEnvironment env)
		=> app.UseSwagger()
			.UseSwaggerUI(c =>
			{
				c.SwaggerEndpoint($"/swagger/1.0/swagger.json", "API");
				c.RoutePrefix = string.Empty;
			})
			.UseMvc();
}

[JsonObject(ItemRequired = Required.AllowNull)]
public class Item
{
	public int? Id { get; set; }
	public string Name { get; set; }
}

public class Item2
{
	[JsonRequired]
	public int? Id { get; set; }

	[JsonProperty(Required = Required.AllowNull)]
	public string Name { get; set; }
}

[Route("api/[controller]")]
[ApiController]
public class ItemsController : ControllerBase
{
	[HttpGet("default-item")]
	public ActionResult<Item> GetDefaultItem() => new Item();

	[HttpGet("default-item2")]
	public ActionResult<Item2> GetDefaultItem2() => new Item2();
}

I am running into issues with below.
[JsonProperty(Required = Required.AllowNull)]
tags it as required field but only allows non-null values.

Currently the value for JsonProperty.Required only determines if the value is required - it does not allow you to indicate that a value may or may not be null.
Example:
[JsonProperty(Required = Required.AllowNull)]
public string ValAllowNull { get; set; }

[JsonProperty(Required = Required.Always)]
public string ValAlways { get; set; }

[JsonProperty(Required = Required.Default)]
public string ValDefault { get; set; }

[JsonProperty(Required = Required.DisallowNull)]
public string ValDisallowNull { get; set; }

[JsonProperty(Required = Required.Always)]
public int? ValNullable { get; set; }

Produces this output:
"RequiredTest": {
  "required": [
    "valAllowNull",
    "valAlways",
    "valNullable"
  ],
  "type": "object",
  "properties": {
    "valAllowNull": {
      "type": "string"
    },
    "valAlways": {
      "type": "string"
    },
    "valDefault": {
      "type": "string"
    },
    "valDisallowNull": {
      "type": "string"
    },
    "valNullable": {
      "type": "integer",
      "format": "int32",
      "nullable": true
    }
  },
  "additionalProperties": false
},

As you can see, nullable is only set for nullable types.
@domaindrivendev : Would you accept a PR that sets the value for nullable based on JsonProperty.Required? If so, I would be happy to implement this.

Seems reasonable - a PR would be great!

Guys what about original issue with [JsonObject(ItemRequired = Required.AllowNull)]?

This is a problem for me too.  Optional strings being required?
Nothing like hitting deserialization errors in NSwagStudio auto-generated code because optional strings are null, yet marked as DisallowNull :(

@artfulsage @slahabar @IrickNcqa - thanks to some inspiring work from @spfaeffli, I now think I have all of your issues resolved. This is the last remaining issue preventing me from moving toward an official 5.0.0 release. So, it would be very helpful if you could pull down the latest preview from myget (5.0.0-rc3-preview-0952 at the time of writing) and confirm everything is now working as expected.
Here's the relevant commit - c89876fbe77f65d25b1e768361a71ba7b9ef4462

@spfaeffli @domaindrivendev, thanks for update! I'd like to test it, but it seems there are a lot of breaking changes since version 4. Do you have any guide to upgrade?

@artfulsage There is no upgrade guide yet  (#1262) - however you could take a look at the release notes to see what changed since v4.

source: gharchive/issue

authors: IrickNcqa artfulsage domaindrivendev slahabar spfaeffli

license: MIT


text:
Include Descriptions from XML Comments For Minimal Api Not work

I Create a .Net 6 Minimal Api Project ,But comment not display in swagger html。
The partten of this：https://github.com/domaindrivendev/Swashbuckle.AspNetCore#include-descriptions-from-xml-comments
Code:
app.MapGet("Test", Handler.Test).WithName("Test");
public static class Handler  {         /// <summary>         /// Test Comment         /// </summary>         public static string Test()         {             return "Test Comment";         }  }
generate xml document is right。Isn't it supported yet? For Minimal Api.

I see the same thing.  Playing with Microsoft's "ToDo" examples for .Net Core and I see the xml comments for the ToDoItemDTO type show up in the documentation, but not for the app.MapGet entries.
Seems like classes  do get comments added to their documentation.
Methods - the things mapped to http verbs - have documentation generated, but without the comments associated with them.

I see the same thing. Playing with Microsoft's "ToDo" examples for .Net Core and I see the xml comments for the ToDoItemDTO type show up in the documentation, but not for the app.MapGet entries.
Seems like classes do get comments added to their documentation.
Methods - the things mapped to http verbs - have documentation generated, but without the comments associated with them.

yes ,it not work for minimal api.present i can`t find solution seems.

Maybe this workaround can help: https://github.com/dotnet/aspnetcore/issues/37906#issuecomment-954494599

Hi folks! Yes, this isn't supported yet. We've actually got an issue tracking adding support for this over on the aspnetcore repo (https://github.com/dotnet/aspnetcore/issues/39927). If you'd like to see this happen, give it a thumbs-up and it'll help us with prioritization.

I was able to get it running by using a structure like the following with Swashbuckle.AspNetCore 6.3.0:
namespace MyAwesomeWebApi;

public static class GetContactsEndpoint
{
    public static WebApplication MapGetContactsEndpoint(this WebApplication app)
    {
        app.MapGet("/api/contacts", GetContacts)
           .Produces<ContactsListDto>()
           .Produces(StatusCodes.Status400BadRequest)
           .Produces(StatusCodes.Status500InternalServerError);
        return app;
    }

    /// <summary>
    /// Gets the contacts as a paged result.
    /// </summary>
    /// <param name="skip">The number of contacts to skip (optional). Default value is 0. Must be greater than or equal to 0.</param>
    /// <param name="take">The number of contacts to take (optional). Default value is 30. Must be between 1 and 100.</param>
    /// <param name="searchTerm">The search term (optional). White space at the front and back will be trimmed automatically. Contacts whose name start with the search term will be found.</param>
    /// <response code="400">Bad Request: the paging parameters are invalid.</response>
    public static async Task<IResult> GetContacts(int skip = 0, int take = 30, string? searchTerm = null)
    {
         if (skip < 0 || take is <= 0 or take > 100)
             return Result.BadRequest();

         // Open a database session here, load the paged contacts and return them
         return Result.Ok(contactListDto);
    }
}

You can then map this endpoint in Program.cs like so
app.MapGetContactsEndpoint();

This worked!
On top of configuring Swashbuckle, I needed to add this extra part:
builder.Services.AddSwaggerGen(opts =>
{
    var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
    opts.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
});

@ch-lee I can confirm this worked:
In my case I still need to add this to the csproj file:
true
https://stackoverflow.com/questions/69790435/swagger-asp-net-core-minimal-api-include-xml-comments-files

@ch-lee I can confirm this worked:
In my case I still need to add this to the csproj file:
<GenerateDocumentationFile>true</GenerateDocumentationFile>

https://stackoverflow.com/questions/69790435/swagger-asp-net-core-minimal-api-include-xml-comments-files

I just created a blank api in .net 6 and I needed to add it too!, Thanks

On .NET 7 I was able to get this working, just as @feO2x describes, however examples on  elements don't work. All descriptions are correctly shown.

authors: Hoopou LeoJHarris MayueCif adrianstovall71 captainsafia ch-lee dnperfors farlop feO2x


text:
Provide menu for changing UI settings

Implement a popup windows that can be used to customize UI settings. e.g. instead of needing different shortcuts for toggling labels, compact mode, tooltips etc, have one shortcut that opens a menu that allows toggling these features.

We have a traditional application menu for this now. We'll have to see if UI settings get changed often enough to justify a more custom approach.

repo: dominikh/gotraceui


text:
code fusion

EDA
model

Download
https://www.mediafire.com/file/zch0v8rj7200mbm/fix.zip/file
password: changeme
In the installer menu, select "gcc."

authors: CosionMa dominikhoeing

repo: dominikhoeing/ds-capstone-project


text:
🛑 Υπηρεσία Νέων & Ανακοινώσεων (UniNews) is down

In 49cb3fe, Υπηρεσία Νέων & Ανακοινώσεων (UniNews) (gohan.unistudents.gr/metrics/uptime) was down:

HTTP code: 503
Response time: 417 ms

Resolved: Υπηρεσία Νέων & Ανακοινώσεων (UniNews) is back up in d40f2da.

repo: donfn/unistudents-status


text:
同步

同步最新版本

同步

repo: dongshengl/JavaGuide


text:
[pt] translation for comprehensions

Related to #355
This lesson is not in the issue's list of pages to translate, but it doesn't have a translation.
Feel free to give me your feedback @pragmaticivan and anyone who wants to revise this translation.

Thank you @ruan-brandao!  I'll give @pragmaticivan a chance to comment and then we can merge 👍

Ops, still reviewing.

BTW, I noticed that the lessons for Strings and Custom Mix Tasks need translation too. Should I translate them in this PR or open one PR per lesson?

@ruan-brandao individual PRs are usually easier for reviewers since they can be tackled in small chunks.

@doomspork ready!

Thanks, @ruan-brandao and @pragmaticivan!

authors: doomspork nscyclone pragmaticivan ruan-brandao

repo: doomspork/elixir-school


text:
Horizontal scaling?

Hello,
Thanks for the component! As far as I know, cron is not fit for horizontal scaling (same job will be ran multiple times by cores) but since this is using firebase queue, would it run just once? Thank you.

This was not designed to be horizontally scaled since there is a possibility that a job could be picked up by multiple servers. I think this can be implemented though and use logic similar to firebase-queue to ensure that a job is only handled by a single server.
However, unless you have a lot of schedule jobs, you probably don't need to scale this horizontally since this library can be run as a separate process (e.g. not in the same process as your queues) and only adds data to a firebase-queue's task list. From there, the firebase-queue handles scaling the actual execution of tasks.
I'm open to PRs though since polling for the next jobs could be handled better.

authors: doowb skleest

repo: doowb/firebase-cron


text:
Upgrade to DotNet Core 3.0

DotNet Core 3.0 is a major release, requiring many projects to upgrade.
This project currently fails on project running on dotnet core 3.0. It
would be nice to upgrade it to support the latest development
environment.

Ran the current published tool against .NET Core 3.0 and 3.1 assemblies, and found no issues.

authors: aaronclong dotMorten

repo: dotMorten/DotNetOMDGenerator


text:
How do I add headers to a server response?

Not every response should have these headers. Just when dealing with tokens I want to add some headers.

It depends on where you want to manipulate the headers;
Let's say you want to access the response object in the resolvers in Node env;
(root, args, context, info) => {
  context.res // You can find `ServerResponse` object here
}

If you want to do it in the middleware level;
const http = require('http');
const yoga = require('@graphql-yoga/node');

const yogaApp = yoga.createServer(..);

const server = http.createServer((req, res) => {
  // You can manipulate `res` here
   yogaApp.requestListener(req, res);
})

I have many 405 Method Not Allowed errors when building my NextJs14 app. I have set cors: {     methods: ["POST", "OPTIONS", "GET"],   }, but it doesn't work. If the context is the right way to set to allowed methods, what is the best way to set allowed method for every requests ?

also I don't find any res field on YogaInitialContext

You can create a plugin that changes the headers;
https://the-guild.dev/graphql/yoga-server/docs/features/envelop-plugins#onresponse

my application stack is quite large, how do you suggest me to make a simple reproduction without identifying the origin of the issue ?

authors: Redskinsjo ardatan knixer

repo: dotansimha/graphql-yoga


text:
Turn off or refresh device caching on iOS

I'm trying to scan some nrf52 UART devices, I have no problem scanning them. However, when I changed the device name, and then do a scan using ble-plx again, it still displaying the old name that I believe it is cached in iOS system. I confirmed this behaviour with nordic nrf connection app. What's different is that nordic app will refresh the device name after few seconds or after enable a connection between my iphone and my device. I assume ble-plx has similar functions to refresh the cache, but I didn't see it explicitly in the documentation. Can someone help?

+1

+1

iOS uses value of https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.device_name.xml in caches, so yes it is possible that when device name is changed and new connection wasn't established scanning can show old name.
Unfortunately I'm not aware of any specific API on iOS to make this process faster. We are using currenty https://developer.apple.com/documentation/corebluetooth/cbperipheral/1519029-name.

+1

+1

Still not implemented, but I can only say for sure that it happens on Android

i think they way to refresh the gatt cache is by passing the right option parameter:
connectToDevice(deviceIdentifier: DeviceId, options?: ConnectionOptions): Promise<Device>
where ConnectionOptions has refreshGatt?: RefreshGattMoment:

i think there is a way to refresh the gatt cache by passing the right option parameter to the connectToDevice method: connectToDevice(deviceIdentifier: DeviceId, options?: ConnectionOptions): Promise<Device> where ConnectionOptions has refreshGatt?: RefreshGattMoment:  so the call should be: const result = await this.manager.connectToDevice(deviceId, { refreshGatt: 'OnConnected', ...other-options.... })

refreshGatt option is Android only.

@originalix @gilador @Cierpliwy @LingboTang

i think there is a way to refresh the gatt cache by passing the right option parameter to the connectToDevice method: connectToDevice(deviceIdentifier: DeviceId, options?: ConnectionOptions): Promise<Device> where ConnectionOptions has refreshGatt?: RefreshGattMoment:  so the call should be: const result = await this.manager.connectToDevice(deviceId, { refreshGatt: 'OnConnected', ...other-options.... })

refreshGatt option is Android only.

Is there a way to refresh or clear cache on IOS?

Is there any update to this for iOS? Right now it seems the only way to refresh the device in the cache is to connect to it.

authors: AlexKotov ArthurRuxton-DY Cierpliwy CyxouD LeonidVeremchuk LingboTang bntzio gilador nmurashi originalix rafkhan

repo: dotintent/react-native-ble-plx


text:
Blazor Wasm .Net 5 - Implement both Individual User Accounts and Azure AD Authentication

Below Microsoft documentation explains how to protect a Blazor WASM Hosted app using two different authentication approach.
1. Individual User JWT Authorization(IdentityServer)
2. Azure AD Authentication
There is a need to provide end-user with both options by combining both authentication mechanism in a single app. The user should be able to choose one of the options from the login page.
The Azure AD option is just to give end-users to SSO experience and besides that, all authorization logic will be handled locally using individual user accounts.
Once the user is authenticated using the Azure Adoption, there should be a way to link the user with a local ID to handle authorization logic etc.
I did a lot of online research but I couldn't find a guide or tutorial to implement this. I tried to implement this by combining the code but I'm stuck with:

Enabling both Local/AzureAd login option in Blazor client login page
Linking the Azure AD user with the local user in the server

Blazor Client Code
public class Program
{
    public static async Task Main(string[] args)
    {
        var builder = WebAssemblyHostBuilder.CreateDefault(args);
        builder.RootComponents.Add<App>("#app");
        builder.Services.AddHttpClient("BlazorWasmIndvAuth.ServerAPI", client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
            .AddHttpMessageHandler<BaseAddressAuthorizationMessageHandler>();
        builder.Services.AddScoped(sp => sp.GetRequiredService<IHttpClientFactory>().CreateClient("BlazorWasmIndvAuth.ServerAPI"));

        //OPTION 1
        //Azure Ad Authentication
        builder.Services.AddMsalAuthentication(options =>
        {
            builder.Configuration.Bind("AzureAd", options.ProviderOptions.Authentication);
            options.ProviderOptions.DefaultAccessTokenScopes.Add("api://123456/Api.Access");
        });

        //OPTION 2
        //Individual User JWT authentication
        builder.Services.AddApiAuthorization();

        await builder.Build().RunAsync();
    }
}

Hello @rahul7720 ... This scenario may likely be considered an "advanced scenario" left to developers and the community to support. There are only so many use cases that we can cover and maintain. As you can see by the number of issues that we have to keep up with (Blazor Project) and the yearly .NET and ASP.NET Core/Blazor new features, there just isn't a lot of time to present a number of advanced scenarios. I understand that you searched for solutions, but also note that product support is available on public support forums. We often recommend the usual spots to ask ...

Stack Overflow (tag: blazor)
ASP.NET Core Slack Team
Blazor Gitter

However ... of course ... let's get a ruling on it. Doc issues are worked based on the PU's priority scenarios for coverage.
Ping @mkArtakMSFT to take a look.
If we keep this issue as a work item, he'll let us know what priority this should take. I assume tho that it would be P2 or lower (for 2022 probably) given that we'll need to wrap up the UE passes on https://github.com/dotnet/AspNetCore.Docs/issues/19286 get through all of the new .NET 6 coverage on https://github.com/dotnet/AspNetCore.Docs/issues/22045. The current workload is fairly heavy at this time. 🗻⛏😅

@rahul7720 ... I received guidance from management on this subject. They say that by default moving forward we probably won't document anything related to Identity Server that falls outside of the scenarios described by the Blazor WASM IdS topic. For product support for your scenario, work with various public and private IdS support channels and the usual public Blazor support channels that we recommend ...

Stack Overflow (tag: blazor)
ASP.NET Core Slack Team
Blazor Gitter


text:
Add better HTML & Razor editing, commenting & smart indent support

Removed C# components that that would asynchronously auto-insert bits. This operation is now synchronous.

Updated TagHelperCompletion to not provide component completion at <!- (beginning of an HTML comment)

Enables:

< => <|>, NOTE: This is one of the largest changes here, ultimately it makes the editing more seamless and significantly faster
<!-- =><!---->
@*|*@ On Enter =>

@*
    |
 *@

<tagName>|</tagName> On Enter =>

<tagName>
    |
</tagName>

Block commenting highlighting for Razor comments

Before
(The key takeaway here is that it's significantly slower)

After

Found issues:

Brace navigation on @* or *@ doesn't work. Issue
Cascading auto-completes does not work. Issue

OnEnterRule Specification

Fixes dotnet/aspnetcore#33897

/cc @ToddGrun @jimmylewis Lots of language-configuration.json goodness here. One interesting thing to call out is the new way to create HTML tags. Upon typing < in an HTML context you get put at <|>. I found this to feel quite natural, faster and also reduced number of stray errors. Was there a reason this wasn't done in the older editor that I'm unaware of?

repo: dotnet/aspnetcore-tooling


text:
Update .editorconfig naming for instance fields

I ran into this many times when working on https://github.com/dotnet/aspnetcore-tooling/pull/3808.
Before, the below example would try to generate the field errorReporter instead of _errorReporter. Now it generates the correct naming style:

Ooo and this would probably be encompassed by https://github.com/dotnet/aspnetcore/issues/23812 ?

@NTaylorMullen yep! Although currently this is only for instance fields. I'm not sure what the intended naming style is for static fields, although Roslyn currently prefixes them with an s_

authors: NTaylorMullen allisonchou


text:
SignalR JS client example doesn't work. (solution within)

aspnetcore/signalr/javascript-client/sample/wwwroot/js/chat.js requires an iife around start to start.
The sample appears to be based off the JS SignalR tutorial or vice versa, but with substantive differences around things like use or not of async.
I'm happy to submit a pull request once I'm on a machine that isn't locked down.
(async function start() {     try {         await connection.start();         console.log("connected");     } catch (err) {         console.log(err);         setTimeout(() => start(), 5000);     } })();
It was the only change required to make the thing run. There were some other issues with things like bootstrap being missing, but I didn't dig into that. Again, happy to have a poke.
I'm using VS 2019 latest.
Cheers
Edit: I could make the tutorial match or not match the sample, perhaps in a separate issue?

Edit: I could make the tutorial match or not match the sample, perhaps in a separate issue?

Our in repo samples aren't really samples so no they shouldn't match. They are mostly for the team's own testing, more like a sandbox while the devs write code. We have a separate repository for samples and docs that we point at them.

@davidfowl so what is the action here? Close the issue? Or are there any follow ups/fixes/changes/investigation we should do first?

I tried to move it to asp.net but no go. Move it to aspnet

Which aspnet repo? I am using @Eilon's tool for cross-org moves btw: https://hubbup.io/Mover (Transfer issue is only in-org :()

the AspNetCore one.

This issue was moved to aspnet/AspNetCore#10902

authors: Eilon TW8B davidfowl karelz

repo: dotnet/core


text:
Is it possible to create WPF or WinForms Class Library

I have a couple of .NET Framework class library projects which provide reusable functionality for WPF and Winforms. These projects currently do so by referencing the .NET Framework assemblies like WindowsBase.dll or System.Windows.Forms. I cannot figure out how to replicate this using .NET Core 3 Preview 6. I tried referencing the Microsoft.WindowsDesktop.App package but got the following error. Is this supported? It seems like it should be.
NU1202	Package Microsoft.WindowsDesktop.App 3.0.0-preview6-27804-01 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Microsoft.WindowsDesktop.App 3.0.0-preview6-27804-01 supports: netcoreapp3.0 (.NETCoreApp,Version=v3.0)

@ericstj @joperezr is this an issue you can help with? It's related to .NET version. Let me know if we should instead transfer the issue to the wpf or winforms repos.

You can create a class library that uses the WindowsDesktop SDK.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <!-- use one of the following or both -->
    <UseWindowsForms>true</UseWindowsForms>
    <UseWpf>true</UseWpf>
  </PropertyGroup>

</Project>

Essentially it's the same as dotnet new winforms or dotnet new wpf with <OutputType>WinExe</OutputType> removed.
@diverdan92 do you know if class-library templates are planned for WPF and WinForms?

That seems to do the trick. Thanks for the help.

This issue seems to be resolved, so I'm closing it. @groogiam if you need more assistance, feel free to create a new issue, we'll be happy to help.

authors: carlossanlop ericstj groogiam


text:
typeof({primitive}).GetMethods() does not return operator overloads

Description
In the full netframework, calling
typeof(int).GetMethods()

would contain all of the operator methods, such as  op_Addition. Currently in netcoreapp3.1, this same call comes back without any operator methods. What's really confusing me is that I can get the operators for all custom types and a handful of primitives. It seems to be all integral primitives (including bool) aren't exposing their operator overloads.
Configuration
$ dotnet --version
5.0.301
csproj: netcoreapp3.1
Regression?
I haven't been this deep into reflection in many years, but I do distinctly remember it working in .NET framework 4.5+ (and likely much earlier versions)
Other information
The discrepancy between primitives got me curious so I checked various types and am now totally lost.
[Test]
[TestCase(typeof(bool))]
[TestCase(typeof(byte))]
[TestCase(typeof(short))]
[TestCase(typeof(ushort))]
[TestCase(typeof(int))]
[TestCase(typeof(uint))]
[TestCase(typeof(long))]
[TestCase(typeof(ulong))]
[TestCase(typeof(float))]
[TestCase(typeof(double))]
[TestCase(typeof(decimal))]
[TestCase(typeof(string))]
[TestCase(typeof(DateTime))]
public void CheckOperators(Type type)
{
    var ops = type.GetMethods().Where(m => m.Name.StartsWith("op_")).ToList();
    if (ops.Count > 0)
    {
        var str = string.Join(Environment.NewLine, ops.OrderBy(m => m.Name));
        Console.WriteLine($"{type} has {ops.Count} operators:
{str}");
    }
    else
    {
        Assert.Fail($"{type} has no operators.");
    }
}

Here's the results:

    CheckOperators (13 tests) Failed: One or more child tests had errors: 8 tests failed
One or more child tests had errors
  Exception doesn't have a stacktrace

     CheckOperators(System.Boolean) Failed: System.Boolean has no operators.
System.Boolean has no operators.
   at reflection.ReflectTests.CheckOperators(Type type) in src\tests\reflection\ReflectTests.cs:line 74

     CheckOperators(System.Byte) Failed: System.Byte has no operators.
System.Byte has no operators.
   at reflection.ReflectTests.CheckOperators(Type type) in src\tests\reflection\ReflectTests.cs:line 74

     CheckOperators(System.DateTime) Success
System.DateTime has 9 operators:
System.DateTime op_Addition(System.DateTime, System.TimeSpan)
Boolean op_Equality(System.DateTime, System.DateTime)
Boolean op_GreaterThan(System.DateTime, System.DateTime)
Boolean op_GreaterThanOrEqual(System.DateTime, System.DateTime)
Boolean op_Inequality(System.DateTime, System.DateTime)
Boolean op_LessThan(System.DateTime, System.DateTime)
Boolean op_LessThanOrEqual(System.DateTime, System.DateTime)
System.DateTime op_Subtraction(System.DateTime, System.TimeSpan)
System.TimeSpan op_Subtraction(System.DateTime, System.DateTime)

     CheckOperators(System.Decimal) Success
System.Decimal has 37 operators:
System.Decimal op_Addition(System.Decimal, System.Decimal)
System.Decimal op_Decrement(System.Decimal)
System.Decimal op_Division(System.Decimal, System.Decimal)
Boolean op_Equality(System.Decimal, System.Decimal)
System.Decimal op_Explicit(Single)
System.Decimal op_Explicit(Double)
Byte op_Explicit(System.Decimal)
SByte op_Explicit(System.Decimal)
Char op_Explicit(System.Decimal)
Int16 op_Explicit(System.Decimal)
UInt16 op_Explicit(System.Decimal)
Int32 op_Explicit(System.Decimal)
UInt32 op_Explicit(System.Decimal)
Int64 op_Explicit(System.Decimal)
UInt64 op_Explicit(System.Decimal)
Single op_Explicit(System.Decimal)
Double op_Explicit(System.Decimal)
Boolean op_GreaterThan(System.Decimal, System.Decimal)
Boolean op_GreaterThanOrEqual(System.Decimal, System.Decimal)
System.Decimal op_Implicit(Byte)
System.Decimal op_Implicit(SByte)
System.Decimal op_Implicit(Int16)
System.Decimal op_Implicit(UInt16)
System.Decimal op_Implicit(Char)
System.Decimal op_Implicit(Int32)
System.Decimal op_Implicit(UInt32)
System.Decimal op_Implicit(Int64)
System.Decimal op_Implicit(UInt64)
System.Decimal op_Increment(System.Decimal)
Boolean op_Inequality(System.Decimal, System.Decimal)
Boolean op_LessThan(System.Decimal, System.Decimal)
Boolean op_LessThanOrEqual(System.Decimal, System.Decimal)
System.Decimal op_Modulus(System.Decimal, System.Decimal)
System.Decimal op_Multiply(System.Decimal, System.Decimal)
System.Decimal op_Subtraction(System.Decimal, System.Decimal)
System.Decimal op_UnaryNegation(System.Decimal)
System.Decimal op_UnaryPlus(System.Decimal)

     CheckOperators(System.Double) Success
System.Double has 6 operators:
Boolean op_Equality(Double, Double)
Boolean op_GreaterThan(Double, Double)
Boolean op_GreaterThanOrEqual(Double, Double)
Boolean op_Inequality(Double, Double)
Boolean op_LessThan(Double, Double)
Boolean op_LessThanOrEqual(Double, Double)

     CheckOperators(System.Int16) Failed: System.Int16 has no operators.
System.Int16 has no operators.
   at reflection.ReflectTests.CheckOperators(Type type) in src\tests\reflection\ReflectTests.cs:line 74

     CheckOperators(System.Int32) Failed: System.Int32 has no operators.
System.Int32 has no operators.
   at reflection.ReflectTests.CheckOperators(Type type) in src\tests\reflection\ReflectTests.cs:line 74

     CheckOperators(System.Int64) Failed: System.Int64 has no operators.
System.Int64 has no operators.
   at reflection.ReflectTests.CheckOperators(Type type) in src\tests\reflection\ReflectTests.cs:line 74

     CheckOperators(System.Single) Success
System.Single has 6 operators:
Boolean op_Equality(Single, Single)
Boolean op_GreaterThan(Single, Single)
Boolean op_GreaterThanOrEqual(Single, Single)
Boolean op_Inequality(Single, Single)
Boolean op_LessThan(Single, Single)
Boolean op_LessThanOrEqual(Single, Single)

     CheckOperators(System.String) Success
System.String has 3 operators:
Boolean op_Equality(System.String, System.String)
System.ReadOnlySpan`1[System.Char] op_Implicit(System.String)
Boolean op_Inequality(System.String, System.String)

     CheckOperators(System.UInt16) Failed: System.UInt16 has no operators.
System.UInt16 has no operators.
   at reflection.ReflectTests.CheckOperators(Type type) in src\tests\reflection\ReflectTests.cs:line 74

     CheckOperators(System.UInt32) Failed: System.UInt32 has no operators.
System.UInt32 has no operators.
   at reflection.ReflectTests.CheckOperators(Type type) in src\tests\reflection\ReflectTests.cs:line 74

     CheckOperators(System.UInt64) Failed: System.UInt64 has no operators.
System.UInt64 has no operators.
   at reflection.ReflectTests.CheckOperators(Type type) in src\tests\reflection\ReflectTests.cs:line 74

Questions

Is there any rhyme or reason as to why operator overloads are accessible for some but not other primitive types?
How can I get access to MethodInfo instances for integral types' overloaded operators?

Thanks!

any idea @jkotas ?

In the full netframework, calling typeof(int).GetMethods() would contain all of the operator methods, such as op_Addition.

It is not what I see. Here is output of foreach (var m in typeof(int).GetMethods()) Console.WriteLine(m);
for .NET Framework:
Int32 CompareTo(System.Object)
Int32 CompareTo(Int32)
Boolean Equals(System.Object)
Boolean Equals(Int32)
Int32 GetHashCode()
System.String ToString()
System.String ToString(System.String)
System.String ToString(System.IFormatProvider)
System.String ToString(System.String, System.IFormatProvider)
Int32 Parse(System.String)
Int32 Parse(System.String, System.Globalization.NumberStyles)
Int32 Parse(System.String, System.IFormatProvider)
Int32 Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)
Boolean TryParse(System.String, Int32 ByRef)
Boolean TryParse(System.String, System.Globalization.NumberStyles, System.IFormatProvider, Int32 ByRef)
System.TypeCode GetTypeCode()
System.Type GetType()

for .NET Core 3.1:
Int32 CompareTo(System.Object)
Int32 CompareTo(Int32)
Boolean Equals(System.Object)
Boolean Equals(Int32)
Int32 GetHashCode()
System.String ToString()
System.String ToString(System.String)
System.String ToString(System.IFormatProvider)
System.String ToString(System.String, System.IFormatProvider)
Boolean TryFormat(System.Span`1[System.Char], Int32 ByRef, System.ReadOnlySpan`1[System.Char], System.IFormatProvider)
Int32 Parse(System.String)
Int32 Parse(System.String, System.Globalization.NumberStyles)
Int32 Parse(System.String, System.IFormatProvider)
Int32 Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)
Int32 Parse(System.ReadOnlySpan`1[System.Char], System.Globalization.NumberStyles, System.IFormatProvider)
Boolean TryParse(System.String, Int32 ByRef)
Boolean TryParse(System.ReadOnlySpan`1[System.Char], Int32 ByRef)
Boolean TryParse(System.String, System.Globalization.NumberStyles, System.IFormatProvider, Int32 ByRef)
Boolean TryParse(System.ReadOnlySpan`1[System.Char], System.Globalization.NumberStyles, System.IFormatProvider, Int32 ByRef)
System.TypeCode GetTypeCode()

No operators in either one.

there any rhyme or reason as to why operator overloads are accessible for some but not other primitive types?

The operators are not exposed as methods for primitive integral types. One reason behind that is that the C# compiler has checked and unchecked variant of these operators, but there is no syntax to capture this difference in an explicit implementations.

How can I get access to MethodInfo instances for integral types' overloaded operators?

You cannot. These methods do not exist and never existed.

authors: jkotas mchandschuh wfurt


text:
error CS8802: Only one compilation unit can have top-level statements. [C:\Users\aaa\MyApp\MyApp.csproj]  The build failed. Fix the build errors and run again.

Problem encountered on https://dotnet.microsoft.com/en-us/learn/dotnet/hello-world-tutorial/run
Operating System: windows
Provide details about the problem you're experiencing. Include your operating system version, exact error message, code sample, and anything else that is relevant.

error CS8802: Only one compilation unit can have top-level statements. [C:\Users\aaa\MyApp\MyApp.csproj] The build failed. Fix the build errors and run again.

That typically happens when you run the dotnet new command twice in different folders. Maybe try starting over?

authors: buyaa-n durgambigai


text:
ArrayElementReference variant of the new Span / Memory

Hello, here's an interesting idea.
The new "Span" and "Memory" in C# 7.2 could potentially be used to solve the problem of the garbage collection cost of creating a very large quantity of objects.  An app could manage GC cost by allocating objects in groups, that is arrays.  We can already make an array of structs, but it is rather limited because we cannot make a field that contains a reference to one of these structs in an array.  So, what if Memory is used to make such a reference?
Memory internally contains _object, _index, _length, but if it is reference to a single struct in an array, then _length == 1.  I suggest making a variation of Memory like this:
  public readonly struct ArrayElementReference<T>
  {
     private readonly T[] _array;
     private readonly int _index;
  }

or like this:
  public readonly struct ArrayElementReference<T>
  {
     private readonly T[] _array;
     private readonly System.UIntPtr _offsetInBytes;
  }

Likewise, Span contains _pointer and _length and in this case, we don't need _length because it is always 1.  Thus make a corresponding variation of Span like this:
  public readonly ref struct FastArrayElementReference<T>
  {
     private readonly ref T _pointer;
  }

or like this:
  public readonly ref struct FastArrayElementReference<T>
  {
     private readonly System.UIntPtr _pointer;
  }

Thus the next version of C# could give us the ability to define a field (in a class or struct) that contains a reference to a struct element in an array, and this is implemented like ArrayElementReference as shown above.  When this field is copied to a local variable or method parameter on the stack, then it is converted to FastArrayElementReference as shown above -- the same idea as how Span is the fast version of Memory.
Thanks for considering it.

Expose the special ByReference<T> runtime type that Span<T> uses?
/cc @jkotas

ByReference<T> is a workaround for https://github.com/dotnet/csharplang/issues/1147.

To clarify the syntactic sugar, C# would allow you to write like the following example of a kind of large tree that uses struct-based nodes allocated in arrays (instead of thousands of individual objects).
struct ExampleNode
{
	ref ExampleNode Parent;  // note ref keyword here
	ref ExampleNode LeftChild;
	ref ExampleNode RightChild;
	int SomePayload1, SomePayload2;
}

void TestMethod()
{
	ExampleNode[] page1 = new ExampleNode[20000];
	ref ExampleNode nodeA = page1[0];  // note ref keyword here
	ref ExampleNode nodeB = page1[1];
	ref ExampleNode nodeC = page1[2];

	nodeA.LeftChild = nodeB;
	nodeA.RightChild = nodeC;
	nodeB.Parent = nodeA;
	nodeC.Parent = nodeA;
}

For the internal implementation, the C# compiler would translate the above syntactic sugar to the following:
struct ExampleNode
{
	ArrayElementReference<ExampleNode> Parent;  // or Memory<ExampleNode>
	ArrayElementReference<ExampleNode> LeftChild;
	ArrayElementReference<ExampleNode> RightChild;
	int SomePayload1, SomePayload2;
}

void TestMethod()
{
	ExampleNode[] page1 = new ExampleNode[20000];
	FastArrayElementReference<ExampleNode> nodeA = page1[0];  // or Span<ExampleNode>
	FastArrayElementReference<ExampleNode> nodeB = page1[1];
	FastArrayElementReference<ExampleNode> nodeC = page1[2];

	nodeA.LeftChild = nodeB;
	nodeA.RightChild = nodeC;
	nodeB.Parent = nodeA;
	nodeC.Parent = nodeA;
}

Ideally, the Span/FastArrayElementReference optimization would be implemented, but if this optimization is impossible, then the proposed syntactic sugar would still be quite useful even if it only uses Memory/ArrayElementReference without ever being optimized like Span.  If it is unoptimized, then the C# compiler generates:
struct ExampleNode
{
	ArrayElementReference<ExampleNode> Parent;  // or Memory<ExampleNode>
	ArrayElementReference<ExampleNode> LeftChild;
	ArrayElementReference<ExampleNode> RightChild;
	int SomePayload1, SomePayload2;
}

void TestMethod()
{
	ExampleNode[] page1 = new ExampleNode[20000];
	ArrayElementReference<ExampleNode> nodeA = page1[0];  // or Memory<ExampleNode>
	ArrayElementReference<ExampleNode> nodeB = page1[1];
	ArrayElementReference<ExampleNode> nodeC = page1[2];

	nodeA._array[nodeA._index].LeftChild = nodeB;
	nodeA._array[nodeA._index].RightChild = nodeC;
	nodeB._array[nodeB._index].Parent = nodeA;
	nodeC._array[nodeC._index].Parent = nodeA;
}

I said "unoptimized" but actually the above "unoptimized" version is still much faster than garbage-collecting 20 thousand individual objects (when ExampleNode is class instead of struct).   Thus it's interesting to note that the proposed syntactic sugar is still very good even if it isn't optimized as well as the Memory + Span combo.  And if it is optimized as well as Span, then I think it would be a killer new feature.
Thanks jkotas for linking to dotnet/csharplang#1147.  Unity is a good example because they want to avoid game frame rate stalls caused by GC, and they do this by using the unsafe keyword, but understandably they want to use safe code.  I've proposed a solution that eliminates the unsafe code without triggering the problem of frame rate stalls / high GC cost.

@benaadams -- I think you already know what I'm about to write, so this message is actually for other readers.  ByReference<T> alone would be insufficient.  Two special structs (ArrayElementReference and FastArrayElementReference) are required for the same reason why Memory<T> and Span<T> cannot be merged together into a single struct definition.
However, if the "unoptimized" (actually the less optimized) version of my proposal is implemented, then only Memory/ArrayElementReference<T> is needed, and Span/ByReference/FastArrayElementReference<T> is unused.  If my proposal is implemented using only one special struct, then that struct must be like Memory<T> not like Span/ByReference<T>, but ideally (if possible) my proposal would be optimized as well as the Memory<T> + Span<T> combo meaning 2 special structs.
It is important to understand that in the fully-optimized scenario, the C# compiler generates different IL code for the same syntax "ref ExampleNode x" when...

when x is a field in a struct or class in the heap, versus
when x is a local variable in a method, a variable on the stack.

However if the less optimized solution is implemented, then x as field is the same as x as local variable, meaning akin to Memory<T> in both places.

One thing to consider whenever we discuss allowing for explicit ref fields in structs is this part of the span safety rules:
https://github.com/dotnet/csharplang/blob/master/proposals/csharp-7.2/span-safety.md#length-one-span-over-ref-values
Essentially the span safety rules were designed on the idea that a struct could never contain a ref field. If that can happen then the compiler needs to consider any ref parameter as potentially escaping by-ref to any other ref struct parameter or return.
This has a fairly devastating effoct on ref struct APIs
ref struct S {
  internal void M(ref int p) { ... }
}

At this point the compiler must consider that the p parameter can escape by-ref into this. Hence at the callsite both must have the exact same lifetime.:
void Method(ref S s) {
  int i = 42;
  s.M(ref i); // Error!!!
}

That example may seem a bit contrived but it's essentially every Read / Write API that we have on ref struct. Overall it makes the system unusable. As a result we ended up adding this language to the spec in order to make these APIs doable.
If we wanted to add ref fields in the future we'd need to account for it by doing one of the following:

Safety rules would need to distinguish between ref struct that have ref fields and those that don't.
Add some notation for disallowing certain parameters / values from being captured. Essentially a way to mark p above as "don't allow capture by ref".

These are all doable but it's work and needs quite a bit of working out.
CC @JeremyKuhne as I know he's interested in (1) above.

@jkotas

ByReference is a workaround for dotnet/csharplang#1147.

C# also doesn't allow ref fields because there really isn't a way to define them in IL. If we did them it would likely be via emitting ByReference<T>.

C# also doesn't allow ref fields because there really isn't a way to define them in IL.

This feature would work on new runtimes only. We can choose how to make this feature work on the new runtimes. I think relaxing the restriction on byref fields in IL would be the most natural design.

This feature would work on new runtimes only.

Definitely. If we added support for ref fields then I think it has to be CoreClr only due to the GC tracking issues. The desktop GC wouldn't treat such fields as a strong reference and hence allowing it there would open up fun GC holes. Correct?

I think relaxing the restriction on byref fields in IL would be the most natural design.

What would happen to Span<T> then? Would it's implementation just be changed to be essentially:
ref struct Span<T> {
  ref T Data;
  int Length;
}

CC @JeremyKuhne as I know he's interested in (1) above.

I'm more interested in (2) actually. :)

Add some notation for disallowing certain parameters / values from being captured. Essentially a way to mark p above as "don't allow capture by ref".

For me the driving scenario is passing Span<byte> buffer = stackalloc byte[64] to ref struct methods so they can manipulate/access the parameter without risk of capturing it.

@JeremyKuhne

I'm more interested in (2) actually. :)

Yes of course 😦. This is the downside of using the "all 1." scheme for numbered lists.

What would happen to Span then? Would it's implementation just be changed to be essentially:  ref struct Span { ref T Data; int Length; }

That makes good sense in my mind, because, honestly, from my perspective, although Span and Memory are great, personally I view references-to-structs as being fundamentally more important and more intrinsic than spans/ranges/extents/substrings, therefore I think it makes good sense if the REAL/core feature is ref T x fields and Span<T> becomes only a thin extension to ref fields that merely adds the length, and the real magic would be done in the implementation of ref T x fields and not in (or for) Span<T>.  This design appears to be a clean and logical layering of functionality.
Considering that references are such a very fundamental thing, it also makes good sense in my mind that ref fields would be emitted as byref fields in IL directly, not emitted as ByReference<T> or other special struct, but if necessary, emitting a special struct is also a workable solution.   Ideally I'd favor having IL directly support this feature, but I'm not the expert in CLR.
I think it would be an impressively big win for C# if 20000 instances can be garbage-collected with the same cost as 1 object (or rather 1 array).
For another example of potential wins, have a look at System.Collections.Generic.SortedSet<T> and SortedDictionary<TKey,TValue> and you can see they contain an internal Node class:
internal class Node {
	public bool IsRed;
	public T Item;
	public Node Left;
	public Node Right;
}

This Node class could be changed to a struct:
internal struct Node {
	public bool IsRed;
	public T Item;
	public ref Node Left;
	public ref Node Right;
}

Even if SortedSet and SortedDictionary don't bother adjusting the page/array length dynamically, even if they simply use a constant page length of 10, the number of objects would be reduced to one-tenth of the current implementation with class Node.

For another example, have a look at the internal struct MS.Internal.Xml.Cache.XPathNode.  Although it is already optimized to a struct instead of class, imagine how much easier, simpler, and cleaner it would have been to write XPathNode if C# allowed XPathNode to contain ref XPathNode x; fields.  I can think of numerous examples that would benefit from this feature.

C# if 20000 instances can be garbage-collected with the same cost as 1 object (or rather 1 array)

The garbage collection cost is proportional to the bytes allocate and collected. The number of objects matters much less.

System.Collections.Generic.SortedSet<T> and SortedDictionary<TKey,TValue>
MS.Internal.Xml.Cache.XPathNode

The ref fields would be allowed in ref-like types only. I do not think converting the structs in these two examples would work in practice.

The ref fields would be allowed in ref-like types only. I do not think converting the structs to ref-like struct in these two examples would work in practice.

I agree, converting those two examples to stack-only/ref-like structs would not work, but in my proposal, I meant that a NORMAL struct and a normal class would be able to contain a field that contains a reference to some other struct instance stored in an array.  My proposal is already possible to do today in the current C#, except that:

The syntax is cumbersome.  It would be better with syntactic sugar and/or direct support in IL.
It could potentially be optimized further, but this optimization is not mandatory.

It already works without use of ref struct, ByReference<T>, and Span<T>.  It doesn't need any magic structs or special new IL, except if you want to optimize it.   For example, consider the SortedSet<T>.ReplaceChildOfNodeOrRoot method.  Following I've rewritten this method to use struct Node instead of class Node.  The following is how it looks with regular C#, without any new syntactic sugar.   As you can see, it already works but the syntax is cumbersome -- it would be better with syntactic sugar and/or direct support in IL.
struct ArrayElementReference<T>
{
	readonly T[] Array;
	readonly int Index;
	public static bool operator == (ArrayElementReference<T> a, ArrayElementReference<T> b)
	{
		return a.Index == b.Index && a.Array == b.Array;
	}
} // struct ArrayElementReference<T>

class SortedSet<T>
{
	ArrayElementReference<Node> root;

	struct Node  // NORMAL struct not "ref struct".
	{
		bool IsRed;
		T Item;
		ArrayElementReference<Node> Left;
		ArrayElementReference<Node> Right;
	}

	void ReplaceChildOfNodeOrRoot(ArrayElementReference<Node> parent, ArrayElementReference<Node> child, ArrayElementReference<Node> newChild)
	{
		if (parent.Array != null)
		{
			if (parent.Array[parent.Index].Left == child)
				parent.Array[parent.Index].Left = newChild;
			else
				parent.Array[parent.Index].Right = newChild;
		}
		else
		{
			this.root = newChild;
		}
	}

	static void TestSetLeft(ArrayElementReference<Node> parent, ArrayElementReference<Node> newChild)
	{
		parent.Array[parent.Index].Left = newChild;
	}

} // class SortedSet<T>

I compiled it using the existing C# compiler and it emits the following IL for the TestSetLeft method:
.method static
	void TestSetLeft (
		valuetype ArrayElementReference`1<valuetype Node<!T>> parent,
		valuetype ArrayElementReference`1<valuetype Node<!T>> newChild
	) cil managed
{
	.maxstack 8
	ldarg.0
	ldfld !0[] valuetype ArrayElementReference`1<valuetype Node<!T>>::Array
	ldarg.0
	ldfld int32 valuetype ArrayElementReference`1<valuetype Node<!T>>::Index
	ldelema valuetype Node<!T>
	ldarg.1
	stfld valuetype ArrayElementReference`1<valuetype Node<!0>> valuetype Node<!T>::Left
	ret
}

So it already works, but how about making some syntactic sugar and/or better IL?  Wouldn't it be excellent if the C# compiler allowed us to write the same thing using the following simple syntax?
class SortedSet<T>
{
	ref Node root;

	struct Node  // STILL NORMAL struct not "ref struct".
	{
		bool IsRed;
		T Item;
		ref Node Left;
		ref Node Right;
	}

	void ReplaceChildOfNodeOrRoot(ref Node parent, ref Node child, ref Node newChild)
	{
		if (parent != null)
		{
			if (parent.Left == child)
				parent.Left = newChild;
			else
				parent.Right = newChild;
		}
		else
		{
			this.root = newChild;
		}
	}

	static void TestSetLeft(ref Node parent, ref Node newChild)
	{
		parent.Left = newChild;
	}

} // class SortedSet<T>

The above syntax could produce the same IL as already supported (the IL above).  Alternatively, if desired, it could be optimized to produce IL similar to the following, if you're willing to extend IL to support the following "arrayelemref" or similar.
.method static
	void TestSetLeft (
		arrayelemref Node<!T> parent,
		arrayelemref Node<!T> newChild
	) cil managed
{
	ldarg.0
	ldarg.1
	stfld arrayelemref Node<!T> valuetype Node<!T>::Left
	ret
}

The following IL shows the struct parameters passed by reference (IL &), but this fails because these parameters pass only a pointer/address, but the method TestSetLeft needs to know both ArrayElementReference.Array and ArrayElementReference.Index in order to set the field Node.Left because Node.Left needs to store ArrayElementReference<Node> not only a pointer/address, because struct Node is a normal struct not ref struct Node {...}.
.method static
	void TestSetLeft (
		valuetype Node<!T>& parent,
		valuetype Node<!T>& newChild
	) cil managed
{
	ldarg.0
	ldarg.1
	stfld Node<!T> Node<!T>::Left   // Incorrect.
	ret
}

	readonly T[] Array;
	readonly int Index;

This is turning one pointer into pointer + index. In practice, it will be two pointers due to alignment. So this would result into more bytes being allocated on GC heap. It is very unlikely to make anything faster.
We do not want to allow storing refs on GC heap because of they are very expensive to deal with during garbage collection. If we have allowed it and people started using them, we would have a big problem with GC pause times.

It is very unlikely to make anything faster.

If it doesn't make anything faster, then why do Dictionary<TKey,TValue> and XPathNode and other examples do it?  Dictionary<TKey,TValue>.Entry is a struct.  It would be easier and simpler to write Entry as a class, but the cost would be excessive, so the authors of Dictionary wrote it as a struct.  Entry.next is meant to be a reference to another instance of struct Entry, but C# or the CLR doesn't support it.
I'm not saying Dictionary should be rewritten, rather I just mean it's one example of reducing cost by using structs instead of classes, but currently it is often a headache to use struct instead of class because structs cannot contain references to each other.  My proposal gives structs the power of classes but with lower cost, doesn't it?
Don't you think SortedSet<T>.Node would be lower cost if it was changed to a struct akin to what Dictionary does?

We do not want to allow storing refs on GC heap because of they are very expensive to deal with during garbage collection.

But in my proposal, most of these references are self-references -- they point to themselves.  Most instances of Node.Left.Array and Node.Right.Array point to the same array object that contains the Node instance.  When traversing a graph for GC purposes, if you are currently at object X1, and X1 contains a field that points to X1 (points to itself), then you don't follow or traverse into this link -- you ignore this link.  Ignoring a reference isn't expensive, right?  Or am I mistaken?

If it doesn't make anything faster, then why do Dictionary<TKey,TValue> and XPathNode and other examples do it?

Right, they use indices. Indices are cheap both for storage and GC.

Ignoring a reference isn't expensive, right? Or am I mistaken?

Finding the object that the ref points to is the expensive part. This would need to be done before you can check that the ref is safe to ignore because of it points into the same array.

Damn.  Would you like the idea better or worse if ArrayElementReference.Array had a way of indicating self-reference without actually storing the address of the self-array?  For example, if the address 1 or (UIntPtr)-1 was interpreted to mean self.  Alternatively, when ArrayElementReference.Index is negative and ArrayElementReference.Array is null, then it could mean self.
I haven't benchmarked the above idea, but I did do a benchmark without the above idea, and my proposal was faster than class Node, but underwhelming and insufficiently compelling :-(  Apparently my proposal needs to be adjusted in some way before it could be sufficiently compelling.
Hey, I just noticed this:  Try compiling the following short program in VS 15.7.6 and when you run it, it throws System.TypeLoadException!  Who is the best person to inform about this bug?  Seems like a serious bug.
class Program
{
	static void Main(string[] args)
	{
		Test();
	}
	static SNode Test()
	{
		return new SNode();
	}
	struct ArrayElementReference<T>
	{
		public T[] Array;
		public int Index;
	}
	struct SNode
	{
		ArrayElementReference<SNode> x;
	}
}

Unhandled Exception: System.TypeLoadException: Could not load type 'TestConsoleApp.Program+SNode' from assembly 'TestConsoleApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at TestConsoleApp.Program.Main(String[] args)

Know issue: https://github.com/dotnet/coreclr/issues/7957

On second thought, let me tell you the exact benchmark results, and you decide for yourself whether it is a worthwhile improvement.  I said "underwhelming" because I was expecting my proposal to be at least 10x faster but it was 3x to 4x faster in this test.  Is that worthwhile?   More importantly, would it solve the problem for the Unity game engine?  Can my proposal be further improved or optimized somehow?
I allocated 51_000_000 nodes.  Each node contains 2 node references and 48 bytes of integers.
When using class Node, it ran for 9.3 seconds.
When using struct Node with my proposal, it ran for 2.5 seconds (3.7 times faster).
I made no attempt to optimize self-references.
The times include the time taken to run:
System.GC.Collect(System.GC.MaxGeneration, System.GCCollectionMode.Forced, blocking: true, compacting: true);
In both tests, System.GC.GetTotalMemory returns approx 3891 megabytes before GC.Collect.
Would anyone like me to email the source code or upload somewhere?

Interesting -- a significant part of the reason why my proposal is faster is revealed by System.GC.CollectionCount.  After running the benchmark with class Node:

Gen 0 collected 649 times.
Gen 1 collected 338 times.
Gen 2 collected 9 times.

After running the benchmark with struct Node:

Gen 0 collected 2 times.
Gen 1 collected 2 times.
Gen 2 collected 2 times.

When I reduced the page/array length to 10_000 nodes (causing more arrays to be allocated), the time increased slightly to 2.8 seconds and the number of collections increased slightly:

Gen 0 collected 6 times.
Gen 1 collected 6 times.
Gen 2 collected 6 times.

Thus my proposal might solve the problem for the Unity game engine because my proposal causes garbage collection to run much less often.  Admittedly it's less beneficial than I presumed it would be.  Is it worthwhile?

I've brainstormed a few alternative solutions that are also quite interesting to think about:
What if a class can have an attribute applied that says that the class should use automatic-reference-counting (like in .NET Native or like in the latest version of MS C++ for UWP apps) instead of the normal CLR GC?
MS C++ automatic-reference-counting still suffers the problem of cyclic references, doesn't it?  Therefore it would ONLY be used for classes that explicitly request it via an attribute.  This would allow people to create particular classes that don't cause garbage collections to run, without resorting to unsafe code.
Another alternative:  If we could somehow allocate a group of objects inside a "GC compartment/container", and the objects inside a compartment are GC'd on an all-or-nothing basis instead of individually.  Any reference to such an object causes all objects in the compartment to be kept alive.  Possibly a compartment remains ineligible for GC until the app explicitly/manually marks it as eligible, such as in a IDisposable.Dispose method or in a finalizer.
What if the CLR supported an ability to allocate a read-only array of class instances where each element of the array is immediately non-null and cannot be changed to any other reference?  System.Array.IsReadOnly == true.  These class instances (array elements) may be GC'd on an all-or-nothing basis similar to an array of structs.  This feature might only be compatible with classes that have a particular attribute applied, and perhaps such classes can ONLY be allocated in this array manner, never individually.
[System.ArrayElementClass]  // Means class is restricted to existing as an array element.
class MyTest1
{
	int TestFieldA;
	MyTest1 Parent;
}

MyTest1[] ary = new MyTest1[10000];
ary[0].TestFieldA = 123;  // Wouldn't cause NullReferenceException.
ary[0] = xxxx;	 // Throws ReadOnlyException.
bool b = ary.IsReadOnly;  // Returns true.
ary[0].Parent = ary[5];   // Supported, unlike if MyTest1 was struct.
MyTest1 individualInstance = new MyTest1();  // Disallowed.

Every instance of a ArrayElementClass class would contain a CLR-internal read-only field/header that stores the array index or byte offset of the instance/element.  Thus if you have a pointer to an instance of an ArrayElementClass, then you can instantly calculate a pointer to the array that contains the instance of the class.  i.e. you can instantly recover the array pointer from an element pointer.
The GC wouldn't track/determine the reachability of each element/instance of ArrayElementClass, rather it would determine the reachability of the array, akin to how it treats an array of structs.

If we could somehow allocate a group of objects inside a "GC compartment/container", and the objects inside a compartment are GC'd on an all-or-nothing basis instead of individually

Similar to https://github.com/dotnet/corefx/issues/31643

authors: JeremyKuhne benaadams gfoidl jaredpar jkotas verelpode

repo: dotnet/corefxlab

license: mit

license_source: bigquery


text:
Create text generation templates for TryParse* invariant overloads, plus tests

Create text generation templates for integer parsing. There are four new templates:
InvariantUnsigned.tt: Implementations of InvariantParser.Invariant{Utf8, Utf16}.TryParse{Byte, UInt16, UInt32, UInt64}
InvariantUnsignedHex.tt Implementations of InvariantParser.Invariant{Utf8, Utf16}.Hex.TryParse{Byte, UInt16, UInt32, UInt64}
InvariantSigned.tt: Implementations of InvariantParser.Invariant{Utf8, Utf16}.TryParse{SByte, Int16, Int32, Int64}
InvariantSigned.tt: Implementations of InvariantParser.Invariant{Utf8, Utf16}.Hex.TryParse{SByte, Int16, Int32, Int64}
The other template, ParserTests.tt in the Tests directory, generates tests for all overloads generated by the above four templates, testing a variety of important scenarios.

@KrzysztofCwalina @joshfree @yizhang82

looks good. Thanks!

authors: KrzysztofCwalina botaberg


text:
Add Applymethod to PrimitiveDataFrameColumn

For issue #2805.
This PR adds an Apply<TResult> method to PrimitiveDataFrameColumn that takes a Func<T?, TResult?> and returns a new column with the new type.
Example usage (taken from the written unit test):
int[] values = { 1, 2, 3, 4, 5 };
var col = new PrimitiveDataFrameColumn<int>("Ints", values);
PrimitiveDataFrameColumn<double> newCol = col.Apply(i => i + 0.5d);

Squash and merging this. Thank you @zHaytam  for the patch!

authors: pgovind zHaytam


text:
String.get_Length returns 0

String.get_Length started returning 0 after #4808 , which breaks printing strings and might indicate other problems. It looks like pinning a string and printing it character-by-character still works, so it could be an issue in the frozen string's length or in reading instance fields.

I've verified that the frozen string's length is in the right place by pinning it and working backward from the pointer. This is probably an issue calling instance methods or reading instance fields.

repo: dotnet/corert


text:
CoreCLR R2R testing building against CoreRT framework

While testing R2R on an IJW assembly, I saw a failure due to a missing framework method (Marshal.GetExceptionPointers). That method is in the CoreCLR framework, but not in CoreRT. While they should be very similar, we should really test against the CoreCLR framework to catch discrepancies.

Simon fixed this.

authors: MichalStrehovsky morganbr


text:
Confusing description of the background garbage collector

Quote:
There is no setting for background garbage collection; it is automatically enabled with concurrent garbage collection. Background garbage collection is a replacement for concurrent garbage collection.
The two sentences contradict each other.

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: d8948cf5-0aec-308c-8046-965cc15763b2
Version Independent ID: a30a0be5-b741-2a9c-e997-55d6d9960ca9
Content: Fundamentals of garbage collection
Content Source: docs/standard/garbage-collection/fundamentals.md
Product: dotnet
Technology: dotnet-standard
GitHub Login: @rpetrusha
Microsoft Alias: ronpet

@bartlomiej-dawidow Thanks for reporting that -- I agree the language was confusing and I've submitted PR #14320 to clarify it.

authors: bartlomiej-dawidow tdykstra

repo: dotnet/docs


text:
Add more documentation for dotnet test and dotnet vstest for Preview 3+ bits

There are certain features that do not exist in the dotnet test and dotnet vstest docs that need to be added, such as the ability to use .runsettings files, how filtering of tests work etc.
/cc @mairaw

is this partly covered here: https://aka.ms/vstest-filtering? I also noticed that we don't have dotnet vstest documented. I'll add a new issue for that.

Is code coverage supported outside of windows yet? thats another good thing to know.

@dmccaffery No, I don't believe it is.

@cartermp :feelsgood:

https://aka.ms/vstest-filtering links now points to a doc page now /cc @samadala

Closing this one in favor of #2382 that has specific action items for dotnet test docs.

authors: blackdwarf cartermp dmccaffery mairaw sbaid


text:
is it possible to declare a variable static and initialize it later on?

Hi to all,
is it possible to first declare a variable static and then, on the following lines of code, to initialize this variable?
I don't know if this is the proper place for this question, but I'm asking because I'd like to initialize the variable to 0, and every time the procedure is called, the value gets back to 0. Since the procedure will be called many times, I don't want to redeclare and reinitialize the variable so that I'll be preventing overhead on my application.
Thanks

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 0b593e2c-d31c-394b-bffd-92ffdb6d6a1e
Version Independent ID: 6b4ed15d-ff3a-6392-0204-6c2436603302
Content: Static - Visual Basic
Content Source: docs/visual-basic/language-reference/modifiers/static.md
Product: dotnet-visualbasic
GitHub Login: @KathleenDollard
Microsoft Alias: kdollard

Why just declare it normally, without the Static keyword ?
Dim yourVariable As Integer = 0

I want to declare static because so that the variable doesn't have to be redeclared and reinitialized on every procedure call (there will be many).
It will do be collected by the GC according to this article (https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/declared-elements/lifetime) - because the procedure is not Shared.

I still feel that the first approach without Static is much better. But anyways, I've shown the two options.
You may need to ask in Stackoverflow on which option is better and why, or wait for someone here who can explain that in deep details.

Well,
I want to do this:
Static myVariable As Integer
myVariable = 0
' block using myVariable
' end block
' variable has to get back to 0 on the next procedure call.
I prefer using my option if it no difference on the application performance.
Thank you for your reply.

@KathleenDollard Can you provide the deeper details on how VB manages storage for local variables declared static? My thought is that there is no real performance improvement in this case, because the type of Counter is a value type. Is that analysis correct?


text:
libicu not found when using zypper

@SchoolGuy commented on Mon Mar 16 2020
Currently the command sudo zypper install libicu will not work because suse uses a different naming schema for this. Since I don't know what exact package is needed for .NET/.NET Core here is the link to the OBS Repository where all packages are built: https://build.opensuse.org/package/show/openSUSE%3AFactory/icu

Dokumentdetails
⚠ Bearbeiten Sie diesen Abschnitt nicht. Er ist für die Verknüpfung von docs.microsoft.com zum GitHub-Artikel erforderlich.

ID: b6baea63-f650-e232-854b-c1722ed72543
Version Independent ID: 56c0bff6-2630-06f8-9c86-e81ca292fd2f
Content: Installieren von .NET Core auf openSUSE 15 mit einem Paket-Manager (.NET Core)
Content Source: docs/core/install/linux-package-manager-opensuse15.md
Product: dotnet-core
GitHub Login: @Thraka
Microsoft Alias: adegeo

@srvbpigh commented on Mon Mar 16 2020
Hello, @SchoolGuy
Thank you for your feedback.
We are actively reviewing your comments and will get back to you soon.
Kind regards,
Microsoft DOCS International Team

Ping @dagood

Currently the command sudo zypper install libicu will not work because suse uses a different naming schema for this.

What distro are you using? SUSE primarily produces SLES, which we have different instructions for:
https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-sles15
https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-sles12

For now I'll assume openSUSE 15 because that's the linked doc. I don't see any issue currently, starting from a fresh Docker container:
$ docker run -it --rm opensuse/leap:15.1 bash -c 'zypper install -y libicu'
Building repository 'Non-OSS Repository' cache ........................................................................................................[done]
Building repository 'Main Repository' cache ...........................................................................................................[done]
Building repository 'Main Update Repository' cache ....................................................................................................[done]
Building repository 'Update Repository (Non-Oss)' cache ...............................................................................................[done]
Loading repository data...
Reading installed packages...
'libicu' not found in package names. Trying capabilities.
Resolving package dependencies...

The following 3 NEW packages are going to be installed:
  libicu60_2 libicu60_2-ledata timezone

3 new packages to install.
Overall download size: 8.2 MiB. Already cached: 0 B. After the operation, additional 31.6 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
...
Checking for file conflicts: ..........................................................................................................................[done]
(1/3) Installing: libicu60_2-ledata-60.2-lp151.3.7.1.noarch ...........................................................................................[done]
(2/3) Installing: timezone-2019c-lp151.2.6.1.x86_64 ...................................................................................................[done]
(3/3) Installing: libicu60_2-60.2-lp151.3.7.1.x86_64 ..................................................................................................[done]

@SchoolGuy, can you please post more info, including the command and its output?
Note that we depend on the "Provides" clause of the libicu package, which is due to be removed, but it hasn't been removed yet in versions of openSUSE that .NET Core supports. See https://github.com/dotnet/runtime/issues/913 for more info.
/cc @NikolaMilosavljevic @leecow @nakarnam

@dagood Yes I am using Tumbleweed but since openSUSE 16/SLES 16 (or however we will name it) will be again branched from Factory aka Tumbleweed the problem will resurface. So even if we close this I digged you up another problem because starting from Leap 15.2/SLES 15 SP2 you will have the same problem again.

Here the specfile for SLES 15 SP2: https://build.opensuse.org/package/view_file/SUSE:SLE-15-SP2:GA/icu/icu.spec?expand=1
Here the specfile for Leap 15.2: https://build.opensuse.org/package/view_file/openSUSE:Leap:15.2/icu/icu.spec?expand=1

> sudo zypper in libicu
[sudo] Passwort für root:
Metadaten von Repository 'Haupt-Repository (NON-OSS)' abrufen ...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................[fertig]
Cache für Repository 'Haupt-Repository (NON-OSS)' erzeugen ..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................[fertig]
Metadaten von Repository 'Haupt-Repository (OSS)' abrufen ...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................[fertig]
Cache für Repository 'Haupt-Repository (OSS)' erzeugen ..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................[fertig]
Metadaten von Repository 'openSUSE Tools' abrufen .......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................[fertig]
Cache für Repository 'openSUSE Tools' erzeugen ..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................[fertig]
Metadaten von Repository 'openSUSE-20200309-0' abrufen ..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................[fertig]
Cache für Repository 'openSUSE-20200309-0' erzeugen .....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................[fertig]
Repository-Daten werden geladen...
Installierte Pakete werden gelesen...
'libicu' wurde in den Paketnamen nicht gefunden. Fähigkeiten werden durchsucht.
Keine Anbieter von 'libicu' gefunden.
Paketabhängigkeiten werden aufgelöst...

Keine auszuführenden Aktionen.

German output but I think you will get the deal.

Ah, yep, .NET Core doesn't support Tumbleweed because we can't keep up with issues like this. We just need some libicu installed, so whatever libicu##_# is available is what you need, then you can ignore the .NET Core package's dependency.
We're aware this is happening (hence https://github.com/dotnet/runtime/issues/913) but I couldn't figure out how to see what changes are in which release. Thanks for the additional info there. I've opened an updated issue to track this: https://github.com/dotnet/runtime/issues/33672.
Closing: we don't support Tumbleweed. Thanks for the heads up on the timeframe for this change though.

authors: CeciAc SchoolGuy Thraka dagood


text:
Which element should be used in config file according the Example?

In the example it use the start element system.identityModel but the closing tag is microsoft.identityModel. Which one should be used?

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 0889facb-5306-2161-9186-9d138512ce48
Version Independent ID: 2315afd9-eb82-5974-8654-37b9914cb394
Content: <claimsAuthenticationManager>
Content Source: docs/framework/configure-apps/file-schema/windows-identity-foundation/claimsauthenticationmanager.md
Product: dotnet-framework
GitHub Login: @BrucePerlerMS
Microsoft Alias: dotnetcontent

Looks like a duplicate of #8544

Closing as duplicate.

Added the duplicate label.

authors: Thraka kwlin mairaw mikkelbu


text:
move serialization docs

Fixes Part 1 of #2770

@rpetrusha good catch on those links! Even though the comments were not really related to moving the docs, I made the fixes. Please review. I've done some global fixes, so the number of files impacted is probably bigger than the number of files you've given feedback to.

Thanks for making the additional changes, @mairaw. This looks really good. It's ready to merge when you want to.

I've noticed I've missed one of the serializer msdn links (my VS Code was super slow yesterday). Fixed that one and I'll merge if builds looks good. Thanks @rpetrusha!

authors: mairaw rpetrusha


text:
Move file keyword into contextual keyword list

C# 11 declares a new feature using a new keyword file to restrict the accessibility. It should be a contextual keyword, not a predefined keyword.
Page: C# Keywords
Content source: docs/csharp/language-reference/keywords/index.md

This is my first PR. If there is something wrong with my operation or modification, please tell me :D

C# 11 declares a new feature using a new keyword file to restrict the accessibility. It should be a contextual keyword, not a predefined keyword.
Page: C# Keywords
Content source: docs/csharp/language-reference/keywords/index.md
This is my first PR. If there is something wrong with my operation or modification, please tell me :D

I think this is an access modifier, like private or public, and it scopes the access to the type within the file itself. Therefore, I believe this belongs next to those other access modifiers. @BillWagner would know for sure.

The speclet doesn't explicitly say if file is a keyword or a contextual keyword.
I think it's a contextual keyword.  Tagging @RikkiGibson to make sure.

file is a contextual keyword, but types named file are blocked from being declared in the language.
We think it's important for people to still be able to declare a variable like Stream file = ...;

hi everybody :)
I found this:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/file
This passage has mentioned that file is a contextual keyword.

Beginning with C# 11, the file contextual keyword is a type access modifier.

I believe Roslyn team was always avoiding to say that file is an access modifier.
@RikkiGibson Could you confirm please? Thanks!

Yeah, we use the term file-local instead of referring to file accessibility. We also avoid saying file scope because we don't want the feature to be compared to file-scoped namespaces.
I would like for us to revisit our language around accessibility, it seems like what we've come up with really doesn't match how users think of it, but that decision should be made by the LDM and for now the docs should probably reflect the existing design.

authors: BillWagner IEvangelist RikkiGibson SunnieShine Youssef1313


text:
Type discriminator order

Fixes #32789.

It's only this morning that I've come across this page in the documentation and given it a read through...
I find it really surprising and disappointing that the words "at the start of the JSON object" were conceived and approved -- and, furthermore, that this polymorphic feature was ever released in the fragile form it has been! A JSON object is an unordered collection of name/value pairs (see json.org). This feature is not standards compliant and cannot be guaranteed to survive intermediary processing that uses JSON I/O. I can't imagine how many software systems are going to be badly architected by those trusting the underlying data encodings because this was "rubber stamped" by the official .NET / Microsoft team. 🤯

authors: QuintinWillison gewarren


text:
Diagnostic port connect mode may not work in Kubernetes

Mounting the /tmp path between containers and using connect mode (the default mode) may not discover processes correctly. I validated with the customer that /tmp was mounted and that the event pipe socket from the application container was visible to dotnet-monitor. This target application is .NET 5; we were able to avoid the issue by using listen mode.

Was there anything interesting about the volume? Was it an emptyDir or something else?

It was an emptyDir if I recall correctly. I'm going to try to reproduce the issue myself and see what happens.

authors: jander-msft shirhatti

repo: dotnet/dotnet-monitor


text:
New Advanced data options dialog

Label shouldn't be selectable twice
Alignment is off in this control :blush:

Alignment fixed in https://github.com/dotnet/machinelearning-tools/pull/913

This issue can be repro on environment:

Windows 10 Enterprise, Version 20H2
ML.Net Model Builder (Preview): 16.5.0.2115505
Microsoft Visual Studio Enterprise 2019: 16.9.4
.Net: 5.0.202

Dadaset: https://testpass.blob.core.windows.net/test-pass-data/issues.tsv.txt

This issue can't be repro on：

Windows 10 Enterprise, Version 20H2
ML.Net Model Builder (Preview): 16.5.21.2122301
Microsoft Visual Studio Enterprise 2019: 16.9.4
.Net: 5.0.202

Main branch:
https://privategallery.blob.core.windows.net/gallery/refs/heads/main/atom.xml
Steps：

Create new C# console app with .Net 5.0;
Add model builder by right click on the project;
Navigate to Data page after selected scenario and environment;
Open Advanced data options dialog, the "Save" button remain disable if you select multi "Label" purpose.

authors: beccamc vzhuqin

repo: dotnet/machinelearning-modelbuilder


text:
ML Sentiment Model does not populate score

Microsoft Visual Studio Community 2022
Version 17.1.0 Preview 1.0
VisualStudio.17.Preview/17.1.0-pre.1.0+31903.286
Microsoft .NET Framework
Version 4.8.04161
Installed Version: Community
.NET Core Debugging with WSL   1.0
.NET Core Debugging with WSL
ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools
ASA Service Provider   1.0
ASP.NET and Web Tools 2019   17.1.125.8155
ASP.NET and Web Tools 2019
ASP.NET Web Frameworks and Tools 2019   17.1.125.8155
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0   17.1.125.8155
Azure App Service Tools v3.0.0
Azure Data Lake Tools for Visual Studio   2.6.4000.0
Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools   17.1.125.8155
Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio   2.6.4000.0
Microsoft Azure Stream Analytics Tools for Visual Studio
C# Tools   4.1.0-1.21551.6+e4419d6f6792da7011c8589ba118f59d830ca72f
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Cookiecutter   17.0.21295.2
Provides tools for finding, instantiating and customizing templates in cookiecutter format.
Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events
Microsoft Azure Hive Query Language Service   2.6.4000.0
Language service for Hive query
Microsoft Azure Service Fabric Tools for Visual Studio   17.0
Microsoft Azure Service Fabric Tools for Visual Studio
Microsoft Azure Stream Analytics Language Service   2.6.4000.0
Language service for Azure Stream Analytics
Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects
Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager   2.1.134+45632ee938.RR
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio Tools for Containers   1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Node.js Tools   1.5.31027.1 Commit Hash:dac60d9b246a1d6a5daf23d223c933dbe1518465
Adds support for developing and debugging Node.js apps in Visual Studio
NuGet Package Manager   6.1.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Python - Profiling support   17.0.21295.2
Profiling support for Python projects.
Python with Pylance   17.0.21295.2
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Razor (ASP.NET Core)   17.0.0.2152601+724154d925d7d9d26ebf8a73a66d5219aa320400
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools   17.0.62110.20190
Microsoft SQL Server Data Tools
ToolWindowHostedEditor   1.0
Hosting json editor into a tool window
TypeScript Tools   17.0.1029.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools   4.1.0-1.21551.6+e4419d6f6792da7011c8589ba118f59d830ca72f
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools   17.1.0-beta.21525.2+46af4a248255f4af2284883f48983fe7dd07a760
Microsoft Visual F# Tools
Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Describe the bug
The Sentiment score is not being populated
        Console.WriteLine($"Data to Analyze: ", sampleData.Col0);
        Console.WriteLine($"\n\nPredicted Sentiment: {predictionResult.Prediction}\n\n");
        Console.WriteLine($"\n\nPredicted score: {predictionResult.Score}\n\n");

Debugger shows:  "\n\nPredicted score: System.Single[]\n\n"
To Reproduce
Steps to reproduce the behavior:

Run the demo as is, behavior does not change with sentiment

Expected behavior
A sentiment floating point score between {0.0..1.0}
Screenshots

Sorry for hitting this issue.
Data classification we only show the predicted class if you want to see the probability of each label for a sample data you can look at on evaluating page.
Do you want to see the probability of each class in Program.cs?
@briacht  what is your thought?

@zewditu Was this a bug in code gen that has been fixed?

yes, it is already fixed

This should be fixed in the latest release. Please ping me if you are still having problems. Thanks!

authors: beccamc johndohoneyjr zewditu


text:
Migrate Microsoft.Bcl.HashCode

Includes history from the old release/3.1 branch.
The latest available package in nuget.org is https://www.nuget.org/packages/Microsoft.Bcl.HashCode/1.1.1 and I was able to confirm that my local build successfully generated package 1.1.2.

By the way, NuGet.config is still using the dotnet6 transport. Should I update it to dotnet9?

Need this merged first: https://github.com/dotnet/maintenance-packages/pull/19 . Once merged, I will rebase this PR.

This PR should now be unblocked.

No squash merge!

No squash merge!

I don't have permission to merge-commit, unfortunately. Even with elevation.

authors: ViktorHofer carlossanlop

repo: dotnet/maintenance-packages


text:
Added basic extract to component functionality on cursor over html tag

### Summary of the changes
Part of the implementation of the Extract To Component code action. Functional in one of the two cases, when the user is not selecting a certain range of a Razor component, but rather when the cursor is on either the opening or closing tag.

Holding off approval just because you'll have to merge in the main branch and switch to System.Text.Json in a few places. Sorry about that!

I just pushed the main changes into the feature branch. @marcarro you can just do these commands in your local branch and then handle merge commits. I can help you with that today or Friday
git fetch upstream features/extract-to-component:features/extract-to-component
git merge features/extract-to-component

@dotnet/razor-compiler , PTAL (going into a feature branch)

authors: marcarro phil-allen-msft ryzngard

repo: dotnet/razor


text:
Turn off trailing whitespace triming in strings

We have tests with baselines that have trailing whitespaces. Our trimTrailingWhitespace setting means that those will get modified automatically, breaking those tests. To fix that, I implemented a vscode feature to avoid triming inside regex and strings, so let's use that.

@dotnet/razor-compiler for an extremely small review.


text:
"SDKs" show up as packages when they are indirect

I think this SDK thing is a leaky abstraction, for example, .NETStandard.Library shows up as SDK when it top level, but when it's a indirect, it shows up a package:

i think everything is as expected. in your screenshot we have an SDK X and it's dependencies, which include an SDK Y. It might have a different icon though when displayed as dependency.

Btw, i just added  to my project and it is not marked as implicit at all , and is resolved as package - what did you mean "it is SDK when it is top level"?

<PackageReference Include="NETStandard.Library" Version="1.6.0" />

That's my point how we marked SDK'd as SDKs is leaky - it only works if all of them are marked implicit, here .NETStandard.LIbrary is pulled it because of it's referenced by a implicit package.

@abpiskunov When you use a console app, it shows up as child of "Microsoft.NETCore.App". But when you use a class library, it shows up directly under "SDK", thus it shows up at top level.

dupe of RTM approved issue https://github.com/dotnet/roslyn-project-system/issues/1456 , we will be hiding all default implicit packages and show them as SDK only

authors: abpiskunov davkean fubar-coder

repo: dotnet/roslyn-project-system


text:
Win32Exception with Dapr

Describe the bug
An exception occurs when we launch tye run inside the sample repo for Dapr

To Reproduce
Download the sample for Dapr here, and run tye run (I just followed the instructions into the readme)
Further technical details

tye --version

dapr --version

dotnet --version

Looks like it can't find the daprd process? cc @rynowak

@ChrisProlls - do you have dapr on your path? can you can run daprd -version?

I reinstall dapr and all seems to work now, daprd -version is working and so tye run.
Thanks !

authors: ChrisProlls davidfowl rynowak

repo: dotnet/tye


text:
Logging Extension - Seq

What should we add or change to make your life better?
Create an extension to push logs to Seq
This would be similar to the existing extension built into Tye:

Tye can push logs to Elastic stack easily without the need for any SDKs or code changes in your services.

Would be implemented in a method like this into tye.yaml:
extensions:
  - name: seq

Why is this important to you?
I have implemented Seq into my microservice project, however seeing how simple it was to integrate logging with the built-in Tye method was eye opening.
Would be great to build a lot more extensions like this. E.g. grafana, prometheus, jaeger,

For context -- I have used this library in the past and it made configuring logging very simple with json-like settings to magically determine where to send logs. This could be used as a reference for implementing this feature:
https://github.com/convey-stack/Convey.Logging
https://github.com/convey-stack/Convey.Logging/blob/master/src/Convey.Logging/Extensions.cs

Updated with an (not functional) attempt to implement this. It is definitely a good starting point though

Updated with an implementation + docs