text:
Program loads blank when server status page is down.

Unsure if the Server Status page being offline has anything to do with it, but I figured I'd add that info.
To reproduce this issue, this is what I did:
Played WoW till the servers went down.
Thought "I wonder if there's an app that will notify me when they are back up"
Found this app, downloaded and installed.
First run.
App goes "Not Responding" for about 60 seconds, (See first screenshot)
App then unfreezes, gets a background texture, and that's all. nothing more (Screenshot 2)
At best guess (As I'm not a programmer) I'm guessing it can't handle the Server Status page being down?

Maybe not.....
ServerStatus page is back online. reloading WoW Stat shows the same issue. blank window.

resolved in https://github.com/arzynik/wowstat/releases/tag/3.0.2

authors: DazzaJay arzynik

repo: arzynik/wowstat


text:
Fsharp functions

sin x, cos x.... etc
derivative x expr...
conj a b...
tests...
🦆

Codecov Report

Merging #304 (85d7de2) into master (8d6f6e0) will increase coverage by 0.52%.
The diff coverage is 95.42%.

@@            Coverage Diff             @@
##           master     #304      +/-   ##
==========================================
+ Coverage   76.01%   76.54%   +0.52%
==========================================
  Files         107      107
  Lines        8806     9265     +459
  Branches     1485     1485
==========================================
+ Hits         6694     7092     +398
- Misses       1625     1686      +61
  Partials      487      487

Impacted Files
Coverage Δ

AngouriMath/Core/Antlr/AngouriMathParser.cs
77.80% <87.34%> (-0.77%)
:arrow_down:

AngouriMath/Core/Antlr/AngouriMathLexer.cs
99.19% <100.00%> (+0.24%)
:arrow_up:

AngouriMath/Convenience/MathS.cs
70.61% <0.00%> (+5.67%)
:arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d6f6e0...85d7de2. Read the comment docs.

source: gharchive/pull-request

authors: WhiteBlackGoose codecov-io

repo: asc-community/AngouriMath

license: MIT

license_type: permissive

license_source: github-api


text:
Resolve issue for rating a movie

Fixed a typographical error? to re-allow to evaluate a movie
Types of changes

[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[x] I have read the CONTRIBUTING document.

All Submissions:

[x] Have you followed the guidelines in our Contributing document?
[x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

[x] Have you added an explanation of what your changes do and why you'd like us to include them?
[x] Have you successfully ran tests with your changes locally?

Resolve #381 issue


text:
resolves #686 use character spacing to fine-tune width of placeholder for inline image

use character spacing to distribute extra space not covered by placeholder chars
force at least one placholder char for narrow images and use negative character spacing to recover overrun
simplify how spacer count is computed

Depends on #685.

repo: asciidoctor/asciidoctor-pdf

license: mit

license_source: bigquery


text:
Test failure

The build is failing because of a failing tests, unfortunately the logic is complicated and I don't understand what it's trying to test.
  1) test loading relationships with filter by actor works (AshGraphql.CustpmPaginateTest)
     test/custom_paginate_test.exs:168
     Refute with != failed
     code:  refute count != Enum.count(results)
     left:  1
     right: 0
     stacktrace:
       test/custom_paginate_test.exs:250: (test)

I'm going to bypass it for now.

Did we do a release with this test failing?

source: gharchive/issue

authors: jimsynz zachdaniel


text:
🛑 KMSd is down

In 2b33ad0, KMSd (home.ashishkhokhar.com) was down:

HTTP code: 0
Response time: 0 ms

Resolved: KMSd is back up in f54e3e6 after 15 minutes.

repo: ashish-khokhar/services-status


text:
When used with Turbolinks 5 lightbox creates multiple modal views

First of all I really love the plugin, Thanks so much for that.
So the issue occurs when I move from first main page to another, the ekko-lightbox.min.js is loaded multiple types using turbolinks 5 because of which when I click on the image it opens multiple modals so you have to close them one by one.
Thanks,
George

You'll be better off asking on stackoverflow as your issue isn't with the lightbox but with turbolinks.

@itspradhan have you found a way to fix this?

authors: acegilz ashleydw itspradhan

repo: ashleydw/lightbox


text:
运行时后出现内存警告

2016-08-24 11:22:31.628 MD360PlayerDemo[6703:2724679] Received memory warning.

(void)viewDidLoad {
[super viewDidLoad];
// Create a AVPlayerItem
AVPlayerItem *playerItem = [[AVPlayerItem alloc] initWithURL:[NSURL URLWithString:@"http://d8d913s460fub.cloudfront.net/krpanocloud/video/airpano/video-1920x960a.mp4"]];
self.player = [[AVPlayer alloc] initWithPlayerItem:playerItem];
[self.player play];
AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];
[playerLayer setFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.width * 9 / 16)];
[self.view.layer addSublayer:playerLayer];
/////////////////////////////////////////////////////// MDVRLibrary
MDVRConfiguration* config = [MDVRLibrary createConfig];
[config asVideo:playerItem];
[config setContainer:self view:self.view];
// optional
[config displayMode:MDModeDisplayNormal];
[config interactiveMode:MDModeInteractiveMotionWithTouch];
[config projectionMode:MDModeProjectionSphere];
[config pinchEnabled:true];
[config setDirectorFactory:self];
self.vrLibrary = [config build];
}

麻烦提供下版本号，谢谢

pod 'MD360Player4iOS', '~> 1.1.3.beta' 这个版本的，连接真机提示。

你是通过pod方式引入的，还是直接下载的master代码？

自己的Demo是使用pod引入的。 还有po主我使用AVPlayer来播放无效果啊，是只有使用VIMPlayer才好用么？谢谢了

一样的，VIMPlayer封装了AVPlayer

好的 我自己在研究下。

authors: Fuhanyu ashqal


text:
Panic after playing a few tracks in a playlists

Heya,
it seems there is an issue for some people trying to play Spotify playlists, including me, where vollibrespot first hangs not playing the next track in a playlist, when trying to skip the stuck track it then panics.
The issue was brought up over at the HiFiBerry Github, I also replied there with my log output: https://github.com/hifiberry/hifiberry-os/issues/519
My journalctl output is as follows:
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SendError("...")', /home/matuschd/buildroot-3/host/share/cargo/git/checkouts/librespot-e4d7c35a023053af/1a224a3/playback/src/player.rs:232:61
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]: stack backtrace:
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    0:   0x9d7b20 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    1:   0x9fefd8 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    2:   0x9d04c0 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    3:   0x9da120 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    4:   0x9d9b08 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    5:   0x9da80c - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    6:   0x9da2e4 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    7:   0x9d80d8 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    8:   0x9da22c - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:    9:   0x4c28bc - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   10:   0x4c2990 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   11:   0x5da23c - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   12:   0x5a8d60 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   13:   0x5a6ab4 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   14:   0x4e5db0 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   15:   0x508250 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   16:   0x50aaf8 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   17:   0x4f76bc - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   18:   0x50a818 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   19:   0x532014 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   20:   0x4fcce8 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   21:   0x4e85e8 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   22:   0x520b18 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   23:   0x520ce4 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   24:   0x9dacfc - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   25:   0x4e9d28 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   26: 0x76ca46e0 - <unknown>
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]:   27: 0x76ca47e4 - __libc_start_main
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]: [Vollibrespot] : Player thread panicked!
Apr 03 15:10:36 hifiberry-stefan-zimmer vollibrespot[1707]: [Vollibrespot] : EventSender disconnected
Apr 03 15:10:36 hifiberry-stefan-zimmer systemd[1]: spotify.service: Main process exited, code=exited, status=101/n/a
Apr 03 15:10:36 hifiberry-stefan-zimmer systemd[1]: spotify.service: Failed with result 'exit-code'.
Apr 03 15:10:36 hifiberry-stefan-zimmer python3[369]: INFO: powercontroller - Update LED state for state=paused
Apr 03 15:10:36 hifiberry-stefan-zimmer python3[369]: ERROR: powercontroller - Could not write to power controller: 121
Apr 03 15:10:36 hifiberry-stefan-zimmer node[747]: Source 'spotify' has deactivated.
Apr 03 15:10:36 hifiberry-stefan-zimmer python3[369]: INFO: http_post - posted metadata update to http://127.0.0.1:80/sources/metadata ({'artist': 'Da Tweekaz', 'title': 'Sunrise', 'albumArtist': None, 'albumTitle': 'Sunrise', 'artUrl': 'https://i.scdn.co/image/ab67616d0000b273cdab17d23a96e5a0d08d2f37', 'externalArtUrl': None, 'discNumber': None, 'tracknumber': None, 'playerName': 'spotify', 'playerState': 'paused', 'streamUrl': None, 'playCount': None, 'mbid': None, 'artistmbid': None, 'albummbid': None, 'loved': None, 'wiki': None, 'loveSupported': False, 'tags': [], 'skipped': False, 'host_uuid': None, 'releaseDate': None, 'trackid': None, 'hifiberry_cover_found': False, 'duration': 0, 'time': 0, 'position': 0, 'positionupdate': 1712148474.585062})
Apr 03 15:10:37 hifiberry-stefan-zimmer sshd[2160]: kex_exchange_identification: Connection closed by remote host
Apr 03 15:10:37 hifiberry-stefan-zimmer sshd[2160]: Connection closed by XXXXXX port 55987
Apr 03 15:10:41 hifiberry-stefan-zimmer node[747]: Checking MPD database update status...
Apr 03 15:10:41 hifiberry-stefan-zimmer systemd[1]: spotify.service: Scheduled restart job, restart counter is at 3.
Apr 03 15:10:41 hifiberry-stefan-zimmer systemd[1]: Stopped Vollibrespot.

