text:
Fix error installing php 7.2.34 on mac os 11.3

> asdf install php 7.2.34
Determining configuration options...
Downloading source code...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   123  100   123    0     0    262      0 --:--:-- --:--:-- --:--:--   262
100 16.9M    0 16.9M    0     0  1799k      0 --:--:--  0:00:09 --:--:-- 2340k
Extracting source code...
Running buildconfig...
Forcing buildconf
Removing configure caches
Running ./configure --with-gmp=/usr/local/opt/gmp --with-sodium=/usr/local/opt/libsodium --with-freetype-dir=/usr/local/opt/freetype --with-gettext=/usr/local/opt/gettext --with-icu-dir=/usr/local/opt/icu4c --with-jpeg-dir=/usr/local/opt/jpeg --with-webp-dir=/usr/local/opt/webp --with-png-dir=/usr/local/opt/libpng --with-openssl=/usr/local/opt/openssl@1.1 --with-libxml-dir=/usr/local/opt/libxml2 --with-readline=/usr/local/opt/readline --prefix=/Users/Dylan/.asdf/installs/php/7.2.34     --enable-bcmath     --enable-calendar     --enable-dba     --enable-exif     --enable-fpm     --enable-ftp     --enable-gd     --enable-gd-native-ttf     --enable-intl     --enable-mbregex     --enable-mbstring     --enable-mysqlnd     --enable-pcntl     --enable-shmop     --enable-soap     --enable-sockets     --enable-sysvmsg     --enable-sysvsem     --enable-sysvshm     --enable-wddx     --enable-zip     --sysconfdir=/Users/Dylan/.asdf/installs/php/7.2.34     --with-config-file-path=/Users/Dylan/.asdf/installs/php/7.2.34     --with-config-file-scan-dir=/Users/Dylan/.asdf/installs/php/7.2.34/conf.d     --with-curl     --with-external-gd     --with-fpm-group=www-data     --with-fpm-user=www-data     --with-gd     --with-mhash     --with-mysql=mysqlnd     --with-mysqli=mysqlnd     --with-pdo-mysql=mysqlnd     --with-xmlrpc     --with-zip     --with-zlib     --without-snmp --with-pear --with-pdo-pgsql
configure: WARNING: unrecognized options: --enable-gd, --enable-gd-native-ttf, --with-external-gd, --with-mysql, --with-zip
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-apple-darwin20.4.0
checking host system type... x86_64-apple-darwin20.4.0
checking target system type... x86_64-apple-darwin20.4.0
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking how to run the C preprocessor... cc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether ln -s works... yes
checking for system library directory... lib
checking whether to enable runpaths... yes
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for bison... bison -y
checking for bison version... invalid
configure: WARNING: This bison version is not supported for regeneration of the Zend/PHP parsers (found: 2.3, min: 204, excluded: ).
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
configure: error: bison is required to build PHP/Zend when building a GIT checkout!

and other errors...
but I do encounter other errors
/bin/sh /var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/libtool --silent --preserve-dup-deps --mode=compile cc -I/usr/local/Cellar/icu4c/69.1/include  -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/intl/ -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/intl/ -DPHP_ATOM_INC -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/main -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33 -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/date/lib -I/usr/local/Cellar/libxml2/2.9.10_2/include/libxml2 -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/zlib/include -I/usr/local/opt/webp/include -I/usr/local/opt/jpeg/include -I/usr/local/opt/libpng/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/opt/gettext/include -I/usr/local/opt/gmp/include -I/usr/local/opt/libiconv/include -I/usr/local/Cellar/icu4c/69.1/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/mbstring/oniguruma -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/mbstring/libmbfl -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/mbstring/libmbfl/mbfl -I/usr/local/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/sqlite3/libsqlite -I/usr/local/opt/readline/include -I/usr/local/opt/libsodium/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/zip/lib -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/TSRM -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/Zend  -no-cpp-precomp  -I/usr/local/opt/libiconv/include -g -O2 -fvisibility=hidden -DZEND_SIGNALS   -c /var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/intl/collator/collator_class.c -o ext/intl/collator/collator_class.lo
/bin/sh /var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/libtool --silent --preserve-dup-deps --mode=compile cc -I/usr/local/Cellar/icu4c/69.1/include  -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/intl/ -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/intl/ -DPHP_ATOM_INC -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/main -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33 -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/date/lib -I/usr/local/Cellar/libxml2/2.9.10_2/include/libxml2 -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/zlib/include -I/usr/local/opt/webp/include -I/usr/local/opt/jpeg/include -I/usr/local/opt/libpng/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/opt/gettext/include -I/usr/local/opt/gmp/include -I/usr/local/opt/libiconv/include -I/usr/local/Cellar/icu4c/69.1/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/mbstring/oniguruma -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/mbstring/libmbfl -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/mbstring/libmbfl/mbfl -I/usr/local/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/sqlite3/libsqlite -I/usr/local/opt/readline/include -I/usr/local/opt/libsodium/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/zip/lib -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/TSRM -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/Zend  -no-cpp-precomp  -I/usr/local/opt/libiconv/include -g -O2 -fvisibility=hidden -DZEND_SIGNALS   -c /var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/intl/collator/collator_sort.c -o ext/intl/collator/collator_sort.lo
/bin/sh /var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/libtool --silent --preserve-dup-deps --mode=compile cc -I/usr/local/Cellar/icu4c/69.1/include  -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/intl/ -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/intl/ -DPHP_ATOM_INC -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/main -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33 -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/date/lib -I/usr/local/Cellar/libxml2/2.9.10_2/include/libxml2 -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/zlib/include -I/usr/local/opt/webp/include -I/usr/local/opt/jpeg/include -I/usr/local/opt/libpng/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/opt/gettext/include -I/usr/local/opt/gmp/include -I/usr/local/opt/libiconv/include -I/usr/local/Cellar/icu4c/69.1/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/mbstring/oniguruma -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/mbstring/libmbfl -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/mbstring/libmbfl/mbfl -I/usr/local/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/sqlite3/libsqlite -I/usr/local/opt/readline/include -I/usr/local/opt/libsodium/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/zip/lib -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/TSRM -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/Zend  -no-cpp-precomp  -I/usr/local/opt/libiconv/include -g -O2 -fvisibility=hidden -DZEND_SIGNALS   -c /var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/intl/collator/collator_convert.c -o ext/intl/collator/collator_convert.lo
/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/intl/collator/collator_sort.c:349:26: error: use of undeclared identifier 'TRUE'
        collator_sort_internal( TRUE, INTERNAL_FUNCTION_PARAM_PASSTHRU );
                                ^
/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.33/ext/intl/collator/collator_sort.c:543:26: error: use of undeclared identifier 'FALSE'
        collator_sort_internal( FALSE, INTERNAL_FUNCTION_PARAM_PASSTHRU );
                                ^
2 errors generated.
make: *** [ext/intl/collator/collator_sort.lo] Error 1
make: *** Waiting for unfinished jobs....

This issue has more information https://github.com/asdf-community/asdf-php/issues/61

Not sure why this is closed. I just came across the same problem. There is no fix mentioned.
Other places where the same bug is encountered.
https://github.com/henkrehorst/homebrew-php/issues/134
Apparently related to this bug
https://bugs.php.net/bug.php?id=80310

this is a dupe of #61 so please put any info here

Since that issue is closed and is really about a lack of documentation rather than the actual impossibility of installing php 7.2, I've created a new issue #142

authors: daamsie dylan-chong

repo: asdf-community/asdf-php


text:
Update readme file

📚 Documentation
bla bla bla
Add relevant screenshot or video (if any)
No response
Additional context
No response

Can you assign me this issue?

Ok @tokyo3001 assigned

source: gharchive/issue

authors: ashavijit tokyo3001 wasimreja

repo: ashavijit/Meetify

license: MIT

license_type: permissive

license_source: github-api


text:
🛑 Home Assistant is down

In 8e92223, Home Assistant (https://ha.ashhhleyyy.dev/) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Home Assistant is back up in db464b5.

repo: ashhhleyyy/status-page


text:
npm run dev fails

Running npm run dev (npm=6.14.16) produces the following:
ERROR in ./src/client/create/scss/create.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/client/create/scss/create.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Node Sass version 7.0.0 is incompatible with ^4.0.0.
    at getSassImplementation (/home/.../repos/magic-maze/node_modules/sass-loader/dist/getSassImplementation.js:46:13)
    at Object.loader (/home/.../repos/magic-maze/node_modules/sass-loader/dist/index.js:40:61)
 @ ./src/client/create/scss/create.scss 2:12-147 9:17-24 13:15-29

ERROR in ./src/client/home/scss/home.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/client/home/scss/home.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Node Sass version 7.0.0 is incompatible with ^4.0.0.
    at getSassImplementation (/home/.../repos/magic-maze/node_modules/sass-loader/dist/getSassImplementation.js:46:13)
    at Object.loader (/home/.../repos/magic-maze/node_modules/sass-loader/dist/index.js:40:61)
 @ ./src/client/home/scss/home.scss 2:12-145 9:17-24 13:15-29

ERROR in ./src/client/play/scss/play.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/client/play/scss/play.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Node Sass version 7.0.0 is incompatible with ^4.0.0.
    at getSassImplementation (/home/.../repos/magic-maze/node_modules/sass-loader/dist/getSassImplementation.js:46:13)
    at Object.loader (/home/.../repos/magic-maze/node_modules/sass-loader/dist/index.js:40:61)
 @ ./src/client/play/scss/play.scss 2:12-145 9:17-24 13:15-29

Hi @pepe-bawagan. Thank you for reporting this, but I'm not maintaining this project anymore. Sorry!

alright, no worries. thanks! for transparency i got it to work using node@12.22.12 and npm@7.24.2 :)

authors: ashugeo pepe-bawagan

repo: ashugeo/magic-maze


text:
Wrapper for ccxt exchanges

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature

What is the new behavior (if this is a feature change)?
Added ccxt wrapper that add all exchanges supported by ccxt (https://github.com/ccxt/ccxt)

Other information:
I've not been able to add the wrapper without modifying some core files but I kept the number of changes as low as possible.

As discussed in #1171 , ccxt is working in a different way. This a wrapper to make it work wit Gekko.

Finally :+1: I've been looking for a bot that can use ccxt for so long

Well this worked fine for me :) Just having some issues replicating the fork on my VPS. Something with deasync but it works fine locally.

