I have a Xamarin Forms application which uses Entity Framework Core. When I start and test on the emulator everything is fine. Also when I start on a device which has a previous version running it works as expected. But when I run the app on a device with no data on it crashes when the following is executed:
var context = new EfCoreContext();
context.Database.Migrate();
I first noticed it when the prelaunch reports of google failed on 7 of 9 devices. The error there is:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/walleye/walleye:9/PQ2A.190405.003/5310204:user/release-keys'
Revision: 'MP1'
ABI: 'arm64'
pid: 12770, tid: 12770, name: utions.moneyfox >>> com.applysolutions.moneyfox <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
Cause: null pointer dereference
x0 0000000000000000 x1 0000000000000000 x2 0000000000000000 x3 0000007fec923bd0
x4 0000007f29ade9a0 x5 0000007fec923c60 x6 0000000000000000 x7 0000000000000000
x8 0000000000000000 x9 0000000000000000 x10 0000000000000000 x11 0000000000000000
x12 0000000000000000 x13 0000000000000000 x14 00000000ffffffff x15 0000000000000000
x16 0000007f1bd1d1f8 x17 0000007f1bb44670 x18 0000000000000008 x19 0000007f1bd34560
x20 0000000000000002 x21 0000000000000000 x22 0000000000000000 x23 000000000000007f
x24 0000000000000000 x25 0000000000000000 x26 0000007fec923d50 x27 0000007f16bdda34
x28 0000007f29ade000 x29 0000007fec923070
sp 0000007fec923070 lr 0000007f1ba8b658 pc 0000007f1bb44678
backtrace:
#00 pc 0000000000177678 /data/app/com.applysolutions.moneyfox-tqWhOmZmoDQ8yd5YLjvTqg==/lib/arm64/libmonosgen-2.0.so (mono_jit_info_get_method+8)
Funny enough, when I remove the Migrate call, start and add it again the app can start. Also in the prelaunch report are always 2 or 3 devices who can start the app without any issue. I can imagine that this is some kind of timing issue or that some other effect play in here. But the crash is consistently on that call no matter where in my application I put it.
I tried to get more information with try catches and global error handler which should log to my log file. But unfortunately, nothing is caught.
Is there a way to narrow down the issue, may be based on the error log from the prelaunch report?
Alright, it seems that is an issue in Xamarin.Android: https://developercommunity.visualstudio.com/content/problem/580820/xamarin-problem-following-update-to-vs2019-161.html
And it seems like it is fixed with 16.1.4.
I am running into a problem while designing a solution using autosys. Looking for some inputs on this scenario:
I have three job Boxes viz. BoxA,BoxB and BoxC.
BoxA has two jobs inside it A1 and A2 respectively and I have configured the last job in this box with two exit codes as success codes 0 and 10 respectively.
Now depending upon the exit code of the job in this box, I want to trigger either BoxB( if exit code is 0 ) or BoxC( if exit code is 10 ).
Additional information for BoxB and BoxC:
BoxB has 5 jobs in it names B1,B2...B5 and this box will kick off when exit code of A2 will be 0.
BoxC has 7 jobs in it and this box will kick off if either A2 exits with code 10 OR B5 goes into success.
ISSUE description:
If A2 exits with code 10 then in that case the solution is working as expected amd BoxC gets kicked off.
However, if A2 exits with code 0 both BoxB and BoxC get kock off.
This is the starting condition of BoxC:
(e(A2)=10) or s(B5)
Please advise.
Harsh,
As stated, jobs are A1 A2 B1 B2 B3 B4 B5 C1 C2 C3 C4 C5 C6 C7.
All jobs are under one box alone.
CASE I: Assuming the box start at 01:00 hours and job A2’s exit code is 0
insert_job: BOX_NAME
job_type: box
owner: ##
max_run_alarm: 0
alarm_if_fail: n
date_conditions: y
start_times: "01:00"
run_calendar: ##
send_notification: n
box_success: s(C7)
A1 Success
A2 Success with E=0
Job B1 defined as
insert_job: JOB_B1
condition: e(A2)=0
B1 Success
B2 .. B5 Success
Job C1 defined as
insert_job: JOB_C1
condition: e(A2)=10 | s(B5)
C1 .. C7 Success
box completed !!
CASE II: job A2’s exit code is 10
A1 Success
A2 Success with E=10
condition: e(A2)=0 #jobs remains activated
B1 .. B5 Activated
condition: e(A2)=10 | s(B5) # OR condition is fulfilled C1 starts
C1 .. C7 Success
B1 .. B5 jobs remain activated but box completes upon success of C7.
box completed !!
Hope this helps.
Let me know if i am clear enough.
My answer is considering only the happy cases and not into account of the extreme cases.
I am using Python-RF framework with the example below. I scanned the file
"C" is considered as "". If in the robot file I remove the letter C before the ${expression}, it causes error
Original:
Test Template Calculate
Library CalculatorLibrary.py
*** Test Cases *** Expression Expected
Addition 12 + 2 + 2 16
2 + -3 -1
*** Keywords ***
Calculate
[Arguments] ${expression} ${expected}
Push buttons C${expression}=
Result should be ${expected}
Changed:
*** Test Cases ***
Additions 12 + 2 + 2 16
2 + -3 -1
*** Keywords ***
Calculate
[Arguments] ${expression} ${expected}
Push buttons ${expression}=
Result should be ${expected}
There is an error " 159 != -1". Everyone can share your ideas what wrong it is?
Library file:
https://bitbucket.org/robotframework/robotdemo/src/51f472687b6a46e88b7c179423f0f336e19497fc/CalculatorLibrary.py?at=master&fileviewer=file-view-default
https://bitbucket.org/robotframework/robotdemo/src/51f472687b6a46e88b7c179423f0f336e19497fc/calculator.py?at=master&fileviewer=file-view-default
Without "C":
After your first test case ${expression} is "16". Then you put "2" at the end of it, now ${expression} is "162". Then you substract 3 from it which gives you 159 and this is what you see in the error.
With "C":
Using "C" you set ${expression} to "" (empty string) and then you calculate "2-3" which gives you correct "-1".
I am trying to use unix to transform a tab delimited file from a short/wide format to long format, in a similar way as the reshape function in R. I hope to create three rows for each row in the starting file. Column 4 currently contains 3 values separated by commas. I hope to keep columns 1, 2, and 3 the same for each starting row, but have column 4 be one of the values from the initial column 4. This example probably makes it more clear than I can describe verbally:
current file:
A1 A2 A3 A4,A5,A6
B1 B2 B3 B4,B5,B6
C1 C2 C3 C4,C5,C6
goal:
A1 A2 A3 A4
A1 A2 A3 A5
A1 A2 A3 A6
B1 B2 B3 B4
B1 B2 B3 B5
B1 B2 B3 B6
C1 C2 C3 C4
C1 C2 C3 C5
C1 C2 C3 C6
As someone just becoming familiar with this language, my initial thought was to use sed to find the commas replace with a hard return
sed 's/,/&\n/' data.frame
I am really not sure how to include the values for columns 1-3. I had low hopes of this working, but the only thing I could think of was to try inserting the column values with {print $1, $2, $3}.
sed 's/,/&\n{print $1, $2, $3}/' data.frame
Not to my surprise, the output looked like this:
A1 A2 A3 A4
{print $1, $2, $3} A5
{print $1, $2, $3} A6
B1 B2 B3 B4
{print $1, $2, $3} B5
{print $1, $2, $3} B6
C1 C2 C3 C4
{print $1, $2, $3} C5
{print $1, $2, $3} C6
It seems like an approach might be to store the values of columns 1-3 and then insert them. I am not really sure how to store the values, I think that it may involve using an adaptation of the following script, but I am having a hard time understanding all of the components.
NR==FNR{a[$1, $2, $3]=1}
Thanks in advance for your thoughts on this.
You can a write simple read loop for this and use brace expansion for parsing the comma delimited field:
#!/bin/bash
while read -r f1 f2 f3 c1; do
# split the comma delimited field 'c1' into its constituents
for c in ${c1//,/ }; do
printf "$f1 $f2 $f3 $c\n"
done
done < input.txt
Output:
A1 A2 A3 A4
A1 A2 A3 A5
A1 A2 A3 A6
B1 B2 B3 B4
B1 B2 B3 B5
B1 B2 B3 B6
C1 C2 C3 C4
C1 C2 C3 C5
C1 C2 C3 C6
As solution without calling an external program :
#!/bin/bash
data_file="d"
while IFS=" " read -r f1 f2 f3 r
do
IFS="," read f4 f5 f6 <<<"$r"
printf "$f1 $f2 $f3 $f4\n$f1 $f2 $f3 $f5\n$f1 $f2 $f3 $f6\n"
done <"$data_file"
In the great Miller there is the nest verb to do it
With
mlr --nidx --ifs "\t" nest --explode --values --across-records -f 4 --nested-fs "," input.tsv
you will have
A1 A2 A3 A4
A1 A2 A3 A5
A1 A2 A3 A6
B1 B2 B3 B4
B1 B2 B3 B5
B1 B2 B3 B6
C1 C2 C3 C4
C1 C2 C3 C5
C1 C2 C3 C6
If you don't need the output to be in any particular order within a group of the fourth column, the following awk one-liner might do:
awk '{split($4,a,","); for(i in a) print $1,$2,$3,a[i]}' input.txt
This works by splitting your 4th column into an array, then for each element of the array, printing the "new" four columns.
If order is important -- that is, A4 must come before A5, etc, then you can use a classic for loop:
awk '{split($4,a,","); for(i=1;i<=length(a);i++) print $1,$2,$3,a[i]}' input.txt
But that's awk. And you're asking about bash.
The following might work:
#!/usr/bin/env bash
mapfile -t arr < input.txt
for s in "${arr[#]}"; do
t=($s)
mapfile -t -d, u <<<"${t[3]}"
for v in "${u[#]}"; do
printf '%s %s %s %s\n' "${t[#]:0:3}" "${v%$'\n'}"
done
done
This copies your entire input file into the elements of an array, and then steps through that array, mapping each 4th-column into a second array. It then steps through that second array, printing the first three columns from the first array, along with the current field from the second array.
It's obviously similar in structure to the awk alternative, but much more cumbersome to read and code.
Note the ${v%$'\n'} on the printf line. This strips off the last field's trailing newline, which doesn't get stripped by mapfile because we're using an alternate delimiter.
Note also that there's no reason you have to copy all your input into an array, I just did it that way to demonstrate a little more of mapfile. You could of course use the old standard,
while read s; do
...
done < input.txt
if you prefer.
I am trying to add tags to data-driven tests in Robot Framework. I have created keywords for the templatized tests and tables for the data similar to the following:
# Test case file
*** settings ***
Resource libraries.txt
Test Template My Test Template
*** test cases *** parameter1 parameter2 ER
testa value1a value2a ERa
testb value1b value2b ERb
# Template file
*** Keywords ***
My Test Template
[Arguments] ${parameter1} ${parameter2} ${ER}
${result}= Do Something ${parameter1} ${parameter2}
Should Be Equal As Strings ${result} ${ER}
How can I add (possibly distinct) tags for testa and testb?
It turned out to be PEBKAC. I was not indenting the tag statement. Those double spaces did me in (again).
Tags can be added like this:
*** test cases *** parameter1 parameter2 ER
testa value1a value2a ERa
[Tags] tag1
testb value1b value2b ERb
[Tags] tag1
There are several ways to add a tag.
Only test specific is like:
*** Test cases ***
Test A
[tags] tagA tagB
Log This is test A
It is possible to add a tag to all testcases in your file by placing a Force Tags in your settings:
*** Settings ***
Force Tags NewTag
For more information you can check the user guide: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#tagging-test-cases
One solution is to modify your keyword to take tags as arguments. Then you could do something like this:
*** Settings ***
| Test Template | My Test Template
*** test cases ***
| testa | value1a | value2a | ERa | tag1 | tag2
| testb | value1b | value2b | ERb | tag2 | tag3
*** Keywords ***
| My Test Template
| | [Arguments] | ${value1} | ${value2} | ${er} | #{tags}
| | log | value1: ${value1}
| | log | value2: ${value2}
| | log | er: ${er}
| | Set tags | #{tags}
When run, testa will have the tags tag1 and tag2, and testb will have the tags tag2 and tag3