After not using Spotify with HifiBerry OS from the Spotify Windows App for two weeks I had the same issue. I reinstalled the Windows App and now it's not connecting at all with Vollibrespot. It tries and then falls back again.
Using the iOS Spotify App the situation is still the same as EpicLPer discribed.

I have a slightly different stack trace (if that helps) - also using HiFiBerryOS.
librespot and vollibrespot haven't had releases in a while, and HiFiBerryOS hasn't changed versions for either of them lately either (as far as I can tell) + this was working just fine prior to a few months ago - I wonder if this is a change on Spotify's side that has caused a sudden breakage.
Jun 22 21:21:02 patio vollibrespot[2363]: thread '<unnamed>' panicked at /home/matuschd/buildroot-4/host/share/cargo/git/checkouts/librespot-e4d7c35a023053af/1a224a3/playback/src/player.rs:771:56:
Jun 22 21:21:02 patio vollibrespot[2363]: Vorbis error: OggError(HashMismatch(3493727944, 3229890524))
Jun 22 21:21:02 patio vollibrespot[2363]: stack backtrace:
Jun 22 21:21:02 patio vollibrespot[2363]:    0:       0x558bda5674 - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:    1:       0x558bdce0fc - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:    2:       0x558bda1cd8 - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:    3:       0x558bda54a8 - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:    4:       0x558bda6aac - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:    5:       0x558bda67c0 - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:    6:       0x558bda7068 - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:    7:       0x558bda6f30 - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:    8:       0x558bda5b58 - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:    9:       0x558bda6c88 - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:   10:       0x558b93e2f8 - <unknown>
Jun 22 21:21:02 patio vollibrespot[2363]:   11:       0x558b93e650 - <unknown>
Jun 22 21:21:03 patio vollibrespot[2363]:   12:       0x558ba1ee08 - <unknown>
Jun 22 21:21:03 patio vollibrespot[2363]:   13:       0x558b9698d0 - <unknown>
Jun 22 21:21:03 patio vollibrespot[2363]:   14:       0x558b9684f8 - <unknown>
Jun 22 21:21:03 patio vollibrespot[2363]:   15:       0x558b98b30c - <unknown>
Jun 22 21:21:03 patio vollibrespot[2363]:   16:       0x558b973034 - <unknown>
Jun 22 21:21:03 patio vollibrespot[2363]:   17:       0x558bdab46c - <unknown>
Jun 22 21:21:03 patio vollibrespot[2363]:   18:       0x7fb5827e00 - <unknown>
Jun 22 21:21:03 patio vollibrespot[2363]:   19:       0x7fb588d80c - <unknown>
Jun 22 21:21:03 patio vollibrespot[2363]:   20:                0x0 - <unknown>

So, I'm seeing the same behavior using MoOde Audio - which uses librespot so I definitely suspect this issue affects them upstream as well.

I suspect https://github.com/librespot-org/librespot/issues/1292 is related.

repo: ashthespy/Vollibrespot


text:
feat: add FAQ section

Related Issue
#340
Description
I have added an FAQ section using accordions which displays the most frequently asked question answers.It will help clear the common queries of users.I have also added some sample question answers based on git-re from my own.
Type of PR

[ ] Bug fix
[x] Feature enhancement
[ ] Documentation update
[ ] Other (specify): _______________

Screenshots / videos (if applicable)

https://github.com/ashutosh-rath02/git-re/assets/122633300/7ee36541-222a-443f-96f3-7c3a767af08c
Checklist:

[x] I have performed a self-review of my code
[x] I have read and followed the Contribution Guidelines.
[x] I have tested the changes thoroughly before submitting this pull request.
[x] I have provided relevant issue numbers, screenshots, and videos after making the changes.
[x] I have commented my code, particularly in hard-to-understand areas.

Additional context:
[Include any additional information or context that might be helpful for reviewers.]

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@komal-agarwal5 resolve this please and remove the underline please

@komal-agarwal5 resolve this please and remove the underline please

@ashutosh-rath02 I made the corrections, is it working now?

@ashutosh-rath02 sir can you please add the gssoc and level labels?


text:
Enchancement : Hover Effect on Cards

The Hover Effect on cards can make the website more user-interactive and visually appealing.
Can you assign this task to me under GSSOC 2024?

can I also work on the same issue  as a part of GSSOC24  ,I would like to give it nice dark theme tailwind css with responsive and neat tailwind css

Hi @devmusiczz , you can start the work for this issue and all the best!

Hello, @ashutoshgithubs
I go through the project and I would like to work on this project
can you please assign this issue to me so that I can add some hover effect on the cards to make it more beautiful.


text:
Fix: python slices of splits used incorrect offsets.

32-bit and 64-bit offset logic assumed a Strs produced from by slicing a previous Strs started at offset 0. str.split().slice([1:]), for instance, produced impossible end offsets. This was the cause of some SEGVs and negative-length Python string constructions.
Deduplicate the 32-bit and 64-bit logic, and fix the bug in the single copy of the logic.
Test for 32-bit and 64-bit indices. Previous version of lib.c caused this test to SEGV or produce runtime errors about constructing Python strings of negative length depending on memory conditions.

Against current main-dev

Didn't realize the PR contains a patch until today, sorry, will merge soon 🤗

authors: ashvardanian kmapb

repo: ashvardanian/StringZilla


text:
How long before advices start appearing?

This is a question rather than an issue, (do you have a forum that I could use rather?)
I pulled the latest version and ran node gekko, everything seems fine.
All the values in my config.js are default, apart for the exchange and one or two values.
config.debug = false; // for additional logging / debugging
...
config.watch = {

  // see https://github.com/askmike/gekko#supported-exchanges
  exchange: 'Poloniex',
  currency: 'USDT',
  asset: 'BTC'
}
...
config.adviceLogger = {
  enabled: true
}
...
// do you want Gekko to calculate the profit of its own advice?
config.profitSimulator = {
  enabled: true,
  // report the profit in the currency or the asset?
  reportInCurrency: true,
  // start balance, on what the current balance is compared with
  simulationBalance: {
    // these are in the unit types configured in the watcher.
    asset: 1,
    currency: 100,
  },
  // how much fee in % does each trade cost?
  fee: 0.25,
  // how much slippage/spread should Gekko assume per trade?
  slippage: 0.05
}

I have emails setup, (and I get an email when Gekko start).
I have been running for a little over 24hrs and so far nothing at all, not a single trade advisory, is that normal?
Am I missing something? Maybe I am not looking in the right place, it anything logged somewhere else?
Thanks
FFMG

What trading strategy are you using and what parameters did you put? You can test to see if the strategy gives you any advice by running backtests.

I am using everything default, no strategies changed or anything.
Maybe it is just me, but this is how I learn how things work, see the 'default' behaviour and see how it goes and then make some changes.
I wonder, seen the events of the last few days, maybe the market is very uncertain at the moment and this is been reflected in the advices?

Yes it's very likely. You can change the strategy to DEMA with candles 1, history 2, long 3, short 4 to see an extremely short term trading strategy.

authors: FFMG rickylqhan

repo: askmike/gekko


text:
Add Shadow Catcher material support

Hey there!
It would be super awesome if you could add a shadow catcher material or property to the material so that we can have built-in support for materials that catch shadows but are unaffected by light. I don't think that's possible to do right now without making a custom shader, and I've been struggling with that using the core library haha (I looked at the logo example, as well as source for Physical Material but a lot of it feels very foreign to me)
My goal is to have a transparent ground plane catch shadows from a 3D model, but ignore other lighting. If you could build this feature in natively that would be awesome 🙏
Lots of other renderers have built-in support for this, like Unity and Three.js :)

I'm not sure I understand 🤔 what will you use the catched shadows for? It sounds a bit like a shadow map, which is already supported. Or maybe it's a bit different but I guess you can use the same approach, ie render the shadow into a render target and use that result as a texture.

It's to implement something like this, where I have the transparent floor that catches shadows, but doesn't itself emit light (otherwise the floor would brighten, removing the illusion of the floor being the same color as the background)

I managed to figure this one out using a custom shader, but I'm still having trouble with Mixamo animations which is a blocker for me if you have time to take a look 🙏
I think we can close this issue for now since I managed to find a way around it

Yeah, ok, that's a very special use-case, but let's leave it open, this is probably a fun task to do 🙂

authors: asny george-lim

repo: asny/three-d


text:
🛑 Google is down

In 9b5881c, Google (https://www.google.com) was down:

HTTP code: 429
Response time: 291 ms

Resolved: Google is back up in e4c42bb.

repo: asolergo/upptime


text:
Run A/B test to validate new "advanced tutorial" doc type

We are already updating the web API tutorial following the advanced tutorial guidelines.  This issue is for:

Make a copy that follows the existing tutorial guidelines.
Set up an A/B test
Analyze the results

Closing since content model is changing and we would no longer test against old design.

authors: tdykstra wadepickett


text:
Youtube Series of video tutorials? Maybe?

It'd be nice for this section to have a video version, so beginners like myself have a better understanding of every step. The Razor section videos were extremely helpful and didactic, I don't see any reason for this extremely complicated topic to not have them.

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

ID: faf18d20-d28f-1efa-d329-181fff3630fa
Version Independent ID: 46a7c2e0-4871-491f-02c2-54f7df2237b1
Content: Get started with ASP.NET Core MVC and Visual Studio
Content Source: aspnetcore/tutorials/first-mvc-app/start-mvc.md
Product: aspnet-core
GitHub Login: @Rick-Anderson
Microsoft Alias: riande

He may eventually do this series, we're not doing them.

@krchome please do the series <3

For me, this textual tutorial is enough. I have been used to reading the documentation since I used Foxpro 2.6 for DOS which was accessed from its Help Utility (via F1 function). I used MSDN Library for learning more on VB6, Office Automation (Word and Excel COM); I used Books Online for learning SQL Server 2000. So far I only use videos for leaning how to drive a car and parking and some automotive DIY things. :)