@Yoyae this looks really interesting
maybe would be useful some doc to explain how to config it and make it working

Follow Gekko docs. I just added ccxt exchanges as if it is an additionnal exchange. Configuration and uses isn't changing from another (non ccxt) exchange.

@Yoyae This is awesome! One thing I am noticing Specifically for Binance is constantly throwing the "Insufficient funds" error. This seems to be because of the Rounding of assets and currencies. I am not sure about the best way to go about fixing it though I understand within ccxt's exchange.js you can calculate the lot size and price precision using the following;
`    priceToPrecision (symbol, price) {
return parseFloat (price).toFixed (this.markets[symbol].precision.price)
}
amountToPrecision (symbol, amount) {
    return this.truncate(amount, this.markets[symbol].precision.amount)
}

amountToLots (symbol, amount) {
    return this.amountToPrecision (symbol, Math.floor (amount / this.markets[symbol].lot) * this.markets[symbol].lot)
}`

I would implement it but unfortunately I have the JS skills of a 5 year old.

@mattS00 The issue with Binance rounding should be fixed in the develop branch. If that is not the case, please open a new issue and ping me so we don't hijack the PR :)

@mattS00 I've add rounding on amount before sending the order (buying or selling), if the precision exists.
Note that for Binance, ccxt was already doing some rounding using amountToPrecision. In this case, it should work with amountToLots as discussed in https://github.com/ccxt/ccxt/issues/663.

@yoyae awesome! @cmroche I will check it out didn't even notice it was added as a normal exchange as well :O.

@yoyae When I started the bot in gave me an error after updating:
Error buy TypeError: Cannot read property 'lot' of undefined
at /root/gekko/exchanges/ccxt.js:153:38
at Trader.buy (/root/gekko/exchanges/ccxt.js:180:6)
at Trader.bound [as buy] (/root/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Timeout._onTimeout (/root/gekko/exchanges/ccxt.js:69:25)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)

@mattS00  I fixed the coding issue but that doesn't solve "Insufficient funds" error.
It's coming from somewhere else. I'll look into it.
From my understanding, there is a price or amount issue. Here's an example :
2017-12-11 16:22:21 (INFO):		 USDT: 42.977811000000
2017-12-11 16:22:21 (INFO):		 BTC: x
2017-12-11 16:22:21 (INFO):
2017-12-11 16:22:21 (INFO):	Trader Received advice to go long. Buying  BTC
2017-12-11 16:22:23 (INFO):	Attempting to BUY 0.0026577023493850735 BTC at Ccxt price: 16188.92
2017-12-11 16:22:23 (ERROR):	Error buy { Error: binance POST https://api.binance.com/api/v3/order 400 Bad Request {"code":-2010,"msg":"Account has insufficient balance for requested action."}.....
The issue came from BUY 0.0026577023493850735 BTC x price: 16188.92 = 43.0253307 USDT (too much). So either the price or the amount is not calculate/fetch in the correct way.

@Yoyae My understanding it we also have to set the PriceToPrecision playing around with it, seems to work if I place parseFloat (price).toFixed (4); for ADX for example.
priceToPrecision (symbol, price) {
return parseFloat (price).toFixed (this.markets[symbol].precision.price)
}

@Yoyae I have been playing around with it and the following seems to fix the insufficient fund issues Obviously we need to do the same for buy.
Trader.prototype.sell = function(amount, price, callback) {
  var args = _.toArray(arguments);

  var retFlag = false;
  (async () => {
    try{
       var roundAmount = 0;
	   var priceAmount = 0;
       try{
         var lot = this.ccxt.markets[this.pair]['lot'];
       }catch(e){
         var lot = undefined;
       }
       try{
         var precision = this.ccxt.markets[this.pair]['precision']['amount'];
       }catch(e){
         var precision = undefined;
       }
       if(!_.isUndefined(lot)){
          roundAmount = this.ccxt.amountToLots(this.pair, amount);
		  priceAmount = priceToPrecision(this.pair, price);
       }else if (!_.isUndefined(precision)){
          roundAmount = this.ccxt.amountToPrecision(this.pair, amount);
		  priceAmount = priceToPrecision(this.pair, price);
       }else{
          roundAmount = amount;
		  priceAmount = price;
       }

       data = await this.ccxt.createLimitSellOrder (this.pair, roundAmount, priceAmount);

       callback(null, data['id']);
    }catch(e){
       log.error(e);
       retFlag = true;
       return this.retry(this.sell, args);
    }
    retFlag = true;
  }) ();
  deasync.loopWhile(function(){return !retFlag;});
}

@mattS00 Thanks for your testing. I've made the change and it works well.

@Yoyae@mattS00 Please con you share the tested working code, I can try it here. Thanks.

@Shootle I usually use a test strategy like this
//====================================================================
// Initialization
//====================================================================

// Prepare everything our method needs
strat.init = function() {
   log.debug("init");
   this.test = 0;
}

//====================================================================
// Handle Routine
//====================================================================
strat.update = function(candle) {
   if(this.test == 0){
      this.advice('long');
      this.test = 1;
   }
}

It buy one time the selected pair. (just long by short to sell).

Hmm @Yoyae after trying it with a couple of different assets QSP/BNB throws the -2010 error although it seems to be something to do with the Amount not the price the max amount should in fact be 700 not 727.98 gonna look into it now.
2017-12-14 11:32:43 (DEBUG):	Reel price and amount are :  727.98 QSP at 0.03475 BNB
2017-12-14 11:32:44 (ERROR):	Error buy { Error: binance POST https://api.binance.com/api/v3/order 400 Bad Request {"code":-2010,"msg":"Account has insufficient balance for requested action."} (possible reasons: invalid API keys, bad or old nonce, exchange is down or offline, on maintenance, DDoS protection, rate-limiting)
    at binance.defaultErrorHandler (/root/gekko/node_modules/ccxt/js/base/Exchange.js:410:15)
    at response.text.then.text (/root/gekko/node_modules/ccxt/js/base/Exchange.js:423:25)
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)
    at Function.module.exports.loopWhile (/root/gekko/node_modules/deasync/index.js:71:11)
    at Trader.buy (/root/gekko/exchanges/ccxt.js:189:11)
    at Trader.bound [as buy] (/root/gekko/node_modules/lodash/dist/lodash.js:729:21)
    at Manager.buy (/root/gekko/plugins/trader/portfolioManager.js:216:17)
    at Manager.bound [as buy] (/root/gekko/node_modules/lodash/dist/lodash.js:729:21)
    at Manager.act (/root/gekko/plugins/trader/portfolioManager.js:162:16)
    at bound (/root/gekko/node_modules/lodash/dist/lodash.js:729:21) constructor: [Function: ExchangeNotAvailable] }

@mattS00 Thanks for looking at it. I will add some trace to know what price and amount is taken and when/why. I don't have time these day to look deeply into it :/

@mattS00 It seems the ask/bid price was not inverted as I previously thought. I fix it. It should be good now.

@yoyae Trading is working although after buying the following happens
2017-12-19 10:22:17 (ERROR):	TypeError: Cannot read property 'balance' of undefined
at PerformanceAnalyzer.calculateReportStatistics (/root/gekko/plugins/performanceAnalyzer/performanceAnalyzer.js:134:37)
at PerformanceAnalyzer.bound [as calculateReportStatistics] (/root/gekko/node_modules/lodash/dist/lodash.js:729:21)
at PerformanceAnalyzer.processTrade (/root/gekko/plugins/performanceAnalyzer/performanceAnalyzer.js:69:23)
at Trader.bound (/root/gekko/node_modules/lodash/dist/lodash.js:729:21)
at emitOne (events.js:115:13)
at Trader.emit (events.js:210:7)
at Trader.bound [as emit] (/root/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Manager.Trader.manager.on.trade (/root/gekko/plugins/trader/trader.js:24:10)
at emitOne (events.js:115:13)
at Manager.emit (events.js:210:7)

@mattS00 I fixed the error.
@WilhelmErasmus I change a lot of things, It doesn't work based on deasync lib anymore. It may solve your issue on VPS.

@askmike Any idea when this will be merged?

source: gharchive/pull-request

authors: Filoz Shootle WilhelmErasmus Yoyae cmroche mattS00

repo: askmike/gekko


text:
bugfix #2568 transforms commonjs modules to ES2015

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bugfix #2568

What is the current behavior? (You can also link to an open issue here)
see #2568

What is the new behavior (if this is a feature change)?
commonjs modules get transpiled with babel.

Other information:

This works great! Thanks a lot. I will update my stackoverflow question with your answer.

authors: askmike eusorov


text:
🛑 Quiver Site is down

In 105f1a2, Quiver Site (https://www.quivertheapp.com/) was down:

HTTP code: 403
Response time: 10 ms

Resolved: Quiver Site is back up in 35c84ed.

repo: asmur/quiver


text:
Enable Component parameter delegates to not require @() for coloring at design time.

The core issue is that the Razor parser splits attribute values based on whitespace. Therefore, when it encounters @onclick="() => Foo()" it breaks it into three different tokens based on the spaces involved. This separation results in multiple adjacent classified spans for C# which is currently unsupported by WTE due to multiple seams overlapping. All that being said we have the opportunity to be smarter when generating attribute values that we feel can be simplified or collapsed; because of this in this PR I changed the TagHelperBlockRewriter phase to understand "simple" collapsible blocks and to then collapse them. In the future a goal would be to take a collapsing approach to all potential attributes and then to re-inspect each token individually at higher layers in order to decouple our TagHelper phases from what the parser initially parses.
Added an integration and parser test to validate the new functionality. Most of the testing is from the fact that no other tests had to change because of this (it doesn't break anything).
Added a new SyntaxNode method GetTokens that flattens a node into only its token representation.

aspnet/AspNetCore#11826

@aspnet/build it looks like the CI has completed but the reporting from azure devops to GitHub is broken? Is this a known issue?

Is this a known issue?

I haven't heard anything. But, transient problems like this do happen occasionally. @MattGal?

BTW, you can still push this commit @NTaylorMullen

@dougbu this is a communication burp between Azure DevOps and Github, and are usually fairly rare (like < once / day).  Given both pieces have their own concept of throttling / tarpitting, it may be related to this;  If we can gather enough instances we may be able to get AzDO to investigate, until then I suggest just restarting checks unnecessarily or merging after checking in AzDO.

authors: MattGal NTaylorMullen dougbu

repo: aspnet/AspNetCore-Tooling


text:
DI in Startup constructor will throw exception in .NET Core 3.0 preview 7

public Startup(IConfiguration configuration, ILogger<Startup> logger)

This code no longer works. Same issue as https://github.com/aspnet/Extensions/issues/1096
Per Andrew Stanton-Nurse's comment under that issue. https://github.com/aspnet/Extensions/issues/1096#issuecomment-489378332
This document needs update.

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

ID: 7184a308-a254-9350-a5cd-5bced1f369ae
Version Independent ID: 726e3bf1-f367-d733-8933-bccc04da0e16
Content: Logging in ASP.NET Core
Content Source: aspnetcore/fundamentals/logging/index.md
Product: aspnet-core
Technology: aspnetcore-fundamentals
GitHub Login: @tdykstra
Microsoft Alias: tdykstra

Hello @EdiWang ... This is a duplicate of our issue to work the whole topic for 3.0. I'll move your remark to that issue.

authors: EdiWang guardrex


text:
Wrong Controller

In the HTML, you have set the tag:
asp-controller="Movies"
but no controller with that name has been created yet.

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

ID: 788d46c9-a91a-2788-8db7-b53c37b512f2
Version Independent ID: 00c2c01d-d235-2d2d-5c96-1f33a9314382
Content: Add a view to an ASP.NET Core MVC app
Content Source: aspnetcore/tutorials/first-mvc-app/adding-view.md
Product: aspnet-core
Technology: aspnetcore-tutorials
GitHub Login: @Rick-Anderson
Microsoft Alias: riande

Sorry, I didn't see the line:
Note: The Movies controller has not been implemented. At this point, the Movie app link does not work.


text:
Format pipeline code

See https://github.com/dotnet/samples/issues/1630

Merged


text:
When exception occurs during Startup.Configure propagate to webhost

Is your feature request related to a problem? Please describe.
In  Configure(IApplicationBuilder app, IHostingEnvironment env)  I am registering a method using app.ApplicationServices instance. This method throws an exception when i can't make a socket connection (in my case i tried to connect to AMQP client).
I noticed if I move the registration inside ConfigureServices(IServiceCollection services) the exception bubbles up to my webhost. To be able to to this inside ConfigureServices I had to get an instance of serviceProvider by using  services.BuildServiceProvider() (which I am not sure if it's a good idea).
Describe the solution you'd like
I was wondering if it is possible to propagate exceptions that occur during Configure stage to webhost.

@Tratcher This option doesn't help with the scenario mentioned by me.
If you throw an exception inside public void Configure(IApplicationBuilder app, IHostingEnvironment env) this will not stop the webHost starting (regardless of the setting you mentioned above). And this is what I want to achieve with this feature request.
I can have a look where in the pipeline Configure method is called and see how hard is to make the exception (when occurs, of course) propagate to webHost.
But I was wondering if I am the only one seeing value in this feature request?

Where are you running the app? In IIS (in proc or out of proc)? Or in a console app using Kestrel directly?
Here's a simple repro showing an exception from Configure propagating to Main when using Kestrel in a console app. This is the default behavior, no configuration is required.
        public void Configure(IApplicationBuilder app)
        {
            app.Run((httpContext) =>
            {
                var payload = _helloWorldBytes;
                var response = httpContext.Response;

                response.StatusCode = 200;
                response.ContentType = "text/plain";
                response.ContentLength = payload.Length;

                return response.BodyWriter.WriteAsync(payload).GetAsTask();
            });

            throw new System.Exception("Startup Exception");
        }

Application startup exception: System.Exception: Startup Exception
   at PlaintextApp.Startup.Configure(IApplicationBuilder app) in D:\github\AspNetCore\src\Servers\Kestrel\samples\PlaintextApp\Startup.cs:line 34
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.MethodInfoExtensions.InvokeWithoutWrappingExceptions(MethodInfo methodInfo, Object obj, Object[] parameters) in D:\github\AspNetCore\src\Hosting\hosting\src\Internal\MethodInfoExtensions.cs:line 17
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder) in D:\github\AspNetCore\src\Hosting\hosting\src\Internal\ConfigureBuilder.cs:line 56
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder) in D:\github\AspNetCore\src\Hosting\hosting\src\Internal\ConfigureBuilder.cs:line 20
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) in D:\github\AspNetCore\src\Hosting\hosting\src\Startup\ConventionBasedStartup.cs:line 25
   at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication() in D:\github\AspNetCore\src\Hosting\hosting\src\Internal\WebHost.cs:line 228
Unhandled exception. System.Exception: Startup Exception
   at PlaintextApp.Startup.Configure(IApplicationBuilder app) in D:\github\AspNetCore\src\Servers\Kestrel\samples\PlaintextApp\Startup.cs:line 34
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.MethodInfoExtensions.InvokeWithoutWrappingExceptions(MethodInfo methodInfo, Object obj, Object[] parameters) in D:\github\AspNetCore\src\Hosting\hosting\src\Internal\MethodInfoExtensions.cs:line 17
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder) in D:\github\AspNetCore\src\Hosting\hosting\src\Internal\ConfigureBuilder.cs:line 56
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder) in D:\github\AspNetCore\src\Hosting\hosting\src\Internal\ConfigureBuilder.cs:line 20
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) in D:\github\AspNetCore\src\Hosting\hosting\src\Startup\ConventionBasedStartup.cs:line 25
   at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication() in D:\github\AspNetCore\src\Hosting\hosting\src\Internal\WebHost.cs:line 228
   at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken) in D:\github\AspNetCore\src\Hosting\hosting\src\Internal\WebHost.cs:line 148
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage) in D:\github\AspNetCore\src\Hosting\hosting\src\WebHostExtensions.cs:line 109
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage) in D:\github\AspNetCore\src\Hosting\hosting\src\WebHostExtensions.cs:line 147
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token) in D:\github\AspNetCore\src\Hosting\hosting\src\WebHostExtensions.cs:line 94
   at PlaintextApp.Startup.Main(String[] args) in D:\github\AspNetCore\src\Servers\Kestrel\samples\PlaintextApp\Startup.cs:line 48
   at PlaintextApp.Startup.<Main>(String[] args)

D:\github\AspNetCore\artifacts\bin\PlaintextApp\Debug\netcoreapp3.0\PlaintextApp.exe (process 12656) exited with code -532462766.
Press any key to close this window . . .

IIS out-of-proc has different behavior because the console is not usually visible. It captures the errors and shows an error page. See https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/web-host?view=aspnetcore-2.2#detailed-errors
IIS in-proc is a bit different, and has changed significantly across versions. You're using 2.2, correct? @jkotalik what's in-proc's setting for CaptureStartupErrrors in 2.2?

After some digging I noticed that having (I am using Microsoft.ApplicationInsights.AspNetCore 2.7.0)
 services.AddApplicationInsightsTelemetry(); in ConfigureServices the exception is swallowed.
If I remove the applicationInsights telemetry configuration the exception bubbles up.
You can add that to your sample application, it is quite easy to reproduce.
Didn't expect that behavior.
But you are right, the feature is already there.
The problem is in combination with application insights configuration.

Closing as it sounds like the issue has been resolved and there is no action needed in ASP.NET Core.

But this is still an issue in combination with application insights - which I find very strange. Can we maybe reference this issue to application insights repository?

@jkotalik this looks like the issue you investigated that was resolved in a later AI version?

https://github.com/microsoft/ApplicationInsights-aspnetcore/issues/897

authors: Tratcher anurse arabelaa jkotalik

repo: aspnet/AspNetCore


text:
Unit testing HttpContext with HTTP2 features

Is there a simple way to create a HttpContext with HTTP2 features? I want to write some HTTP2-ish unit tests.
var context = new DefaultHttpContext();
context.Response.AppendTrailers("", "");

This throws an error because there is no IHttpResponseTrailersFeature.
Is there a simple way to make the context HTTP2-erized. If not, consider adding one.

Duplicate of #6880 ?

This issue is about using DefaultHttpContext with trailers independently.
#6880 is about using trailers inside TestHost.

Since trailers aren't as reliable a feature, I don't think we'd put this in DefaultHttpContext directly, we should look at an .EnableHttp2Goop() function of some kind to initialize default values for HTTP/2 expected features in DefaultHttpContext

We'll leave this in preview 7, but it's on the verge :). If you're passionate @JamesNK , we take PRs 🐴

authors: JamesNK anurse


text:
Build C++ Client on macOS, Windows and Linux with CMake

Epic #5301

[ ] Works on Windows, Linux, and Mac
[ ] CI integration
[ ] Optional flag/define for building tests (off by default?)
[ ] ReadMe describing how to build/consume the client

Pre-triage notes:

Not necessary for preview 5, suggest moving to a later preview.

I'd argue this is good for preview4, I already have a draft PR 95% working for this, https://github.com/aspnet/SignalR-Client-Cpp/pull/4

Triage decision: We'll leave this in preview 5 but it's fine if it slips.

Let's see about getting this done in Preview 8 (though I think it's basically done?)

Almost, there was some feedback I'd like to react to.

Done via https://github.com/aspnet/SignalR-Client-Cpp/pull/4

authors: BrennanConroy anurse


text:
SignalR high memory consumption

Hi
We're seeing some wierd behaviour in our application. We have at most 600 users online at a given time, and our memory seems to be rising constantly. Please see image below.

The drop in memory is because we restarted the pod.
We're running this in Kubernetes (linux container) with Istio and using a redis backplane.
Everything is running behind a Google Cloud Load Balancer.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BulletLeague.Datastores.Friends.Interfaces;
using BulletLeague.Datastores.PlayerInformationStore.Interfaces;
using BulletLeague.Social.Models;
using BulletLeague.Social.Services.FriendsService;
using BulletLeague.Social.SignalR.Enums;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;