authors: ArsalanWahid Lexiebkm Rick-Anderson eduFDiaz


text:
Control when StateHasChanged has finished

Is your feature request related to a problem? Please describe.
In blazor, in scenarios like dynamically initializing components, it will be handy to have an option to pass a "callback" to StateHasChanged instead of putting the logic in a life-cycle method like OnAfterRender. This is somewhat more convenient and easy to read.
For example:
// ParentComponent.razor.cs
public async void OnClick()
 {

        // create a child component
        RenderFragment += CreateChildComponent;
        StateHasChanged();  // not finished

        // ChildComponentRef is null
        ChildComponentRef.Show();
}

can be written like:
public async void OnClick()
{
        ...
        RenderFragment += CreateChildComponent;
        StateHasChanged(() => { ChildComponentRef.Show() });
}

Another option might be to await it, but this implies a new method, e.g. StateHasChangedAsync:
public async void OnClick()
{
        ...
        RenderFragment += CreateChildComponent;
        await StateHasChangedAsync();
        ChildComponentRef.Show();
}

Currently, I am not able to implement this approach as wrapping the call in a Task.Run():
public async void OnClick()
{
        ....
        await Task.Run(() =>
       {
             RenderFragment += CreateChildComponent;
             StateHasChanged();
       }).ContinueWith(() =>
       {
            ChildComponentRef.Show();
       });
}

fails with an exception:

The current thread is not associated with the renderer's synchronization context. Use Invoke() or InvokeAsync() to switch execution to the renderer's synchronization context when triggering rendering or modifying any state accessed during rendering.

Still, having a callback seems more convenient and it also doesn't introduce a new method.

In blazor, in scenarios like dynamically initializing components, it will be handy to have an option to pass a "callback" to StateHasChanged instead of putting the logic in a life-cycle method like OnAfterRende

I see. Yes, that would be convenient in some cases.
The drawback is that then the framework would have to do some extra internal tracking, so it could remember all the callbacks and their associations with different rendering requests. We'd need some new internal data structures which would involve extra heap allocations during the render cycle.
Since this is an unusual case and handling it comes with real perf drawbacks, I think it's not something we'd be likely to do in the foreseeable future.
Generally there are a couple of more practical ways to deal with initialization of descendants:

OnAfterRenderAsync
Having code in the descendant components themselves that does whatever you want in their OnInit/OnInitAsync methods (including possibly making calls back to the ancestor component if you need)

If these approaches aren't viable in your case, it would be great to know more about what you're doing. Hope that makes sense!

Thanks @SteveSandersonMS, the suggested approaches are viable. The idea was about providing an additional convenient way of handling the same, but as this comes at a cost, then OnAfterRenderAsync will be used instead.
Out of curiosity:

Since this is an unusual case and handling it comes with real perf drawbacks, I think it's not something we'd be likely to do in the foreseeable future.
are there any ideas for a general improvement that will probably make the extra heap allocations not that critical according to performance? I suppose that this is very important for the wasm hosting model.

are there any ideas for a general improvement that will probably make the extra heap allocations not that critical according to performance

GC is always a major consideration for perf on .NET. We've done a lot of work in ASP.NET Core generally, and Blazor specifically, to minimize GC costs, and I expect that to continue indefinitely. Our goal is to make the framework as GC-light as possible so that application developers have more headroom to do what they want that might stress the GC more.
There's probably no magic bullet to fix this, however in the long run GC might get a lot cheaper if WebAssembly itself can provide a managed heap, which is one of the proposals being worked on by the WebAssembly specs group.

Seems like there is a way to await StateHasChanged by using ComponentBase.Invoke, which makes the callback or async version ideas redundant. The idea with Task.Run(() => StateHasChanged()) fails, but Invoke uses the correct synchronization context.

authors: Stamo-Gochev SteveSandersonMS

repo: aspnet/AspNetCore


text:
Test failure: _4_BuildIncremental

This issue was made automatically. If there is a problem contact ryanbrandenburg.
This test failed with the following error:
System.InvalidOperationException : Command dotnet restore /warnaserror --no-cache --source https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-2/20181029-01/final/index.json --source https://api.nuget.org/v3/index.json --runtime osx-x64 returned exit code 1

  Restoring packages for /Users/vsts/agent/2.141.1/work/_temp/tmp9am1Ul.tmp/razor/EnvironmentVariableAndNuGetOrg/osx-x64/razor.csproj...
  Installing runtime.win-x64.runtime.native.System.Data.SqlClient.sni 4.4.0.
  Installing Microsoft.AspNetCore.Authentication.Facebook 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Authentication.MicrosoftAccount 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Authentication.Google 2.2.0-rtm-35586.
  Installing System.Xml.XPath 4.3.0.
  Installing runtime.native.System.Security.Cryptography.Apple 4.3.0.
  Installing runtime.native.System.Net.Http 4.3.0.
  Installing System.Security.Cryptography.OpenSsl 4.3.0.
  Installing Microsoft.AspNetCore.Cryptography.KeyDerivation 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.HttpOverrides 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Localization.Routing 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Identity.EntityFrameworkCore 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Mvc.Formatters.Xml 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.ResponseCompression 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Mvc.Razor.ViewCompilation 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.ResponseCaching 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Owin 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Rewrite 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.SignalR 1.1.0-rtm-35586.
  Installing Microsoft.AspNetCore.StaticFiles 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Session 2.2.0-rtm-35586.
  Installing Microsoft.EntityFrameworkCore.Analyzers 2.2.0-rtm-35586.
  Installing Microsoft.EntityFrameworkCore.Abstractions 2.2.0-rtm-35586.
  Installing Microsoft.EntityFrameworkCore.InMemory 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Server.Kestrel.Https 2.2.0-rtm-35586.
  Installing Microsoft.EntityFrameworkCore.Relational 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Configuration 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.SpaServices 2.2.0-rtm-35586.
  Installing Microsoft.EntityFrameworkCore.Tools 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Configuration.Binder 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Configuration.EnvironmentVariables 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Configuration.UserSecrets 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Configuration.CommandLine 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Configuration.FileExtensions 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Configuration.Ini 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Configuration.KeyPerFile 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.SpaServices.Extensions 2.2.0-rtm-35586.
  Installing Microsoft.AspNetCore.Server.Kestrel 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Hosting 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.FileProviders.Physical 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Diagnostics.HealthChecks 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Http 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Logging.Console 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Logging 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.FileProviders.Embedded 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Logging.Configuration 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Options.ConfigurationExtensions 2.2.0-rtm-35586.
  Installing Microsoft.Extensions.Logging.Debug 2.2.0-rtm-35586.
  Installing Micros

Other tests within that build may have failed with a similar message, but they are not listed here. Check the link above for more info.
This test failed on release/2.2.
CC Eilon

This comment was made automatically. If there is a problem contact ryanbrandenburg.
Please use this workflow to address this flaky test issue, including checking applicable checkboxes and filling in the applicable "TODO" entries:

Is this actually a flaky test?

No, this is a regular test failure, fix the test/product (TODO: Link to commit/PR)
Yes, proceed below...

Is this test failure caused by product code flakiness? (Either this product, or another product this test depends on.)

[ ] File a bug against the product (TODO: Link to other bug)
Is it possible to change the test to avoid the flakiness?

Yes? Go to the "Change the test!" section.
No?

[ ] Disable the test (TODO: Link to PR/commit)
[ ] Wait for other bug to be resolved
[ ] Wait for us to get build that has the fix
[ ] Re-enable our test (TODO: Link to PR/commit)
[ ] Close this bug

Is it that the test itself is flaky? This includes external transient problems (e.g. remote server problems, file system race condition, etc.)

Is there is a way to change our test to avoid this flakiness?

Yes? Change the test!

[ ] Change the test to avoid the flakiness, for example by using a different test strategy, or by adding retries w/ timeouts (TODO: Link to PR/commit)
[ ] Run the test 100 times locally as a sanity check.
[ ] Close this bug

No?

Is there any logging or extra information that we could add to make this more diagnosable when it happens again?

Yes?

[ ] Add the logging (TODO: Link to PR/commit)

No?

[ ] Delete the test because flaky tests are not useful (TODO: Link to PR/commit)

This comment was made automatically. If there is a problem contact ryanbrandenburg.
There were 193 failures with about the same error on release/2.2 at 12:38:50 PM:

_3_Build
_8_Exec
_4_BuildIncremental
_4_BuildIncremental
_4_BuildIncremental
_6_Publish
_7_PublishIncremental
_4_BuildIncremental
_4_BuildIncremental
_4_BuildIncremental
(And 183 more test failures in this build)

Duplicate of https://github.com/aspnet/AspNetCore/issues/3686

authors: aspnet-hello natemcmaster


text:
Inject ICorsPolicyProvider instance through Invoke

This allows for scoped instances of ICorsPolicyProvider to be injected in the CORS middleware and prevents turning them into singletons.
Resolves #105

@henkmollema,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

/cc @brockallen @davidfowl

@Eilon are we going forward with this PR? And if so, do you want me to update (rebase) it?

@davidfowl @Eilon updated and rebased.

We need to update baseline.json as well.

BTW per the discussion in https://github.com/aspnet/CORS/issues/105, this is a breaking change, so it can't be taken as-is in the 2.1 release, so this PR is "on hold" until we figure out how to resolve that.

This issue was moved to aspnet/Home#2376

@mkArtakMSFT  - any further action planned on this PR?
I think that given it's a breaking change, I recommend we close it.

@Eilon close?

Why close? It needs to be fixed at some point.

It's likely a breaking change would necessitate waiting until 3.0.

Sure. Don't you have a way of assigning/labeling the PR for 3.0?