namespace BulletLeague.Social.SignalR.Hubs.V1
{
    [Authorize]
    public class SocialHub : Hub<IClientOperations>
    {
        private readonly IFriendsStore friendsStore;
        private readonly IPlayerInformationStore playerInfoStore;
        private readonly IFriendsService friendsService;
        private readonly ILogger<SocialHub> logger;

        public SocialHub(
            IFriendsStore friendsStore,
            IPlayerInformationStore playerInfoStore,
            IFriendsService friendsService,
            ILogger<SocialHub> logger)
        {
            this.friendsStore = friendsStore;
            this.playerInfoStore = playerInfoStore;
            this.friendsService = friendsService;
            this.logger = logger;
        }

        public override async Task OnConnectedAsync()
        {
            try
            {
                await base.OnConnectedAsync();

                var playerInfo = await playerInfoStore.ReadAsync(Context.User.Identity.Name);
                var username = playerInfo.IsDev ? $"[Dev] {playerInfo.Username}" : playerInfo.Username;

                var player = new Player(Context.User.Identity.Name, username, Context.ConnectionId, State.Idle);
                var friends = await friendsStore.ReadAsync(Context.User.Identity.Name);

                if (friends == null)
                {
                    friends = new Datastores.Friends.Models.Friends
                    {
                        Id = Context.User.Identity.Name,
                        FriendsList = new List<Datastores.Friends.Models.Friend>(),
                        Created = DateTime.UtcNow,
                    };

                    await friendsStore.UpsertAsync(friends);
                }

                player.FriendsList = friends.FriendsList;
                await friendsService.AddOrUpdatePlayer(player);

                var friendStates = new Dictionary<string, State>();
                var shouldUpsert = false;
                foreach (var friendItem in player.FriendsList)
                {
                    switch (friendItem.State)
                    {
                        case Datastores.Friends.Enums.FriendState.Connected:
                            shouldUpsert = await HandleConnectedStatesAsync(player, friends, friendStates, shouldUpsert, friendItem);
                            break;
                        default:
                            friendStates.Add(friendItem.Id, State.Requested);
                            break;
                    }
                }

                if (shouldUpsert)
                {
                    await friendsStore.UpsertAsync(friends);
                }

                await Clients.Caller.ConnectSuccessful(player.FriendsList, friendStates);
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(OnConnectedAsync), ex);
            }
        }

        private async Task<bool> HandleConnectedStatesAsync(Player player, Datastores.Friends.Models.Friends friends, Dictionary<string, State> friendStates, bool shouldUpsert, Datastores.Friends.Models.Friend friendItem)
        {
            var friend = await friendsService.GetPlayer(friendItem.Id);
            if (friend != null)
            {
                await Clients.Client(friend.ConnectionId).FriendStateUpdated(player.Id, player.Username, player.State);

                if (friendItem.Username != friend.Username)
                {
                    var actualFriendItem = friends.FriendsList.FirstOrDefault(x => x.Id == friend.Id);
                    actualFriendItem.Username = friend.Username;
                    shouldUpsert = true;
                }

                friendItem.Username = friend.Username;
                friendStates.Add(friendItem.Id, friend.State);
            }
            else
            {
                var playerInfo = await playerInfoStore.ReadAsync(friendItem.Id);

                if (playerInfo != null && playerInfo.Username != friendItem.Username)
                {
                    var actualFriendItem = friends.FriendsList.FirstOrDefault(x => x.Id == playerInfo.Id);
                    var isDevPrefixed = playerInfo.IsDev ? "[Dev] " : string.Empty;
                    actualFriendItem.Username = $"{isDevPrefixed}{playerInfo.Username}";
                    friendItem.Username = actualFriendItem.Username;
                    shouldUpsert = true;
                }

                friendStates.Add(friendItem.Id, State.Offline);
            }

            return shouldUpsert;
        }

        // TODO: Should be removed when removing SetOnline method in game client
        public async Task SetOnline(string username)
        {
            username.IsNormalized();
            await Task.CompletedTask;
        }

        public async Task SetState(State state)
        {
            try
            {
                var player = await friendsService.GetPlayer(Context.User.Identity.Name);

                if (player == null)
                {
                    return;
                }

                player.State = state;
                await friendsService.AddOrUpdatePlayer(player);

                foreach (var friendItem in player.FriendsList.Where(x => x.State == Datastores.Friends.Enums.FriendState.Connected))
                {
                    var friend = await friendsService.GetPlayer(friendItem.Id);
                    if (friend != null)
                    {
                        await Clients.Client(friend.ConnectionId).FriendStateUpdated(player.Id, player.Username, player.State);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(SetState), ex);
            }
        }

        public async Task UpdateUsername(string username)
        {
            try
            {
                var player = await friendsService.GetPlayer(Context.User.Identity.Name);

                if (player == null)
                {
                    return;
                }

                player.Username = username;
                await friendsService.AddOrUpdatePlayer(player);

                foreach (var friendItem in player.FriendsList.Where(x => x.State == Datastores.Friends.Enums.FriendState.Connected))
                {
                    var friend = await friendsService.GetPlayer(friendItem.Id);
                    if (friend != null)
                    {
                        await Clients.Client(friend.ConnectionId).FriendStateUpdated(player.Id, player.Username, player.State);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(UpdateUsername), ex);
            }
        }

        public async Task FriendSendRequest(string username)
        {
            try
            {
                if (!username.Contains("#", StringComparison.InvariantCulture))
                {
                    await Clients.Caller.FriendRequestFailed("Username is missing #.");
                    return;
                }

                var player = await friendsService.GetPlayer(Context.User.Identity.Name);
                if (player == null)
                {
                    return;
                }

                var otherPlayerInfo = await playerInfoStore.ReadByUsernameAndUniqueIdAsync(username);

                if (otherPlayerInfo == null)
                {
                    await Clients.Caller.FriendRequestFailed("User not found.");
                    return;
                }

                if (player.FriendsList.Any(x => x.Id == otherPlayerInfo.Id))
                {
                    var befriendedPlayer = player.FriendsList.FirstOrDefault(x => x.Id == otherPlayerInfo.Id);

                    if (befriendedPlayer.State == Datastores.Friends.Enums.FriendState.Requested)
                    {
                        await FriendAcceptRequest(otherPlayerInfo.Id);
                        await Clients.Caller.FriendRequestSuccess(befriendedPlayer);
                        return;
                    }

                    await Clients.Caller.FriendRequestFailed("User already befriended.");
                    return;
                }

                var friends = await friendsStore.ReadAsync(Context.User.Identity.Name);
                var newFriend = new Datastores.Friends.Models.Friend
                {
                    Id = otherPlayerInfo.Id,
                    Username = otherPlayerInfo.Username,
                    State = Datastores.Friends.Enums.FriendState.SentRequest,
                };
                friends.FriendsList.Add(newFriend);
                player.FriendsList = friends.FriendsList;

                var friend = await friendsStore.ReadAsync(otherPlayerInfo.Id);
                if (friend == null)
                {
                    friend = new Datastores.Friends.Models.Friends
                    {
                        Id = otherPlayerInfo.Id,
                        FriendsList = new List<Datastores.Friends.Models.Friend>(),
                        Created = DateTime.UtcNow,
                    };
                }

                var newFriendRequest = new Datastores.Friends.Models.Friend
                {
                    Id = Context.User.Identity.Name,
                    Username = player.Username,
                    State = Datastores.Friends.Enums.FriendState.Requested,
                };
                friend.FriendsList.Add(newFriendRequest);

                await friendsService.AddOrUpdatePlayer(player);

                var otherPlayer = await friendsService.GetPlayer(otherPlayerInfo.Id);

                if (otherPlayer != null)
                {
                    otherPlayer.FriendsList = friend.FriendsList;
                    await friendsService.AddOrUpdatePlayer(otherPlayer);
                    await Clients.Client(otherPlayer.ConnectionId).FriendRequestReceived(newFriendRequest);
                }

                await friendsStore.UpsertAsync(friends);
                await friendsStore.UpsertAsync(friend);

                await Clients.Caller.FriendRequestSuccess(newFriend);
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(FriendAcceptRequest), ex);
            }
        }

        public async Task FriendAcceptRequest(string otherId)
        {
            try
            {
                var player = await friendsService.GetPlayer(Context.User.Identity.Name);

                if (player == null)
                {
                    return;
                }

                var otherPlayer = await friendsService.GetPlayer(otherId);

                if (otherPlayer != null)
                {
                    await Clients.Caller.FriendStateUpdated(otherPlayer.Id, otherPlayer.Username, otherPlayer.State);
                    await Clients.Client(otherPlayer.ConnectionId).FriendStateUpdated(player.Id, player.Username, player.State);
                }
                else
                {
                    var f = player.FriendsList.FirstOrDefault(x => x.Id == otherId);
                    await Clients.Caller.FriendStateUpdated(f.Id, f.Username, State.Offline);
                }

                var friends = await friendsStore.ReadAsync(Context.User.Identity.Name);

                var f1 = friends.FriendsList.FirstOrDefault(x => x.Id == otherId);
                f1.State = Datastores.Friends.Enums.FriendState.Connected;
                player.FriendsList = friends.FriendsList;
                await friendsService.AddOrUpdatePlayer(player);

                var friend = await friendsStore.ReadAsync(otherId);
                var f2 = friend.FriendsList.FirstOrDefault(x => x.Id == Context.User.Identity.Name);
                f2.State = Datastores.Friends.Enums.FriendState.Connected;

                if (otherPlayer != null)
                {
                    otherPlayer.FriendsList = friend.FriendsList;
                    await friendsService.AddOrUpdatePlayer(otherPlayer);
                }

                await friendsStore.UpsertAsync(friends);
                await friendsStore.UpsertAsync(friend);
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(FriendAcceptRequest), ex);
            }
        }

        public async Task FriendDeclineRequest(string otherId)
        {
            try
            {
                var player = await friendsService.GetPlayer(Context.User.Identity.Name);

                if (player == null)
                {
                    return;
                }

                var otherPlayer = await friendsService.GetPlayer(otherId);

                if (otherPlayer != null)
                {
                    await Clients.Client(otherPlayer.ConnectionId).FriendDeclineRequest(player.Id);
                }

                var friends = await friendsStore.ReadAsync(Context.User.Identity.Name);
                var f = friends.FriendsList.FirstOrDefault(x => x.Id == otherId);
                friends.FriendsList.Remove(f);
                player.FriendsList = friends.FriendsList;
                await friendsService.AddOrUpdatePlayer(player);

                var friend = await friendsStore.ReadAsync(otherId);
                var f2 = friend.FriendsList.FirstOrDefault(x => x.Id == Context.User.Identity.Name);
                friend.FriendsList.Remove(f2);

                if (otherPlayer != null)
                {
                    otherPlayer.FriendsList = friend.FriendsList;
                    await friendsService.AddOrUpdatePlayer(otherPlayer);
                }

                await friendsStore.UpsertAsync(friends);
                await friendsStore.UpsertAsync(friend);
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(FriendDeclineRequest), ex);
            }
        }

        public async Task FriendRemove(string otherId)
        {
            try
            {
                var player = await friendsService.GetPlayer(Context.User.Identity.Name);

                if (player == null)
                {
                    return;
                }

                var otherPlayer = await friendsService.GetPlayer(otherId);

                if (otherPlayer != null)
                {
                    await Clients.Client(otherPlayer.ConnectionId).FriendRemove(player.Id);
                }

                var friends = await friendsStore.ReadAsync(Context.User.Identity.Name);
                var f = friends.FriendsList.FirstOrDefault(x => x.Id == otherId);
                friends.FriendsList.Remove(f);
                player.FriendsList = friends.FriendsList;
                await friendsService.AddOrUpdatePlayer(player);

                var friend = await friendsStore.ReadAsync(otherId);
                var f2 = friend.FriendsList.FirstOrDefault(x => x.Id == Context.User.Identity.Name);
                friend.FriendsList.Remove(f2);

                if (otherPlayer != null)
                {
                    otherPlayer.FriendsList = friend.FriendsList;
                    await friendsService.AddOrUpdatePlayer(otherPlayer);
                }

                await friendsStore.UpsertAsync(friends);
                await friendsStore.UpsertAsync(friend);
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(FriendRemove), ex);
            }
        }

        public async Task InviteToFriendBrawl(string otherId, string gameCode)
        {
            try
            {
                var otherPlayer = await friendsService.GetPlayer(otherId);

                if (otherPlayer == null || otherPlayer.State != State.Idle)
                {
                    await Clients.Caller.FriendNotAvailableForGameInvites();
                    return;
                }

                var player = await friendsService.GetPlayer(Context.User.Identity.Name);

                await Clients.Client(otherPlayer.ConnectionId).FriendBrawlInvite(player.Id, gameCode);
                await Clients.Caller.FriendBrawlInviteSuccess();
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(InviteToFriendBrawl), ex);
            }
        }

        public async Task FriendBrawlDecline(string otherId)
        {
            try
            {
                var otherPlayer = await friendsService.GetPlayer(otherId);

                if (otherPlayer != null)
                {
                    await Clients.Client(otherPlayer.ConnectionId).FriendBrawlDeclined(Context.User.Identity.Name);
                }
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(FriendBrawlDecline), ex);
            }
        }

        public async Task InviteToDuo(string otherId, string region)
        {
            try
            {
                var otherPlayer = await friendsService.GetPlayer(otherId);

                if (otherPlayer == null || otherPlayer.State != State.Idle)
                {
                    await Clients.Caller.FriendNotAvailableForGameInvites();
                    return;
                }

                await Clients.Client(otherPlayer.ConnectionId).DuoInvite(Context.User.Identity.Name, region);
                await Clients.Caller.DuoInviteSuccess();
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(InviteToDuo), ex);
            }
        }

        public async Task DuoInviteAccept(string inviterId)
        {
            try
            {
                var playerId = Context.User.Identity.Name;

                if (string.IsNullOrWhiteSpace(playerId))
                {
                    return;
                }

                var otherPlayer = await friendsService.GetPlayer(inviterId);

                if (otherPlayer == null)
                {
                    await Clients.Caller.DuoInviteMissingInviter();
                }

                await Clients.Client(otherPlayer.ConnectionId).DuoInviteAccepted(playerId);
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(DuoInviteAccept), ex);
            }
        }

        public async Task DuoInviteDecline(string inviterId)
        {
            try
            {
                var otherPlayer = await friendsService.GetPlayer(inviterId);

                if (otherPlayer != null)
                {
                    await Clients.Client(otherPlayer.ConnectionId).DuoInviteDeclined(Context.User.Identity.Name);
                }
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(DuoInviteDecline), ex);
            }
        }

        public async Task DuoInviteCancel(string otherId)
        {
            try
            {
                var otherPlayer = await friendsService.GetPlayer(otherId);

                if (otherPlayer != null)
                {
                    await Clients.Client(otherPlayer.ConnectionId).DuoInviteCanceled(Context.User.Identity.Name);
                }
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(DuoInviteCancel), ex);
            }
        }

        public override async Task OnDisconnectedAsync(Exception exception)
        {
            try
            {
                await base.OnDisconnectedAsync(exception);

                var playerId = await friendsService.GetMapping(Context.ConnectionId);

                if (!string.IsNullOrWhiteSpace(playerId))
                {
                    var player = await friendsService.GetPlayer(playerId);

                    if (player != null)
                    {
                        foreach (var fId in player.FriendsList.Where(x => x.State == Datastores.Friends.Enums.FriendState.Connected))
                        {
                            var friend = await friendsService.GetPlayer(fId.Id);
                            if (friend != null)
                            {
                                await Clients.Client(friend.ConnectionId).FriendStateUpdated(player.Id, player.Username, State.Offline);
                            }
                        }

                        await friendsService.RemovePlayer(player.Id, Context.ConnectionId);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogError(nameof(OnDisconnectedAsync), ex);
            }
        }
    }
}