Resolving the moved issue: https://github.com/aspnet/Home/issues/2377

@henkmollema, we do want to take this change in, and we've just marked the referenced issue accordingly. However, this PR is outdated already and given that we aren't going to act on it yet, you can close it if you want and we'll do the change when the right time will come.

Tracking merging this in #202

authors: Eilon aspnet-hello brockallen dnfclas henkmollema mkArtakMSFT pranavkm

repo: aspnet/CORS


text:
Document process for collecting crash dumps

For AppServices we might want to use https://blogs.msdn.microsoft.com/asiatech/2015/12/28/use-crash-diagnoser-site-extension-to-capture-dump-for-intermittent-exception-issues-or-performance-issues-on-azure-web-app/ as a basis
For on-prem scenarios there is https://docs.microsoft.com/en-us/windows/desktop/wer/collecting-user-mode-dumps but we might want to turn it into exact set of steps with correct values or even a powershell script (https://github.com/aspnet/AspNetCore/blob/cb21edc5009b254388fc6da93d212f679087c326/.azure/pipelines/tools/SetupTestEnvironment.ps1#L71-L73).
cc @guardrex @shirhatti

AppServices

Let me know if you have notes that I should drop into the text. This will likely be a short section in the App Services Troubleshooting topic.

on-prem scenarios

I recommend specific steps or the PS approach. Can engineering provide the steps and/or the script? If so, what would the ETA look like ... should I push this issue back to April (or later)?

I'll write a script today

EnableDumps.ps1
param(
    [Parameter(Position=0,mandatory=$true)]
    $application,
    [Parameter(Position=1,mandatory=$true)]
    $location
    )

$werHive = "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting";
$ldHive = "$werHive\LocalDumps";
$applicationHive = "$ldHive\$application";

if (!(Test-Path $ldHive))
{
    New-Item -Path $werHive -Name "LocalDumps";
}

if (!(Test-Path $applicationHive))
{
    New-Item -Path $ldHive -Name $application;
}

New-ItemProperty $applicationHive -Name "DumpFolder" -Value $location -PropertyType "ExpandString" -Force;
# Allow maxinum 5 dumps
New-ItemProperty $applicationHive -Name "DumpCount" -Value 5 -PropertyType "DWORD" -Force;
# 2 - Full Dump
New-ItemProperty $applicationHive -Name "DumpType" -Value 2 -PropertyType "DWORD" -Force;

DisableDumps.ps1
param(
    [Parameter(Position=0,mandatory=$true)]
    $application
    )

$werHive = "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting";
$ldHive = "$werHive\LocalDumps";
$applicationHive = "$ldHive\$application";

if (Test-Path $applicationHive)
{
    Remove-Item $applicationHive -Force;
}

Usage
# OutOfProcess
.\EnableDumps dotnet.exe c:\dumps
# InProcess
.\EnableDumps w3wp.exe c:\dumps

.\DisableDumps dotnet.exe
.\DisableDumps w3wp.exe

authors: guardrex pakrym

repo: aspnet/Docs


text:
X.509 security certificate prerequisite is never used?

"X.509 security certificate" is listed under prerequisite, but I don't see it mentioned in any of the later steps.  What was the reason for including this?

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

ID: a25bf940-8977-fec4-461b-542a9f550fc8
Version Independent ID: 5492c641-af15-64b8-beaa-ddf511be73e6
Content: Get started with Razor Pages in ASP.NET Core
Content Source: aspnetcore/tutorials/razor-pages/razor-pages-start.md
Service: unspecified
Product: aspnet-core
GitHub Login: @Rick-Anderson
Microsoft Alias: riande

@bitdozer  great question. I was just wondering that myself. @scottaddie  / @guardrex  do you know why that's listed? Can I remove it?

It was added to cover IIS dev scenario #6415, and this topic became caught up in that update. I'll refactor the IIS dev topic to have its own prereq section and not use the include. Thanks @bitdozer for letting us know.

@Rick-Anderson Looks to me like that include file was modified for the development-time-iis-support.md file (https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/development-time-iis-support?view=aspnetcore-2.0). This doc does require a certificate.

My use case is I want to recommend this tutorial to some beginning .NET developers and needed to understand how to support/justify that pre-req.  I see the need in the IIS setup article, but agree it makes more sense as a local rather than global pre-req.  Thanks for considering this change.

This doc does require a certificate.

And it requires a bunch of other under the hood stuff too. This is a VS tutorial and that's done for you automatically. Let's remove it.

https://github.com/aspnet/Docs/pull/6585

authors: Rick-Anderson bitdozer guardrex scottaddie


text:
It is hard to understand where has the "AccountController" in previous version has gone to ,and what replaces it.

It is hard to understand where has the "AccountController" in previous version has gone to ,and what replaces it.

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

ID: 804e24dd-7e30-8cf5-2c99-1ffacb4582f6
Version Independent ID: 3e25547b-e2c9-6634-2c38-2a77207f17d4
Content: Scaffold Identity in ASP.NET Core projects
Content Source: aspnetcore/security/authentication/scaffold-identity.md
Product: aspnet-core
GitHub Login: @Rick-Anderson
Microsoft Alias: riande

See The 2.1  Migration doc/Changes to authentication code

Thanks a lot !
also : How come that for Asp.NET WebAPI projects you can use Individual Authentication using local storage and the template "forces" you to use Active Directory B2C ?

How come that for Asp.NET WebAPI projects you can use Individual Authentication using local storage and the template "forces" you to use Active Directory B2C ?

@blowdart  Can you answer? that's probably worth documenting.  cc/ @CamSoper

Bug - you shouldn't be scaffolding identity into an API project :)

Sorry, I gave wrong description.
How come that for MVC project you can use Identity with local storage
And for WebApi you must use AD ?
What do you mean “bug”?
We have been using Identity in WebAPI for years , there is even a pluralsight course on this topic ( approx 2015)

Because WebApi shouldn't be authenticated with cookies, it should be with JWT. When we moved to Core the JWT service went away. It's planned to come back in some form soon.

authors: Rick-Anderson blowdart tshaiman


text:
To download the small sample takes roughly 600 MB currently

Currently one is required to download or clone the complete docs repo which takes roughly 600 MB as a payload in order to work with the sample code. Ideally github and/or the docs platform should provide a more lean way to only download the sample code specifically.

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

ID: 0dd2991d-c22d-ad0f-80b6-bd1b503db8f3
Version Independent ID: 5e3fbe1d-c97f-9940-4f0c-067d4b2112b1
Content: Tutorial: Get started with SignalR on ASP.NET Core
Content Source: aspnetcore/tutorials/signalr.md
Product: aspnet-core
GitHub Login: @tdykstra
Microsoft Alias: tdykstra

Hello @cveld  ... The documentation engineers are working on a fix for this so that individual samples can be downloaded. No ETA yet, but we hope it will be resolved soon. https://github.com/aspnet/Docs/issues/6991#issuecomment-398104010

authors: cveld guardrex


text:
Create initial prototype of dotnet-user-secrets with MSBuild support

A prototype port of "dotnet-user-secrets" from project.json to MSBuild support.
This CLI project tool requires the ability to evaluate the project file to find the 'UserSecretsId' property. At the moment, this change will introduce a dependency on the existence and location of the .NET Core SDK. Without this, we cannot properly set the "MSBuildExtensionsPath" property which leads to project evaluation failing on initialization.
NB: merging to feature/msbuild, not dev. More refinement needed before this is ready for a nightly version.
TODO:

[x] Can we remove dependency on existence of MSBuild inside .NET Core SDK? (I hope so.) Not for now. Maybe for 1.0.0 we can.
[x] How to publish this thing as a nupkg? (see https://github.com/Microsoft/msbuild/issues/1097 and https://github.com/Microsoft/msbuild/issues/1096) Punting this for now. Will address when CLI stabilizes.
[x] Better error handling project evaluation fails to find SDK
[x] Provide upgrade path from project.json to msbuild - see https://github.com/dotnet/cli/pull/4326
[x] Update Microsoft.Extensions.Configuration.UserSecrets to support MSBuild scenarios - https://github.com/aspnet/Configuration/pull/525

cc @NTaylorMullen @bricelam @prafullbhosale @davidfowl @jeffkl @eerhardt

:up: :date: responded to much of the feedback above. Refactored MSBuild evaluation into reusable components.

:up: :date: rebased on top of project model abstractions.

Any reason to not support both project.json and msbuild?

@NTaylorMullen I would assume we won't want to support both PJ and MSBuild, but I've opened that up for discussion with our PMs.

Ping @NTaylorMullen any other changes needed before I merge to feature/msbuild ?

authors: NTaylorMullen natemcmaster

repo: aspnet/DotNetTools


text:
Invalid column name when implementing delete behavior

Hi,
Is this an issue or am I missing something?
I'm trying to implement delete behavior, as consecuence, deleting records is successful, just as I expected BUT when I try to query the data, I get errors like "Invalid column name 'MetricId1'.", of course is invalid because I never created that column, I created MetricId, so why is looking for that column?
As soon as I remove the delete behavior starts working OK, but of course I don't have this feature and I need it. Could you help me please?
OnModelCreated
modelBuilder.Entity<Metric>().ToTable("Metric");
            modelBuilder.Entity<Metric>().HasMany(typeof(BoardMetric)).WithOne().OnDelete(DeleteBehavior.Cascade);

Metric class
public class Metric
{
        [Some properties here]
        [InverseProperty("Metric"), Display(Name = "Boards")]
        public IList<BoardMetric> BoardMetrics { get; set; }
}

BoardMetric class
public class BoardMetric
{
       [Some properties here]

        [ForeignKey("Metric")]
        public int MetricId { get; set; }

        public Metric Metric { get; set; }
}

Metric Table
CREATE TABLE [dbo].[Metric](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Some field here]
 CONSTRAINT [PK_Metric] PRIMARY KEY CLUSTERED
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

BoardMetric table
CREATE TABLE [dbo].[BoardMetric](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[MetricId] [int] NOT NULL,
	[BoardId] [int] NOT NULL,
 CONSTRAINT [PK_BoardMetric] PRIMARY KEY CLUSTERED
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

Constraints and foreight keys
ALTER TABLE [dbo].[BoardMetric]  WITH CHECK ADD  CONSTRAINT [FK_BoardMetric_Board] FOREIGN KEY([BoardId])
REFERENCES [dbo].[Board] ([Id]) ON DELETE CASCADE
GO

ALTER TABLE [dbo].[BoardMetric] CHECK CONSTRAINT [FK_BoardMetric_Board]
GO

ALTER TABLE [dbo].[BoardMetric]  WITH CHECK ADD  CONSTRAINT [FK_BoardMetric_Metric] FOREIGN KEY([MetricId])
REFERENCES [dbo].[Metric] ([Id]) ON DELETE CASCADE
GO

ALTER TABLE [dbo].[BoardMetric] CHECK CONSTRAINT [FK_BoardMetric_Metric]
GO

@iriza84 I only read the first paragraph, but if you think this is an issue with the EF Core product, the right repository to report it is https://github.com/aspnet/entityframeworkcore.

Other than that, the empty call to WithOne() is asserting that there is no navigation property going back from BoardMetric into Metric for that relationship, which doesn't match what the InversePropertyAttribute says. Hence I believe what is happening is that the conventions are inferring that there must be two separate relationships and hence a separate shadow property gets created for the second foreign key, named MetricId1.

ok, thanks a lot for your answer


text:
Fix #5444 - Uwp ToListAsync() throws Exception with Message "The sema…

…phore has been disposed.
Improves exception that is generated when a context is disposed before an async query has completed.

:shipit:

authors: ajcvickers anpete

repo: aspnet/EntityFramework


text:
Column Created Time in EFMigrationsHistory

Can I add a column Time to the table __EFMigrationsHistory with a utc time of the created row populated.
As I can see at the moment there is a hard-coded HistoryRow which cannot be changed outside.
Any ideas are very welcome.
See the following example
public class CustomHistoryRepository : NpgsqlHistoryRepository
    {
        public CustomHistoryRepository(HistoryRepositoryDependencies dependencies)
            : base(dependencies)
        {
        }

        protected override void ConfigureTable(EntityTypeBuilder<HistoryRow> history)
        {
            base.ConfigureTable(history);

            history
                .Property<DateTime>("Time")
                .HasValueGenerator<DateTimeUtcValueGenerator>()
                .ValueGeneratedOnAdd();
        }

        public override string GetInsertScript(HistoryRow row)
        {
            return base.GetInsertScript(row);
        }
    }

var dbOptions = new DbContextOptionsBuilder(options)
                    .UseNpgsql(settings.DefaultConnection)
                    .ReplaceService<IHistoryRepository, CustomHistoryRepository>()
                    .Options;

Further technical details
EF Core version: Microsoft.AspNetCore.Identity.EntityFrameworkCore v.2.1.3
Database Provider: Npgsql.EntityFrameworkCore.PostgreSQL v.2.1.2
Operating system: Visual Studio 2017 Community v.15.8.7

The entity type is only used for generating the CREATE TABLE statement. All other configuration is ignored.
You could generate the value in the database using a default value:
history
    .Property<DateTime>("Time")
    .HasDefaultValueSql("CURRENT_TIMESTAMP AT TIME ZONE 'UTC'");

Or you could manually change the INSERT statement. Note however, that this would do funny things when generating a SQL script form the migrations. The value would be the time you generated the script, not the time you actually applied the migration.
public override string GetInsertScript(HistoryRow row)
{
    var stringMapping = Dependencies.TypeMappingSource.GetMapping(typeof(string));
    var dateTimeMapping = Dependencies.TypeMappingSource.GetMapping(typeof(string));

    return @"INSERT INTO ")
        .Append(SqlGenerationHelper.DelimitIdentifier(TableName, TableSchema))
        .Append(" (")
        .Append(SqlGenerationHelper.DelimitIdentifier(MigrationIdColumnName))
        .Append(", ")
        .Append(SqlGenerationHelper.DelimitIdentifier(ProductVersionColumnName))
        .Append(", ")
        .Append(SqlGenerationHelper.DelimitIdentifier("Time"))
        .AppendLine(")")
        .Append("VALUES (")
        .Append(stringTypeMapping.GenerateSqlLiteral(row.MigrationId))
        .Append(", ")
        .Append(stringTypeMapping.GenerateSqlLiteral(row.ProductVersion))
        .Append(", ")
        .Append(dateTimeMapping.GenerateSqlLiteral(DateTime.UtcNow))
        .Append(")")
        .AppendLine(SqlGenerationHelper.StatementTerminator)
        .ToString();
}

Your code may also just work after we implement #2737.

Thanks Brice. Your code works fine. Did't know about HasDefaultValueSql as it was different namespace I had to add.

authors: bricelam denis-pujdak-adm-it

repo: aspnet/EntityFrameworkCore


text:
multiple identical primary key columns in the select result  after use OwnsOne

Describe what is not working as expected.
If you are seeing an exception, include the full exceptions details (message and stack trace).
Exception message:多次为 't' 指定了列 'Id0'。
Stack trace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader()
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(DbContext _, Boolean buffer)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
   at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at TCenter.SelfTrade.Infrastructure.Repositorys.BizOfferRepository.GetPageList[S](Int32 pageIndex, Int32 pageSize, Expression`1 where, Expression`1 orderBy, Boolean ascending)

SQL created by EF is
exec sp_executesql N'SELECT [t].[Id0], [t].[CostPrice], [t].[CreatedDate], [t].[DetailContent], [t].[Feature], [t].[Images], [t].[IsDeleted], [t].[IsSalesPromotion], [t].[LastModified], [t].[OriginalPrice], [t].[PublishStatus], [t].[SKUId], [t].[SPUId], [t].[SaleNum], [t].[SalePrice], [t].[ShippingType], [t].[Tags], [t].[Title], [t].[ViewNum], [t].[Id], [t].[Supplier_SupplierGoodsId], [t].[Supplier_UserId], [t].[Supplier_UserName], [t].[CategoryInfo_BizCategoryId], [t].[CategoryInfo_BizCategoryName], [t].[CategoryInfo_GameAreaId], [t].[CategoryInfo_GameAreaName], [t].[CategoryInfo_GameId], [t].[CategoryInfo_GameName], [t].[CategoryInfo_GameServerId], [t].[CategoryInfo_GameServerName]
FROM (
SELECT [p].[Id] AS [Id0], [p].[CostPrice], [p].[CreatedDate], [p].[DetailContent], [p].[Feature], [p].[Images], [p].[IsDeleted], [p].[IsSalesPromotion], [p].[LastModified], [p].[OriginalPrice], [p].[PublishStatus], [p].[SKUId], [p].[SPUId], [p].[SaleNum], [p].[SalePrice], [p].[ShippingType], [p].[Tags], [p].[Title], [p].[ViewNum], [p].[Id], [p].[Supplier_SupplierGoodsId], [p].[Supplier_UserId], [p].[Supplier_UserName], [p].[Id] AS [Id0], [p].[CategoryInfo_BizCategoryId], [p].[CategoryInfo_BizCategoryName], [p].[CategoryInfo_GameAreaId], [p].[CategoryInfo_GameAreaName], [p].[CategoryInfo_GameId], [p].[CategoryInfo_GameName], [p].[CategoryInfo_GameServerId], [p].[CategoryInfo_GameServerName], ROW_NUMBER() OVER(ORDER BY @@RowCount) AS [RowNumber]
FROM [Goods] AS [p]
WHERE ([p].[IsDeleted] = 0)
) AS [t]
WHERE ([t].[RowNumber] > @__p_0) AND ([t].[RowNumber] <= (@__p_0 + @__p_1))',N'@__p_0 int,@__p_1 int',@__p_0=0,@__p_1=10
public class Goods{
public string Id {get;set;}
public Category CategoryInfo { get; set; }
public Supplier Supplier { get; set; }
}
public class Category{
public string GameId { get; set; }
}
public class Supplier{
public string UserId { get; set; }
}
public class BizOfferItemMap : IEntityTypeConfiguration<Goods>{
public void Configure(EntityTypeBuilder<Goods> builder){
builder.ToTable("Goods");
builder.HasKey(k => k.Id);
builder.OwnsOne(o => o.CategoryInfo);
builder.OwnsOne(o => o.Supplier);
}
}
public class BizOfferRepository{
public PagedResult<Goods> GetPageList<S>(int pageIndex, int pageSize, Expression<Func<Goods, bool>> where, Expression<Func<Goods, S>> orderBy, bool ascending = false)
        {
            pageIndex = pageIndex <= 0 ? 1 : pageIndex;
            pageSize = pageSize <= 0 ? 10 : pageSize;
            where = where ?? (t => true);

            int count = AppContext.Set<Goods>().AsNoTracking().Where(where).Count();

            var query = AppContext.Set<Goods>().AsNoTracking().Where(where);
            if (orderBy != null)
            {
                query = ascending ? query.OrderBy(orderBy) : query.OrderByDescending(orderBy);
            }
            query = query.Skip((pageIndex - 1) * pageSize).Take(pageSize);

            return new PagedResult<Goods>(pageIndex, pageSize, count, query.ToList());

        }
}

Further technical details
EF Core version: 2.1.4
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: windows server 2016
IDE: Visual Studio 2017 15.9.2

@xyz91 I have not been able to reproduce this; my test code is below. Can you post a runnable project/solution or complete code listing like that below that demonstrates the behavior you are seeing.
public class Goods
{
    public string Id { get; set; }
    public Category CategoryInfo { get; set; }
    public Supplier Supplier { get; set; }
}

public class Category
{
    public string GameId { get; set; }
}

public class Supplier
{
    public string UserId { get; set; }
}

public class BizOfferItemMap : IEntityTypeConfiguration<Goods>
{
    public void Configure(EntityTypeBuilder<Goods> builder)
    {
        builder.ToTable("Goods");
        builder.HasKey(k => k.Id);
        builder.OwnsOne(o => o.CategoryInfo);
        builder.OwnsOne(o => o.Supplier);
    }
}
public class BizOfferRepository
{
    public List<Goods> GetPageList<S>(
        BloggingContext context,
        int pageIndex,
        int pageSize,
        Expression<Func<Goods, bool>> where,
        Expression<Func<Goods, S>> orderBy,
        bool ascending = false)
    {
        pageIndex = pageIndex <= 0 ? 1 : pageIndex;
        pageSize = pageSize <= 0 ? 10 : pageSize;
        where = where ?? (t => true);

        int count = context.Set<Goods>().AsNoTracking().Where(where).Count();

        var query = context.Set<Goods>().AsNoTracking().Where(where);
        if (orderBy != null)
        {
            query = ascending ? query.OrderBy(orderBy) : query.OrderByDescending(orderBy);
        }
        query = query.Skip((pageIndex - 1) * pageSize).Take(pageSize);

        return query.ToList();

    }
}
public class BloggingContext : DbContext
{
    private static readonly LoggerFactory Logger
        = new LoggerFactory(new[] { new ConsoleLoggerProvider((_, __) => true, true) });

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder
            .UseLoggerFactory(Logger)
            .EnableSensitiveDataLogging()
            .UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Test;ConnectRetryCount=0");
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ApplyConfiguration(new BizOfferItemMap());
    }
}