Everything is wrapped in try/catch to see if we caught anything, but we didn't.
I have a feeling connections is not being closed correctly, or GC is not cleaning up the ConcurrentDictionary that holds the connections. It also might be a code issue (I mean; it might be our own code that's faulty).
Any help appreciated.

It sounds like it would be best if you can do some initial investigation to see if it's your own objects that are leaking. If you are able to capture a memory dump showing the leaked objects, that would be helpful. Let us know if you have one (do NOT post it here, as memory dumps contain sensitive information) and we can give you an email address to send it to.

Could be the same issue as #8369, try taking a dependency on StackExchange.Redis 2.0.593 or later and see if it helps.

I've now tried setting a memory and CPU limit for the kubernetes deployment. We're now seeing a more stable memory consumption.
It seems when docker starts the container without a --memory parameter, that it just assumes it got all the resources it could ever need, and never does any proper GC (just an assumption on my part).
I might update the StackExchange.Redis if we see any issues again.

after setting a limit we've seen no issues with memory just rising. We also updated StackExchange.Redis for good measure as the issue in #8369 seems pretty nice to get rid of.
Thanks for the help!

authors: anurse marklonquist sehra


text:
Await dispose for inner stream before disposing SslStream.

Part of many issues from https://github.com/dotnet/corefx/issues/38911#issuecomment-507818823

I think I know how it can happen.

I think I know how it can happen.

Don't leave us hanging lol

authors: davidfowl halter73 jkotalik


text:
Check HubConnection state before running invoke logic

Before calling methods that require the HubConnection to be connected we run a simple connection state check like
https://github.com/aspnet/AspNetCore/blob/e310ccac7b30e901f657f81c86c4048fecfedf7b/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java#L464-L466
Addresses #4393

@mikaelm12 can you also add the shiproom template? (You can find a copy from https://github.com/aspnet/AspNetCore/pull/4403)

Approved for 2.2.2

The failure was for an IIS Functional test. An unrelated test failure.
Starting test execution, please wait...
2018-12-04T22:55:50.8997274Z   [xUnit.net 00:00:17.97]     Microsoft.AspNetCore.Server.IIS.FunctionalTests.AppOfflineTests.AppOfflineDroppedWhileSiteFailedToStartInRequestHandler_SiteStops_InProcess [SKIP]
2018-12-04T22:55:51.8627524Z   Skipped  Microsoft.AspNetCore.Server.IIS.FunctionalTests.AppOfflineTests.AppOfflineDroppedWhileSiteFailedToStartInRequestHandler_SiteStops_InProcess
2018-12-04T22:57:20.4801986Z   [xUnit.net 00:01:47.51]     Microsoft.AspNetCore.Server.IIS.FunctionalTests.AppOfflineTests.AppOfflineDroppedWhileSiteStarting_SiteShutsDown_InProcess [FAIL]
2018-12-04T22:57:20.4848481Z   Failed   Microsoft.AspNetCore.Server.IIS.FunctionalTests.AppOfflineTests.AppOfflineDroppedWhileSiteStarting_SiteShutsDown_InProcess
2018-12-04T22:57:20.4848649Z   Error Message:
2018-12-04T22:57:20.4848762Z    Assert.Equal() Failure
2018-12-04T22:57:20.4848871Z   Expected: 0
2018-12-04T22:57:20.4848956Z   Actual:   -1073740767

authors: mikaelm12 muratg vivmishra


text:
replacing string interpolation with proper logging syntax

Fixes #362.

I found some other places where it was used.
I'm not sure of the convention of the logging properties
I couldn't get the preview bits to build on my Mac or AppVeyor.
I'm not sure if the tests will pass

 Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.:x: daniel-white sign nowYou have signed the CLA already but the status is still pending? Let us recheck it.

well your CI got it passed. awesome sauce.

Thanks

authors: Tratcher daniel-white dnfclas

repo: aspnet/BasicMiddleware


text:
建议增加按前缀清理缓存的接口

public static void KeyDeleteWithPrefix(this IDatabase database, string prefix)
        {
            if (database == null)
            {
                throw new ArgumentException("Database cannot be null", "database");
            }

            if (string.IsNullOrWhiteSpace(prefix))
            {
                throw new ArgumentException("Prefix cannot be empty", "database");
            }

            database.ScriptEvaluate(@"
                local keys = redis.call('keys', ARGV[1])
                for i=1,#keys,5000 do
                redis.call('del', unpack(keys, i, math.min(i+4999, #keys)))
                end", values: new RedisValue[] {prefix});
        }

public void Clear()
        {
            Database.KeyDeleteWithPrefix(GetLocalizedKey("*"));
        }

对于列表数据，你很难用明确的key来定位删除，没有这个接口缓存是不完美的
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Threading.Tasks;

namespace Microsoft.Extensions.Caching.Distributed
{
    public interface IDistributedCache
    {
        byte[] Get(string key);

        Task<byte[]> GetAsync(string key);

        void Set(string key, byte[] value, DistributedCacheEntryOptions options);

        Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options);

        void Refresh(string key);

        Task RefreshAsync(string key);

        void Remove(string key);

        Task RemoveAsync(string key);
    }
}

或者把连接暴露出来，让开发者更自由的使用

We periodically close 'discussion' issues that have not been updated in a long period of time.
We apologize if this causes any inconvenience. We ask that if you are still encountering an issue, please log a new issue with updated information and we will investigate.

authors: aspnet-hello molinjinyi

repo: aspnet/Caching


text:
Should default(StringSegment) != default(StringSegment)?

I've noticed that default(StringSegment) == default(StringSegment) evaluates to false, which seems to be done for a reason in the source code, but I'm not sure what that reason is. I was just wondering if someone could fill me in, I'm just curious.

Seems like an oversight. cc @javiercn

Yup this just seems like a bug.

Yep, @rynowak is there any perf reason to not do string.Compare directly? I've done a quick test of the API on the interactive window in VS and it works fine for null values. (We will want a theory test here, though)

@jbagga please enjoy this bug 😄

cc @pranavkm for FYI information.

authors: Eilon javiercn pranavkm tuespetre

repo: aspnet/Common


text:
Add support for DataMember attribute to override JSON settings key

Addresses #774

 Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.:x: dodexahedron sign nowYou have signed the CLA already but the status is still pending? Let us recheck it.

Note: The link to the CLA on the aspnet/Home repo is invalid.

Thanks for your PR, but the current thinking is that we are going to do something like https://github.com/aspnet/Configuration/pull/789 to address this

authors: HaoK dnfclas dodexahedron

repo: aspnet/Configuration


text:
Update an-overview-of-project-katana.md

Quotes fix at owin.RequestProtocol

 Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.:x: sultanimbayev sign nowYou have signed the CLA already but the status is still pending? Let us recheck it.

@sultanimbayev  looks like you have a commit with https://github.com/aspnet/Docs/pull/4859

I'm sorry. I didn't mentioned that i have opened two pull requests with the same changes

can you just drop changes of sample4.cs?

I will open another pull request.

authors: Rick-Anderson dnfclas sultanimbayev

repo: aspnet/Docs


text:
Update complex-data-model.md

Removed duplication in the Update the Enrollment entity header.

@GoFightNguyen Nice catch! Thank you for taking the time to fix it.

authors: GoFightNguyen scottaddie


text:
Can this be used to synchronize related table

lets say we have a Student table and StudentGrades table.
I don't want other requests to edit the grades at the same time.
can i do
BeginTransaction
var Student = db.Students.Find(...);
Student.LastModified = DateTimeOffset.Now;
db.SaveChanges();// this will update the rowversion
query StudentGrades;
edit StudentGrades;
db.SaveChanges();
Commit Transaction;
or do i have to put RowVersion on each StudentGrade?

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

ID: 649fbab8-b960-6873-14bf-188d14757fee
Version Independent ID: f5ee3135-54c8-689c-e28b-b203b376bd6f
Content: Handling Concurrency Conflicts - EF Core
Content Source: entity-framework/core/saving/concurrency.md
Product: entity-framework
Technology: entity-framework-core
GitHub Login: @rowanmiller
Microsoft Alias: divega

@hoksource you specify what properties act as row version in the model. No need to do it for each individual instance.

authors: divega hoksource


text:
EF7 code-based model .. using a Data Dictionary approach ?

To explain what this is, consider the fact that if we have something like "Customer ID" property that is repeated some 40 times in 40 different model entities, that all refer to the same physical meaning, ie sharing the same common attributes such as Type, Display Format, Display Label, Validation, etc., then with a Data Dictionary approach this Property is defined Once with all its related attributes and then referred to as many as required in the model entities without the need to redefine the Attributes in each entity model file.
As it is now, we copy the Property with all its Attributes to all the Model files that need to have it, and this makes maintenance of the Model a nightmare each time we need to adjust, correct, or change an attribute of a property, we need to inspect all ViewModels and Models to see where else this property is mentioned.
The idea of Data Dictionary based development is not new (in the 1990's of object oriented 4GL development) proved to be a very productive and clean development environments.
Just a humbled thought I wanted to share.

@awbmansour could you elaborate a little more on the code you want to write. Do you want to still have CLR classes for each entity and just apply the same configuration to every CustomerId property? Or do you not want strongly typed classes and have more of a property bag (Dictionary<string, object>) approach?

Dear Rowan,
Thanks a lot for entertaining my humbled suggestion.
My proposal is to have it in an object oriented way, with inheritance, so
on a context level we have overall definitions that are global to the
context, which can be used in any entity class, and optionally in an entity
class the attributes can be altered or redefined.
Assume that the dictionary associated with the context "mycontext" will be
defined in a mycontext_globaldefs.cs file :
mycontext_globaldefs.cs would contain the properties that would be used
commonly or repeatedly in a context with one or more of the attributes that
can be assigned to such properties :
[DisplayFormat(....)]
[DataType(....)]
[Display(...)]
Guid customer_id;
[DisplayFormat(....)]
[DataType(....)]
[Display(...)]
[StringLength(....)]
string customer_name;
In the individual entity classes, we will use these common properties along
with other singular properties which would not justify/warrant the use of a
common/global definition:
in customer.cs entity class file :
namespace MyApp.Models
{
public class customer
{
[Key]
[Required(......)]
public customer_id { get; set; }
    [Required(......)]
    public customer_name { get; set; }

  }

}
In another class (eg, prioritycustomer.cs), where the property will be
used, except one attribute (in the example, the Display attribute) that
needs redefinition, and other attribute that is not needed (in the example,
Required not needed for Customer Name)
in prioritycustomer.cs entity class file :
namespace MyApp.Models
{
public class prioritycustomer
{
[Key]
[Required(......)]
[Display(...)]
public customer_id { get; set; }
    public customer_name { get; set; }

  }

}
I hope I answered your kind question,
Best Regards
Adel
On Sat, Jan 10, 2015 at 1:32 AM, Rowan Miller notifications@github.com
wrote:

@awbmansour https://github.com/awbmansour could you elaborate a little
more on the code you want to write. Do you want to still have CLR classes
for each entity and just apply the same configuration to every CustomerId
property? Or do you not want strongly typed classes and have more of a
property bag (Dictionary) approach?
—
Reply to this email directly or view it on GitHub
https://github.com/aspnet/EntityFramework/issues/1370#issuecomment-69419597
.

--
Thanks and Best Regards
Adel Mansour
Director
simplerApps Software Solutions Ltd.
www.simplerapps.com
amansour@simplerapps.com
mobile | viber | whatsapp : +20 122 3987214

@awbmansour - This can be achieved in EF6 using bulk configuration (a.k.a custom conventions).
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    modelBuilder
        .Properties<string>()
        .Where(p => p.Name == "customer_name")
        .Configure(p => p.HasMaxLength(200).IsUnicode(true));

}

Of course, if you wanted to parse some other format (such as the globaldefs.cs class you mentioned) and dynamically create conventions based on that it would be possible.
We'll have something similar in EF7 too, tracked by https://github.com/aspnet/EntityFramework/issues/214.

Wow .. this is awesome. I will need to learn more on this.
Thanks a lot for your care and time during your busy schedule.
On Jan 13, 2015 12:29 AM, "Rowan Miller" notifications@github.com wrote:

@awbmansour https://github.com/awbmansour - This can be achieved in EF6
using bulk configuration (a.k.a custom conventions).
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder
.Properties()
.Where(p => p.Name == "customer_name")
.Configure(p => p.HasMaxLength(200).IsUnicode(true));
}
Of course, if you wanted to parse some other format (such as the
globaldefs.cs class you mentioned) and dynamically create conventions based
on that it would be possible.
We'll have something similar in EF7 too, tracked by #214
https://github.com/aspnet/EntityFramework/issues/214.
—
Reply to this email directly or view it on GitHub
https://github.com/aspnet/EntityFramework/issues/1370#issuecomment-69659423
.

Closing out this issue now, feel free to re-open if you have further questions :smile:

authors: awbmansour rowanmiller

repo: aspnet/EntityFramework


text:
Design meeting discussion: October 28, 2015

This issue is for discussion of the EF design meeting on October 28, 2015.
Items discussed were:

DNX Commands and Startup Projects

Please comment on this issue to provide feedback, ask questions, etc.

Just a note about the wiki page, the command :
dnx ef migrations add MyMigration --targetProject MyApp.Data
Should be : (on the latest version 1.0.0-rc2-16317)
dnx ef migrations add MyMigration --target-project MyApp.Data

@aconstant design meeting notes (and other design docs) are just a point in time thing and we don't keep them updated as the product evolves. Our docs for actually using EF are at docs.efproject.net and we keep those updated with each release.

We are closing this issue because no further action is planned for this issue. If you still have any issues or questions, please log a new issue with any additional details that you have.

authors: aconstant ajcvickers bricelam rowanmiller


text:
Query: Translate string.IsNullOrEmpty

I'm having a situation where I need to get data from a single table with 100k+ rows with a quite simple where clause. This query was originally created with EF6 and returned within 100ms.
The code is:
return await dbContext.Tees
    .Where(w => w.CourseId.Equals(courseId) && !string.IsNullOrEmpty(w.Name) && w.IsActive.Equals(true) && w.IsDeleted.Equals(false))
    .OrderBy(o => o.Color)
    .Select(s => new TeeDto
    {
        CourseId = s.CourseId,
        TeeId = s.TeeId,
        FrontPar = s.ParFront,
        BackPar = s.ParBack,
        CoursePar = s.CoursePar,
        DistanceBack = s.DistanceBack,
        DistanceFront = s.DistanceFront,
        DistanceTotal = s.DistanceTotal,
        Name = s.Name,
        Color = s.Color,
        Rating = s.Rating,
        Slope = s.Slope
    }).ToListAsync();

The query above took more than 55 secs to come back. So I used Profiler to discover that the generated SQL did not include any of the where clause except for the last one (IsDeleted).
SELECT [w].[CourseId], [w].[Name], [w].[IsActive], [w].[TeeId], [w].[ParFront], [w].[ParBack], [w].[CoursePar], [w].[DistanceBack], [w].[DistanceFront], [w].[DistanceTotal], [w].[Color], [w].[Rating], [w].[Slope]
FROM [Tee] AS [w]
WHERE [w].[IsDeleted] = 0
ORDER BY [w].[Color]

I changed the clauses order and pushed the string.IsNullOrEmpty at the end, so the query looks like
return await dbContext.Tees
    .Where(w => w.CourseId.Equals(courseId) && w.IsActive.Equals(true) && w.IsDeleted.Equals(false) && !string.IsNullOrEmpty(w.Name))
    .OrderBy(o => o.Color)
    .Select(s => new TeeDto
    {
        CourseId = s.CourseId,
        TeeId = s.TeeId,
        FrontPar = s.ParFront,
        BackPar = s.ParBack,
        CoursePar = s.CoursePar,
        DistanceBack = s.DistanceBack,
        DistanceFront = s.DistanceFront,
        DistanceTotal = s.DistanceTotal,
        Name = s.Name,
        Color = s.Color,
        Rating = s.Rating,
        Slope = s.Slope
    }).ToListAsync();

With the modified where clauses, the query came back under 100ms but the generated SQL was not exactly what I was hoping for; the string.IsNullOrEmpty was not translated at all:
exec sp_executesql N'SELECT [w].[Name], [w].[CourseId], [w].[TeeId], [w].[ParFront], [w].[ParBack], [w].[CoursePar], [w].[DistanceBack], [w].[DistanceFront], [w].[DistanceTotal], [w].[Color], [w].[Rating], [w].[Slope]
FROM [Tee] AS [w]
WHERE (([w].[CourseId] = @__courseId_0) AND ([w].[IsActive] = 1)) AND ([w].[IsDeleted] = 0)
ORDER BY [w].[Color]',N'@__courseId_0 bigint',@__courseId_0=3959

I had to manually recreate the string.IsNullOrEmpty method in order to get the results I needed, and thus the correct SQL.
return await dbContext.Tees
    .Where(w => w.CourseId.Equals(courseId) && (w.Name != null || w.Name != "") && w.IsActive.Equals(true) && w.IsDeleted.Equals(false))
    .OrderBy(o => o.Color)
    .Select(s => new TeeDto
    {
        CourseId = s.CourseId,
        TeeId = s.TeeId,
        FrontPar = s.ParFront,
        BackPar = s.ParBack,
        CoursePar = s.CoursePar,
        DistanceBack = s.DistanceBack,
        DistanceFront = s.DistanceFront,
        DistanceTotal = s.DistanceTotal,
        Name = s.Name,
        Color = s.Color,
        Rating = s.Rating,
        Slope = s.Slope
    }).ToListAsync();

exec sp_executesql N'SELECT [w].[CourseId], [w].[TeeId], [w].[ParFront], [w].[ParBack], [w].[CoursePar], [w].[DistanceBack], [w].[DistanceFront], [w].[DistanceTotal], [w].[Name], [w].[Color], [w].[Rating], [w].[Slope]
FROM [Tee] AS [w]
WHERE ((([w].[CourseId] = @__courseId_0) AND ([w].[Name] IS NOT NULL OR (([w].[Name] <> '''') OR [w].[Name] IS NULL))) AND ([w].[IsActive] = 1)) AND ([w].[IsDeleted] = 0)
ORDER BY [w].[Color]',N'@__courseId_0 bigint',@__courseId_0=3959

Am I doing this correctly or for now, the support of translating string.IsNullOrEmpty into SQL is not supported yet? I'm using EF 7.0.0-rc1-final

Any chance you added support for  String.IsNullOrWhiteSpace while you were at it?

@MrGadget1024 - Yes. string.IsNullOrWhiteSpace is already supported.
Test - https://github.com/aspnet/EntityFramework/blob/dev/test/Microsoft.EntityFrameworkCore.SqlServer.FunctionalTests/QuerySqlServerTest.cs#L5810

authors: MrGadget1024 raphlo smitpatel


text:
[DataType] annotation not working

Property
public DateTime? TimeCreated { get; set; }
is by default mapped to datetime2(7).
But if I want to map it to older datetime type it works when explicitly configured in FluentApi but does not work(remains default type) when configured with Annotation:
[DataType("datetime")]
public DateTime? TimeCreated { get; set; }`

Further technical details
EF Core version: 1.1.2
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017

You should use the Column attribute, not DataType
[Column(TypeName = "datetime")]

Thx for that info.

authors: ErikEJ borisdj


text:
Migrations: Only create FKs once in a hierarchy

Fixes #2887

Looks good. :shipit:

authors: bricelam lajones


text:
Fix: #7048 - EF Core 1.1 .ToString() translation causes exception

Adding bad data error handling logic to materialization introduced the possibility
of hitting a known expression compiler limitation (as described here: https://github.com/dotnet/corefx/pull/13126).
This change works around the limitation by moving the read-value try-catch to a helper method, thus we no
longer insert a try-catch directly into the output ET.

:shipit: after changes in the ExpressionPrinter

authors: anpete maumar


text:
Migration issue with multiple nested "OwnsOne" after upgrading to v.2.2.2

I get error message when I try to update the database after generating a migration. Before upgrading to 2.2.2  - it works fine.
Exception message: System.InvalidOperationException: The entity type 'EFError1.Models.SubAddress' cannot be added to the model because a weak entity type with the same name already exists.
Stack trace:System.InvalidOperationException: The entity type 'EFError1.Models.SubAddress' cannot be added to the model because a weak entity type with the same name already exists.
   at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.AddEntityType(EntityType entityType)
   at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.AddEntityType(String name, ConfigurationSource configurationSource)
   at Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(TypeIdentity& type, ConfigurationSource configurationSource, Boolean allowOwned, Boolean throwOnQuery)
   at Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(String name, ConfigurationSource configurationSource, Boolean allowOwned, Boolean throwOnQuery)
   at Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder.FindRelatedEntityType(String relatedTypeName, String navigationName)
   at Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder.HasOne(String relatedTypeName, String navigationName)
   at EFError1.Migrations.Initial.<>c.<BuildTargetModel>b__2_7(ReferenceOwnershipBuilder b3) in D:\SandBox\EFIssues\EFError1\EFError1\Migrations\20190312102225_Initial.Designer.cs:line 128
   at Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder.OwnsOne(String ownedTypeName, String navigationName, Action`1 buildAction)
   at EFError1.Migrations.Initial.<>c.<BuildTargetModel>b__2_6(ReferenceOwnershipBuilder b2) in D:\SandBox\EFIssues\EFError1\EFError1\Migrations\20190312102225_Initial.Designer.cs:line 118
   at Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder.OwnsOne(String ownedTypeName, String navigationName, Action`1 buildAction)
   at EFError1.Migrations.Initial.<>c.<BuildTargetModel>b__2_3(ReferenceOwnershipBuilder b1) in D:\SandBox\EFIssues\EFError1\EFError1\Migrations\20190312102225_Initial.Designer.cs:line 101
   at Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder.OwnsOne(String ownedTypeName, String navigationName, Action`1 buildAction)
   at EFError1.Migrations.Initial.<>c.<BuildTargetModel>b__2_1(EntityTypeBuilder b) in D:\SandBox\EFIssues\EFError1\EFError1\Migrations\20190312102225_Initial.Designer.cs:line 86
   at Microsoft.EntityFrameworkCore.ModelBuilder.Entity(String name, Action`1 buildAction)
   at EFError1.Migrations.Initial.BuildTargetModel(ModelBuilder modelBuilder) in D:\SandBox\EFIssues\EFError1\EFError1\Migrations\20190312102225_Initial.Designer.cs:line 34
   at Microsoft.EntityFrameworkCore.Migrations.Migration.<.ctor>b__4_0()
   at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value()
   at Microsoft.EntityFrameworkCore.Migrations.Migration.get_TargetModel()
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.GenerateUpSql(Migration migration)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.<>c__DisplayClass13_2.<GetMigrationCommandLists>b__2()
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_1.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
The entity type 'EFError1.Models.SubAddress' cannot be added to the model because a weak entity type with the same name already exists.

Steps to reproduce
For reproduce this issue create test project, add EF core 2.2.2, and do the migration using the classes described below
Partial code listings:
public class Root
    {
        public int Id { get; set; }
        public MainAddress Address1 { get; set; }
        public MainAddress Address2 { get; set; }
    }

public class MainAddress
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public  SubAddress SubAddress { get; set; }
    }

public class SubAddress
{
    public int Id { get; set; }
    public string Name { get; set; }
    public int Number { get; set; }
    public SubSubAddress SubSubAddress { get; set; }
}

public class SubSubAddress
{
    public int Id { get; set; }
    public string Text { get; set; }
}

public class RootConfig : IEntityTypeConfiguration<Root>
    {
        public void Configure(EntityTypeBuilder<Root> builder)
        {
            builder.ToTable("Roots");

            builder.HasKey(it => it.Id);

            builder.OwnsOne(root => root.Address1, address =>
            {
                address.OwnsOne(a => a.SubAddress, subAddress =>
                {
                    subAddress.OwnsOne(it => it.SubSubAddress);
                });
            });

            builder.OwnsOne(root => root.Address2, address =>
            {
                address.OwnsOne(a => a.SubAddress, subAddress =>
                    {
                        subAddress.OwnsOne(it => it.SubSubAddress);
                    });
            });
        }
    }

public class TestContext : DbContext
    {
        public TestContext(DbContextOptions<TestContext> context) : base(context)
        {

        }

        public DbSet<Root> Roots { get; set; }

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

Further technical details
EF Core version: 2.2.2
Database Provider: Npgsql.EntityFrameworkCore.PostgreSQL 2.2.0
Operating system: Windows 10
IDE: Rider 2018.3

@ASBrattsev What version are you upgrading from?

2.1.8

The problem has a temporary solution, but I don't like it. I changed the example a bit. It is necessary to comment out the first mentions of a triple attachment of a double "OwnsOne", as on the picture, and then everything works. (sorry if not clearly written, I don't know how to write it in my native language, not that English =) )

Duplicate of #18183

authors: ASBrattsev AndriySvyryd ajcvickers

repo: aspnet/EntityFrameworkCore


text:
EFCore 2.2.6 DBQuery.FromSql.Select error (Object reference not set to an instance of an object)

I made tests using BDQuery and had issues when mapping the result of a FromSql() request in a Select().
I have an error: Object reference not set to an instance of an object.
Here is an example:
DBContext class:
public class MyDbContext : DbContext
{
    public MyDbContext(DbContextOptions<MyDbContext> options)
        : base(options) { }

    public DbQuery<MyEntity> MyEntities { get; set; }
}

Here is the MyEntity class definition:
public class MyEntity
{
    public int Id { get; set;}
}

If in my code I make the following call, it works fine (_dbContext is of type MyDbContext of course):
var result = await _dbContext.MyEntities
   .FromSql("Exec MyStoredProc")
   .Select(s => new { s.Id })
   .ToListAsync()

The MyStoreProc returns a column with name Id.
But if I declare a class MyDTO like this :
public class MyDTO
{
    public int MyId { get; set;}
}

And then make a call like this :
var result = await _dbContext.MyEntities
   .FromSql("Exec MyStoredProc")
   .Select(s => new MyDTO {MyId = s.Id })
   .ToListAsync()

Then an exception is raised: Object reference not set to an instance of an object
If I rename the field MyId  by Id in the MyDTO Class definition, it works fine again. Any idea regarding this behavior? Why when the field name doesn't map with the SQL column name an error occurs?
Here is the stack trace when the exception occurs:
at Microsoft.EntityFrameworkCore.Storage.TypedRelationalValueBufferFactoryFactory.CacheKey.<>c.b__6_0(Int32 t, TypeMaterializationInfo v)
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable1 source, TAccumulate seed, Func3 func)
at System.Collections.Generic.ObjectEqualityComparer1.GetHashCode(T obj)    at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)    at Microsoft.EntityFrameworkCore.Query.Sql.Internal.FromSqlNonComposedQuerySqlGenerator.CreateValueBufferFactory(IRelationalValueBufferFactoryFactory relationalValueBufferFactoryFactory, DbDataReader dataReader)    at Microsoft.EntityFrameworkCore.Internal.NonCapturingLazyInitializer.EnsureInitialized[TParam,TValue](TValue& target, TParam param, Func2 valueFactory)
at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.NotifyReaderCreated(DbDataReader dataReader)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable1.AsyncEnumerator.<BufferlessMoveNext>d__12.MoveNext()    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.<ExecuteAsync>d__72.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable1.AsyncEnumerator.<MoveNext>d__11.MoveNext()    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor1.EnumeratorExceptionInterceptor.d__5.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()    at System.Linq.AsyncEnumerable.<Aggregate_>d__63.MoveNext() in D:\a\1\s\Ix.NET\Source\System.Interactive.Async\Aggregate.cs:line 120
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()    at ants.Services.CampaignService.<GetSmsStatusesAsync>d__14.MoveNext() in C:\Repositories\Professional Services\Gouv\ants\ants\Services\CampaignService.cs:line 546    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at ants.Controllers.SmsController.d__5.MoveNext() in C:\Repositories\Professional Services\Gouv\ants\ants\Controllers\SmsController.cs:line 91
EF Core version: 2.2.6
Database provider: Microsoft.EntityFrameworkCore.SqlServer
.NET Core 2.2
Operating system: Windows 10
IDE: Visual Studio 2019 16.2.5

@vbond007 EF does not compose SQL after execution of a stored procedure, so this would be evaluated on the client in EF Core 2.2.x. EF Core 3.0 doesn't support automatic client evaluation, so there is nothing to fix in 3.0. Instead be explicit about the client evaluation. For example:
var result = (await _dbContext.MyEntities
   .FromSql("Exec MyStoredProc")
   .ToListAsync())
   .Select(s => new MyDTO {MyId = s.Id })
   .ToList()


text:
Port fix for #1041 to 2.2

Impact
It's not possible to set the Period of the health check publisher hosted service without using reflection. The wrong backing field is set.
This isn't very discoverable because the bug manifests in a setting not being honoured. You might think you are publishing health data every 30 seconds, but it's going to always use the default period.
Workaround
The workaround is to use reflection.
Risk
The risk here is that someone is setting Period - which actually sets Delay and they are relying on this detail. If a user actually wanted to set Delay, they can already do that.

Approved for 2.2.5
Wait for branch to open.

PR needs at least two things:

approval from someone familiar with the changed code
updates to PatchConfig.props

@rynowak he deadline for merging 2.x fixes is currently the 15th. Please get this approved and in soon so that we can start working on official builds a bit early.

@dougbu @pranavkm - one of you want to mash the like button on this trivial change?

authors: dougbu rynowak vivmishra

repo: aspnet/Extensions


text:
Should we assume Internal Server Errors can be triggered by user input?

I've a question regarding error handling strategy with ASP.NET Core and MVC in particular. In a system we're building, we've been following the philosophy that we should return an HTTP 4xx result code for every error that can be triggered by the user/client. HTTP 5xx error codes should only be returned if we really have a server error: resource problems (e.g., DB connection down), programming errors, etc.
Therefore, whenever an HTTP 500 Internal Server Error is rendered to a user, we log a message that causes the operations and development teams to investigate.
We've observed that sometimes ASP.NET Core and MVC infrastructure will throw exceptions in situations that can be causes by the user, e.g., https://github.com/aspnet/Mvc/issues/5631.
While that issue is going to be fixed anyway, I'm wondering if in general we can assume that ASP.NET Core and MVC will not throw exceptions for specific inputs, e.g., malformed requests. Or should we assume that user input can result in unhandled exceptions while processing the request?
Specifically, @Tratcher said in https://github.com/aspnet/Mvc/issues/5631#issuecomment-419794212 that

[...] a 5xx response does not qualify as a server crash, the server is still operating fine, only the request was rejected. 4xx just means we understood what was wrong with the request and decided it was worth the effort to give you a more specific response. These only get added for common errors where it's obvious that the client was at fault and how.

Is this the indeed general ASP.NET Core policy? If so, we need to redefine our operations strategy, we don't want to by design raise an alert every time someone crafts a malformed request...

Indeed, you must understand the cause of an error to return a 4xx response. The server can do this when parsing the initial request headers as it's clear something is wrong with the message. However there are some errors that can't be raised until the app is processing the request and body. Unfortunately exceptions are sometimes used to communicate this and it's up to the app to catch them and decide if a 4xx is appropriate. Errors in antiforgery are one example. Errors in the request body format are another.

Okay, thanks for giving concrete examples.

exceptions are sometimes used to communicate this and it's up to the app to catch them and decide if a 4xx is appropriate

Is there a list of expected exceptions thrown by ASP.NET Core in reaction to request input so we can explicitly handle them? Or any other guidance on how we could differentiate system errors from request errors?

@fschmied unfortunately the list of exceptions is ever changing, and also varies based on 3rd party components, so providing such a list would be infeasible. However, in cases such as ASP.NET Core MVC, we've done work for API controllers to return better status codes by default, which would just avoid certain exceptions from being thrown in the first place.
But I'm not aware of any general purpose solution.

@fschmied I think in general yes that's the pattern. Another issue with having it be too "automatic" is that the right way to deal with an unhandled exception can vary dramatically between apps. Some apps might want to retry an operation, some might fall back to a default behavior, or who knows what.
I think what might be reasonable is that if you find an unhandled exception that you think that ASP.NET Core should definitely just handle in a definitive way, we could look at that and see if there should be a default behavior.

We periodically close 'discussion' issues that have not been updated in a long period of time.
We apologize if this causes any inconvenience. We ask that if you are still encountering an issue, please log a new issue with updated information and we will investigate.

authors: Eilon Tratcher aspnet-hello fschmied

repo: aspnet/Home


text:
DNX branding shows up in the ErrorPage

From @rustd on April 21, 2016 19:21
Repro Steps:

Create an ASP.NET Core Web App
Introduce a compilation error
Run the app to see the error page

Expected:
DNX branding should not show up in the error page. It does at the bottom as shown in this screenshot

Copied from original issue: aspnet/Diagnostics#271

From @Tratcher on April 21, 2016 21:24
That's Hosting's startup exception page, not the developer error page:
https://github.com/aspnet/Hosting/blob/dev/src/Microsoft.AspNetCore.Hosting/Startup/StartupExceptionPage.cs
https://github.com/aspnet/Hosting/blob/dev/src/Microsoft.AspNetCore.Hosting/compiler/resources/GenericError_Footer.html

From @Eilon on April 21, 2016 21:11
Hmm I don't see this in the latest packages. I ran from source code and there's no footer at all. I also don't see this being generated by searching the repo. I also looked over the last month or two of changes and didn't see where the might have been removed.
@Tratcher @ryanbrandenburg do you guys recall removing this? Or is it coming from somewhere else?

From @rustd on April 21, 2016 21:36
I am seeing this with this version  1.0.0-rc2-20581

repo: aspnet/Hosting


text:
Identity errors not displayed properly when using UseStatusCodePagesWithReExecute

When using UseStatusCodePagesWithReExecute, custom error StatusCodes like those found in GenerateRecoveryCodes.cshtml.cs do not display using the route as defined by UseStatusCodePagesWithReExecute  in the startup config.
Eg. return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
Retuning a StatusCode(404) without an object displays fine in the custom error layout, but when returned with an object like StatusCode(404, "Custom message..."), it's returned as a string result.

@adams-hub
Found this closed issue: https://github.com/aspnet/Mvc/issues/6717
Try using UseExceptionHandler.

authors: adams-hub gberlanga

repo: aspnet/Identity