public class Program
{
    public static void Main()
    {
        using (var context = new BloggingContext())
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            var results
                = new BizOfferRepository().GetPageList(
                    context,
                    1,
                    20,
                    g => g.Id == "One",
                    g => g.Id,
                    ascending: false);
        }
    }
}

Sorry, I'm late for reply，No errors because of use fetch next ,This error occurs only when rownumber is used，Here's my error demo.The point of error is to use UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Test;ConnectRetryCount=0", b => b.UseRowNumberForPaging())
`namespace OwnsOneErrorDemo
{
class Program
{
    static void Main(string[] args)
    {
        using (var context = new BloggingContext())
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            var results
                = new BizOfferRepository().GetPageList(
                    context,
                    1,
                    20,
                    g => true,
                    g => g.CreateTime,
                    ascending: false);
        }
        Console.ReadKey();
    }
}

public class Goods
{

    public int Id { get; set; }
    public Category CategoryInfo { get; set; }
    public Supplier Supplier { get; set; }
    public DateTime CreateTime { get; set; }
}

public class Category
{
    public string GameId { get; set; }
}

public class Supplier
{
    public string UserId { get; set; }
}

public class BizOfferItemMap : IEntityTypeConfiguration<Goods>
{
    public void Configure(EntityTypeBuilder<Goods> builder)
    {
        builder.ToTable("Goods");
        builder.HasKey(k => k.Id);
        builder.OwnsOne(o => o.CategoryInfo);
        builder.OwnsOne(o => o.Supplier);
        //builder.Property(a => a.CreateTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd();
    }
}
public class BizOfferRepository
{

    public List<Goods> GetPageList<S>(
        BloggingContext context,
        int pageIndex,
        int pageSize,
        Expression<Func<Goods, bool>> where,
        Expression<Func<Goods, S>> orderBy,
        bool ascending = false)
    {
        pageIndex = pageIndex <= 0 ? 1 : pageIndex;
        pageSize = pageSize <= 0 ? 10 : pageSize;
        where = where ?? (t => true);

        int count = context.Set<Goods>().AsNoTracking().Where(where).Count();

        var query = context.Set<Goods>().AsNoTracking().Where(where);
        if (orderBy != null)
        {
            query = ascending ? query.OrderBy(orderBy) : query.OrderByDescending(orderBy);
        }
        query = query.Skip((pageIndex - 1) * pageSize).Take(pageSize);

        return query.ToList();

    }
}
public class BloggingContext : DbContext
{
    private static readonly LoggerFactory Logger
        = new LoggerFactory(new[] { new ConsoleLoggerProvider((_, __) => true, true) });

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder
            .UseLoggerFactory(Logger)
            .EnableSensitiveDataLogging()
            .UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Test;ConnectRetryCount=0", b => b.UseRowNumberForPaging());
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ApplyConfiguration(new BizOfferItemMap());
    }
}

}`

Duplicate of #12880

authors: ajcvickers smitpatel xyz91


text:
Migrations: Use reflection order for columns in CreateTable

Fixes #2272

The more code I write, the less confident I become. 😄 I'm doing one last round of bashing on this before I merge...


text:
Relational: Translate SelectMany

SelectMany in linq look something like following (second clause is considered the collection selector)
from c in cs
from o in c.Orders
select....

Following are the translations of SelectMany
Unrelated collection selector
from c in cs
from o in os

Generates CROSS JOIN
Correlated collection selector with correlation being a predicate
from c in cs
from o in os.Where(o => o.CustomerID == c.CustomerID)

Such predicate can be lifted and used in generating a join. So this query generates JOIN.
If collection selector ends with DefaultIfEmpty then it is LEFT JOIN.
Correlated collection selector with correlation not a predicate
from c in cs
from o in os.Select(o => c.City)

Since we cannot generate a join predicate here, this translates to CROSS APPLY.
If collection selector ends with DefaultIfEmpty then it is OUTER APPLY.

Add support for Cross Apply
Add Support for Outer Apply
Convert Cross Apply to Inner Join when possible
Convert Outer Apply to Left Join when possible
Add translation for DefaultIfEmpty
Add translation for both overloads of SelectMany
Handle DefaultIfEmpty & SelectMany without collectionSelector in Navigation Expansion
Ensure columns are in projection when generating join predicate from a correlated subquery

Currently there are no tests for Cross/Outer Apply.
Our earlier Cross Apply got converted to join. N+1 evaluation tests are disabled right now, which would generate Cross Apply.
We never supported Outer Apply in past.
Resolves #15711
Resolves #12567
Resolves #12572
Resolves #12872
Resolves #16330
Resolves #15081
Resolves #16989
Re-enable tests for #12449

@maumar Please make it a priority to review this when you get in. (You were nominated in triage! 🚎)

Renamed CrossApplyExpression -> InnerJoinLateralExpression & OuterApplyExpression -> LeftJoinLateralExpression to match with formal SQL terminology. Also updated relational implementation and moved SqlServer specific sql syntax in provider code.

authors: ajcvickers smitpatel


text:
Removed unnecessary space.

Summary of the changes (Less than 80 chars)

Removed unnecessary space.

It isn't unnecessary. We put spaces after commas.

authors: jzeferino pakrym

repo: aspnet/Extensions


text:
Antiforgery token validation failed even when the form that is posted contains the token

I'm having a weird issue that may or may not be a bug in asp related to CSRF tokens.
I have an action with the following attributes:
[HttpPost]
[ValidateAntiForgeryToken]
[Authorize]

When I post to this, I get:

Antiforgery token validation failed. The required antiforgery request token was not provided in either form field "__RequestVerificationToken" or header value "RequestVerificationToken".

If I check the HTML of the page using Chrome, I see that the form contains the following hidden input:
<input name="__RequestVerificationToken" type="hidden" value="CfDJ8O3lgopbgsJNtDH_fqvyV9D9trRngoK8OrpG0nwsV-aBRi70ONhbzJlxd18xNg1ih7cE2oCRGfhWi1NkyS1RiqS4GRO6B5I-737ciTn3Q9ppPABkKkXoF2QBsn8FE3jMvwkaNRNDtFFV_Fgfh9R2O4DQ9JH8ruFUDXuQczjESTpAsrKJY0oNmArWaNHNvp3wUw">
This should be all that is needed, right?
However, if I manually add a @Html.AntiForgeryToken() at the top of the form, the POST succeeds.
This addition does add the following, which is the same as above:
<input name="__RequestVerificationToken" type="hidden" value="CfDJ8O3lgopbgsJNtDH_fqvyV9D9trRngoK8OrpG0nwsV-aBRi70ONhbzJlxd18xNg1ih7cE2oCRGfhWi1NkyS1RiqS4GRO6B5I-737ciTn3Q9ppPABkKkXoF2QBsn8FE3jMvwkaNRNDtFFV_Fgfh9R2O4DQ9JH8ruFUDXuQczjESTpAsrKJY0oNmArWaNHNvp3wUw">
So by the end of it, I have duplicate __RequestVerificationToken inputs on my form. One that is automatically injected, and the other I manually inject through the @Html helper... but the post only succeeds if I manually use the helper.
Relevant packages:
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final"

Did you close this because you found a solution? I believe we had a bug in this area for RC2. /cc @kichalla

The part where you are seeing duplicate antiforgery token fields on the form was the bug in RC2(which was fixed for 1.0 release). But based on your description you shouldn't need to add the @Html.AntiforgeryToken again if the antiforgery token field has already been auto-generated(you are probably using tag helper attributes which would cause this).
Could you share how your .cshtml looks like? Or was it a mistake at your end?(since you closed the issue).

I closed this because it was an issue on my side. I had a form embedded within a form (by mistake). So when the inner form posted, the outer form had the anti forgery token, thus the action didn't receive it.

authors: kichalla mariocatch rynowak

repo: aspnet/Home


text:
Provide a zipped file provider

From @Tratcher on Wednesday, September 6, 2017 12:57:26 PM
Consider a file provider that exposes the contents of a zip file. There may also be optional caching of the unzipped content of individual files. This could be used to reduce project publish size, time, etc..
Copied from original issue: aspnet/FileSystem#292

From @natemcmaster on Saturday, September 9, 2017 10:37:13 PM
Duplicate of https://github.com/aspnet/FileSystem/issues/213. We discussed before and decided not to implement this. Any reason to reconsider?

From @Tratcher on Saturday, September 9, 2017 10:42:46 PM
@DamianEdwards and I were discussing different ways to reduce app deployment size, and the static wwwroot assets are one of the largest pieces. I put together a sample here:
https://github.com/Tratcher/ZipFileProviderExp/blob/729bff83b63022e7a666bb6c33e424a4e0afe9f7/SampleSite/Program.cs#L26
It reduced the template static assets size from 2.4mb to 600kb.
The actual solution he wants is to pre-gzip the individual files and serve them directly to the client with the proper compression headers, but all of that logic needs to be built into the StaticFiles middleware rather than the file system layer.

From @muratg on Wednesday, November 15, 2017 4:23:21 PM
Tentatively putting this in 2.2.0.  I suspect we'll possibly punt it again after talking about some details.

Tentatively putting this in 3.0.

authors: aspnet-hello muratg


text:
AspNetCore.OpenIdConnect Cookies Not Handled by Full .Net HttpClient

I have an interesting problem related to OpenID Connect Authentication in ASP .NET Core.  We have an Identity Server 3 OIDC implementation that uses a client certificate authentication provider.  When migrating to ASP .NET Core, we had no problem integrating with our existing OIDC server.  At least when launched from a browser (Edge, Chrome).
However, we have a small ClickOnce application (using the full .NET framework) that also authenticates and makes calls through the ASP.  It does this by using a HttpClient with a certificate selected by the user.  This ClickOnce application fails during authentication.  The code is pretty simple.
using (WebRequestHandler certHandler = new WebRequestHandler
{
   CookieContainer = new CookieContainer(),
   ClientCertificateOptions = ClientCertificateOption.Manual,
   UseDefaultCredentials = true,
   AllowAutoRedirect = true
})
{
   // Init
   certHandler.ClientCertificates.Add(certificate);

   using (HttpClient client = new HttpClient(certHandler) { BaseAddress = baseUri })
   {
      HttpResponseMessage response = a_client.GetAsync(ssoLoginUri).GetAwaiter().GetResult();
      response.EnsureSuccessStatusCode();

      // Process self submitting form responses as long as needed
      do
      {
         response = ProcessFormAutoSubmit(a_client, response);
      }
      while (response != null);
   }
}

After moving to ASP .NET Core, this code no longer works.  The issue is that when MVC redirects to Identity Server, it includes 2 cookies (.ASPNetCore.Correlation.OpenIdConnect and .AspNetCore.OpenIdConnect.Nonce).  Those cookies never make it into my CookieContainer (other cookies from Identity Server are handled fine).  When the signin-oidc callback is made, MVC fails with the error: "Correlation failed: .AspNetCore.Correlation.OpenIdConnect.9N18bzJ1hcpG5YjRMw_QgUJ_PnapfVx2lBmdvb8Q_zA' cookie not found.".  Makes sense.  But why is the cookie not added?
After playing around, I was able to get around this by handling each redirect and manually adding any cookies that had a path (both of which the 2 missing cookies had).  The code now looks like this:
...
HttpResponseMessage response = a_client.GetAsync(ssoLoginUri).GetAwaiter().GetResult();
Regex cookiePathRegex = new Regex(@"path=([^;]*);?");

do
{
   // Ideally we would just use automatic redirects in the HttpClient, but we need to intercept cookies for special processing
   if (response.StatusCode == HttpStatusCode.Redirect)
   {
      Uri requestUri = response.Headers.Location;
      if (!requestUri.IsAbsoluteUri)
      {
         requestUri = UriUtil.Combine(response.RequestMessage.RequestUri.GetLeftPart(UriPartial.Authority), response.Headers.Location.OriginalString);
      }

      response = a_client.GetAsync(requestUri).GetAwaiter().GetResult();

      IEnumerable<string> responseCookies = null;
      if (response.Headers.TryGetValues("set-cookie", out responseCookies))
      {
         // Cookies that have a path aren't currently supported with HttpClient
         // Such cookies are used with the new ASP .NET Core OpenId Connect implementation
         // Just manually add these cookies
         foreach (string sCookie in responseCookies)
         {
            Match pathMatch = cookiePathRegex.Match(sCookie);
            if (pathMatch.Success)
            {
               a_webRequestHandler.CookieContainer.SetCookies(
                  UriUtil.Combine(requestUri.GetLeftPart(UriPartial.Authority), pathMatch.Groups[1].Value),
                  cookiePathRegex.Replace(sCookie, String.Empty));
            }
         }
      }
   }
   else
   {
      response.EnsureSuccessStatusCode();
      response = ProcessFormAutoSubmit(a_client, response);
   }
}
while (response != null);

This works, but seems like a hack.  Any idea why these cookies aren't handled by HttpClient?
I realize this may not be directly be an ASP .NET Core issue, but wanted to start here since it seems to be related to cookies from ASP .NET Core.
Thanks,
--David

Hi, a few things I'm wondering:

Is there any difference on the wire (using Fiddler or a similar sniffer) about what the cookies look like?
Which version of ASP.NET Core is this?

I apologize for leaving out those details.  That's how I actually found this issue.  In Fiddler, I can see that the 2 cookies mentioned are not passed to signin-oidc.  Also, we are using ASP.NET Core 2.0.5.  And on the ClickOnce application we are using 5.2.4 of Microsoft.AspNet.WebApi.Client for HttpClient.

@dgweldon thanks for the info. Is there any difference in the cookies sent by the server to the client, comparing ASP.NET's cookies to ASP.NET Core?
Ultimately I don't think HttpClient particularly cares who sent it the cookies, so presumably there's a difference in what it got from the initial request, and thus isn't sending the cookie to the subsequent request.

Just to be clear, I'm talking about 2 clients (web browser and ClickOnce app using HttpContext) going through the same ASP .NET Core server.  There is no ASP .NET server in play in this problem scenario.
But the cookies sent to each client look very similar.
Here are the ones sent to the web browser:
Set-Cookie: .AspNetCore.OpenIdConnect.Nonce.CfDJ8DuLivGqBmBIhlg8v1hx8hkKoV4aMEN4JZQIZh8XtW6QOylzcoWYSl6-9oTiyqNz3ArlloCOVv9GrsNmqRyHzTIhA5Nbupb2NMefUOnZrwHJWi2DJxhKptMSn0KfBG-mk73roMSV6D27NdDmKL6qDVc4IjrBMZLLI7avVrgUVKipSN_T-AIof4YklPwbTRiArvDX39OrCaJNYTOrxXYLS2LaZEBoLHYcQJyTFfxukg8BVjteWW2CjVl56of9h7AUfqhRLS5Z9X9U19r-pdHsdAw=N; expires=Tue, 20 Feb 2018 16:04:02 GMT; path=/signin-oidc; httponly
Set-Cookie: .AspNetCore.Correlation.OpenIdConnect.njpwnuOhyXgnuPTpHRLeoqB5VQizR9sBstbpHH1siGI=N; expires=Tue, 20 Feb 2018 16:04:02 GMT; path=/signin-oidc; httponly

And then the ones sent to the ClickOnce application:
Set-Cookie: .AspNetCore.OpenIdConnect.Nonce.CfDJ8DuLivGqBmBIhlg8v1hx8hlbU81DRN2Mv3WVlAN1Jtppk6oTfVekJX-3NHQCZYIrKrRMs-jN6QjX0CEyzuU-ITgZbV1v-QdaXNsiFPtISGJRQz46UolBB37sEW5iE9ZYULv6A8i__LzABeEqWgS_0GBzLmPnmQf6VbdbvYSgj4KzCOxxOCDgNsc2FzvPCvXPYfqSQxqP9jR4ZFXXUirH71aXviqV2N5CmhJ6Nrnc-HkG_qKq0xfpjZAAKvqTF30uky19YJ1lQb14QaFuo0D36NI=N; expires=Tue, 20 Feb 2018 16:37:03 GMT; path=/signin-oidc; httponly
Set-Cookie: .AspNetCore.Correlation.OpenIdConnect.NSHyU3cdAgXTmx62gb34ZoojeFBintc8gKxp__DLDtc=N; expires=Tue, 20 Feb 2018 16:37:03 GMT; path=/signin-oidc; httponly

@Tratcher

This is a client bug. https://github.com/dotnet/corefx/blob/ac58f7e99e7745ba9ab85fe7b47c348260b6ef26/src/System.Net.Http/src/uap/System/Net/cookie.cs#L574
The client requires the cookie path to be less specific than the current request (e.g. request is /foo/bar and cookie can be /foo) but we are setting a path that's more specific (e.g. request is / and we set /signin-oidc). There's no provision for this behavior in the spec (https://tools.ietf.org/html/rfc6265.html#section-5.2.4) and browsers handle it fine.
I did find one difference between net461 and netcoreapp2. For net461 if you have one cookie rejected due to the path then you still get the other cookie. With netcoreapp2 if you have any cookies rejected then they are all rejected.
I'll redirect this to the corefx team.
Repro code:
using System;
using System.IO;
using System.Net;
using System.Net.Http;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var listener = new HttpListener();
            listener.Prefixes.Add("http://localhost:12345/");
            listener.Start();
            var requestTask = listener.GetContextAsync();

            var handler = new HttpClientHandler();
            handler.CookieContainer = new CookieContainer();
            var container = handler.CookieContainer;
            handler.UseCookies = true;
            var client = new HttpClient(handler);
            var responseTask = client.GetAsync("http://localhost.fiddler:12345/"); // Breaks
            // var responseTask = client.GetAsync("http://localhost.fiddler:12345/path"); // Works

            var request = requestTask.Result;
            request.Response.SetCookie(new Cookie("name0", "value0"));
            request.Response.SetCookie(new Cookie("name1", "value1", "/path"));
            request.Response.Close();

            var response = responseTask.Result;
            Console.WriteLine(response);

            Console.WriteLine("Cookies: " + container.Count);

            requestTask = listener.GetContextAsync();

            responseTask = client.GetAsync("http://localhost.fiddler:12345/path");

            request = requestTask.Result;
            using (var writer = new StreamWriter(request.Response.OutputStream))
            {
                foreach (var cookie in request.Request.Cookies)
                {
                    var c = (Cookie)cookie;
                    writer.Write($"{c.Name}={c.Value},");
                }
            }
            request.Response.Close(); // 200

            response = responseTask.Result;
            Console.WriteLine(response);
            Console.WriteLine(response.Content.ReadAsStringAsync().Result);
        }
    }
}

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
    <Reference Include="System.Net.Http" />
  </ItemGroup>
</Project>

On a different note, the OIDC protocol is not designed for programmatic usage like this. You'd be better off using a bearer token model.

This issue was moved to dotnet/corefx#27520

authors: Eilon Tratcher danroth27 dgweldon


text:
Could not load file or assembly Microsoft.Framework.Runtime.IAssemblyLoaderEngine

Hi,
using the beta3 I've this issue on a web project:
klr Information: 0 : [LoaderContainer]: Load name=Microsoft.Framework.Runtime.IAssemblyLoaderEngine
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Framework.Runtime.IAssemblyLoaderEngine, Ver
sion=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specifie
d.
File name: 'Microsoft.Framework.Runtime.IAssemblyLoaderEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
   at Microsoft.VisualStudio.Web.BrowserLink.Loader.RegisteredBrowserLinkModule.LoadRuntimeAssembly(IApplicationBuilder
app, Assembly& runtimeAssembly)
   at Microsoft.VisualStudio.Web.BrowserLink.Loader.RegisteredBrowserLinkModule.GetExtensionType(IApplicationBuilder app
, Type& extensionType)
   at Microsoft.VisualStudio.Web.BrowserLink.Loader.RegisteredBrowserLinkModule.GetExtensionMethod(IApplicationBuilder a
pp, String methodName, Type[] parameterTypes, MethodInfo& method)
   at Microsoft.VisualStudio.Web.BrowserLink.Loader.RegisteredBrowserLinkModule.InvokeUseBrowserLink(IApplicationBuilder
 app)
   at Microsoft.AspNet.Builder.BrowserLinkLoaderExtensions.UseBrowserLink(IApplicationBuilder app)
   at ChatLe.Startup.ConfigureErrors(IApplicationBuilder app) in C:\Users\Olivier\Source\Repos\chatle\src\chatle\Startup
.cs:line 159
   at ChatLe.Startup.Configure(IApplicationBuilder app) in C:\Users\Olivier\Source\Repos\chatle\src\chatle\Startup.cs:li
ne 138

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Framework.Runtime.IAssemblyLoaderEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=n
ull
 (Fully-specified)
LOG: Appbase = file:///C:/Users/Olivier/Source/Repos/chatle/src/chatle
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: C:\Users\Olivier\.k\runtimes\kre-clr-win-x86.1.0.0-beta3\bin\kre.clr.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/Olivier/Source/Repos/chatle/src/chatle/Microsoft.Framework.Runtime.
IAssemblyLoaderEngine.DLL.
LOG: Attempting download of new URL file:///C:/Users/Olivier/Source/Repos/chatle/src/chatle/Microsoft.Framework.Runtime.
IAssemblyLoaderEngine/Microsoft.Framework.Runtime.IAssemblyLoaderEngine.DLL.
LOG: Attempting download of new URL file:///C:/Users/Olivier/Source/Repos/chatle/src/chatle/Microsoft.Framework.Runtime.
IAssemblyLoaderEngine.EXE.
LOG: Attempting download of new URL file:///C:/Users/Olivier/Source/Repos/chatle/src/chatle/Microsoft.Framework.Runtime.
IAssemblyLoaderEngine/Microsoft.Framework.Runtime.IAssemblyLoaderEngine.EXE.

C:\Users\Olivier\Source\Repos\chatle\src\chatle>kvm list

Active Version           Runtime Architecture Location                     Alias
------ -------           ------- ------------ --------                     -----
       1.0.0-beta3       clr     x64          C:\Users\Olivier\.k\runtimes
  *    1.0.0-beta3       clr     x86          C:\Users\Olivier\.k\runtimes default
       1.0.0-beta3       coreclr x64          C:\Users\Olivier\.k\runtimes
       1.0.0-beta3       coreclr x86          C:\Users\Olivier\.k\runtimes
       1.0.0-beta3-11030 clr     x86          C:\Users\Olivier\.k\runtimes
       1.0.0-beta3-11030 coreclr x86          C:\Users\Olivier\.k\runtimes

the project is on [github] (https://github.com/aguacongas/chatle)

IAssemblyLoaderEngine is gone. Use IAssemblyLoadContextAccesor and IAssemblyLoadContext instead:
https://github.com/aspnet/DNX/blob/1.0.0-beta3/src/Microsoft.Framework.Runtime.Interfaces/IAssemblyLoadContextAccessor.cs
https://github.com/aspnet/DNX/blob/1.0.0-beta3/src/Microsoft.Framework.Runtime.Interfaces/IAssemblyLoadContext.cs

Ok, it was the dependency to "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta1"] I upgrade it to beta3 and it works, thx @davidfowl

authors: aguacongas davidfowl


text:
TestServer w/ WebHostBuilder doesn't read appsettings.json on ASP.NET Core 2.0, but it worked on 1.1

From @neooleg on August 30, 2017 19:59
STR

Use .NET 2.0
Follow official manual to create integration tests
Use the following code for test server

_server = new TestServer(new WebHostBuilder()
    .UseEnvironment("Development")
    .UseContentRoot(projectDir)
    .UseStartup<TestStartup>());

h3. AR

appsettings.json doesn't read and TestStartup doesn't receive them.
It looks like breaking changes (not found anything documented it) because the same code worked on ASP.NET Core 1.1

h3. ER
appsettings.json should be read and passed into Startup.
Copied from original issue: aspnet/KestrelHttpServer#2042

@neooleg WebHostBuilder and TestServer do not read appsettings.json in any scenarios. CreateDefaultBuilder is the only component that includes appsettins.json by default:
https://github.com/aspnet/MetaPackages/blob/dev/src/Microsoft.AspNetCore/WebHost.cs#L148

@Tratcher I see, thanks!
What is idiomatic way to read appsettings.json in tests except doing it explicit (which is might be good depending on case):
_server = new TestServer(new WebHostBuilder()
    .UseEnvironment("Development")
    .UseContentRoot(projectDir)
    .UseConfiguration(new ConfigurationBuilder()
        .SetBasePath(projectDir)
        .AddJsonFile("appsettings.json")
        .Build()
    )
    .UseStartup<TestStartup>());

It needs to be explicit in all apps and tests unless you call CreateDefaultBuilder.

Note there is a ConfigureAppConfgiuration method that is a little easier than UseConfiguration.

Do you recommend to use CreateDefaultBuilder() in tests as well?

It depends on what you're testing. If you're trying to mimic a full application then it may make sense.

Thanks a lot, @Tratcher!
P.S. The issue might be closed from my point of view.

authors: Tratcher natemcmaster neooleg

repo: aspnet/Hosting


text:
Useless string copy

https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.Net.Http.Headers/CookieHeaderValue.cs#L153
The cookie value is copied (via Substring) although it is already available inside value. It was put there by GetCookieValueLength, which does its own Substring as well.
The only difference, hinted by the comment at L152, is that if the returned length is 0, GetCookieValueLength puts null inside value, and the code referenced above puts the empty string.
This difference could be accounted for more efficiently by either modifying GetCookieValueLength to return an empty string instead of null, or simply using result._value = value ?? "".
This is not much, but it means copying each cookie value twice, which can put a little unnecessary pressure if the cookies are large (e.g. ASP.NET's own auth. cookies) or many.

Putting this in backlog, @jods4 if you want to send a PR with some metrics that demonstrate the perf improvements we would likely accept it. :)

@glennc Nah, I won't bother writing a benchmark for that. As I said I don't think it's much (well... maybe if you do 1M req/s it starts to add up :wink:).
I noticed while browsing the code trying to figure out another issue I had, so I figured I could tell you about it.

Handled by https://github.com/aspnet/HttpAbstractions/pull/844

authors: Tratcher glennc jods4

repo: aspnet/HttpAbstractions


text:
Separated Authentication functionalities from persistent functionalities.

Separated Authentication functionalities from persistent(IMO, Data.Abestractions is a good name) functionalities is a nice to have. And of course having two Nuget packages.
For example sometime we just need to store and retrieve user data and authentication done by identity server (e.g IdentityServer3).

This already is factored today, Security/HttpAbstractions handles the low level AuthZ decisions/ClaimsPrincipal.  Identity layers on top of that the concept of users, and 'sign in' via password social etc.  You can replace parts of identity or replace it entirely with your own authentication mechanism if desired

I think he might mean separate the AspId3 manager and store APIs from the SignIn manager. Right now the whole thing has a dependency on HttpAbstractions, whereas the core identity management (user management APIs) could be separate and a separate package that assumes the ASP.NET pipeline and cookie MW.

authors: HaoK brockallen mikeandersun

repo: aspnet/Identity