https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
kotlin-native
  • w

    Wietlol

    12/07/2020, 10:28 PM
    Can anyone point me to where the LLVM IR generation is and how the compiler invokes it?
    b
    • 2
    • 2
  • b

    Bruce McLaren

    12/08/2020, 1:07 AM
    Does anybody have suggestion on disk cache/file storage for multi-platform that works with Android and iOS?
    c
    k
    • 3
    • 4
  • m

    Michal Klimczak

    12/08/2020, 2:47 PM
    I wanted to use Napier logging on main thread and background threads (when using coroutines-native-mt). This is what I came up with
    fun initLogging() {
        Napier.base(DebugAntilog())
        GlobalScope.launch {
            withContext(Dispatchers.Default) {
                Napier.base(DebugAntilog())
            }
        }
    }
    Is there a less hacky way to achieve that? I assume I need a different Napier instance on each thread, since they are
    @ThreadLocal
    , right?
    • 1
    • 1
  • t

    tarek

    12/08/2020, 4:04 PM
    Do you know where I can find a recent example of using an Objective-C dependency with
    cinterops
    and not cocoapods?
    k
    • 2
    • 6
  • d

    darkmoon_uk

    12/09/2020, 12:29 AM
    Any plans to introduce RISC-V as a
    konan
    target ? I gather this would require an upgrade from current LLVM 8.0 based back-end, as RISC-V was introduced in 9.0. Perhaps this will come along with the IR based compiler? Asking due to an opportunity highlighted in #embedded-kotlin
    👍 1
    s
    h
    • 3
    • 2
  • a

    Amritansh

    12/10/2020, 1:05 AM
    Looking for help to convert this obj c code to Kotlin. I am android developer so I am running into lot of issues due to lack of obj c knowledge
    SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, "8.8.8.8");
        SCNetworkReachabilityFlags flags;
        BOOL success = SCNetworkReachabilityGetFlags(reachability, &flags);
        CFRelease(reachability);
        if (!success) {
            return ConnectionTypeUnknown;
        }
        BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0);
        BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0);
        BOOL isNetworkReachable = (isReachable && !needsConnection);
    
        if (!isNetworkReachable) {
            return ConnectionTypeNone;
        } else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {
            return ConnectionType3G;
        } else {
            return ConnectionTypeWiFi;
        }
    This code is to detect Network connection type
    t
    • 2
    • 2
  • a

    Animesh Sahu

    12/10/2020, 3:47 PM
    How to use map/list/set in multi-threaded environment? Currently mutation throws:
    Caused by: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlin.collections.HashMap@18af58
    I tried making the reference atomic, but that doesn't change the reference of underlying hash table atomic so exception is still thrown, is there any built-in data-structure to use?
    a
    k
    • 3
    • 6
  • a

    Animesh Sahu

    12/13/2020, 1:28 PM
    Does
    @ThreadLocal
    annotated property gets allocated for every thread everytime a new thread is created or when it is accessed for the first time?
    a
    k
    k
    • 4
    • 11
  • k

    Kuba Petržílka

    12/14/2020, 1:16 PM
    Is this document outdated: https://kotlinlang.org/docs/tutorials/native/mapping-struct-union-types-from-c.html ? It seems like there is no
    fun <reified T : kotlinx.cinterop.CVariable> alloc(): T
    extension function for
    kotlinx.cinterop.NativePlacement
    without any arguments anymore or where am I supposed to import it from?
    t
    c
    • 3
    • 3
  • m

    mkrussel

    12/14/2020, 7:25 PM
    Should exporting the date time library as part of my framework work.
    kotlin {
        ios {
            binaries {
                framework {
                    baseName = "SharedCode"
                    export(Deps.kotlinDateTime)
                    export(project(":pangea-core"))
                    export(project(":pangea-coroutines"))
                    export(project(":pangea-gis"))
                    export(project(":pangea-time"))
                    export(project(":pangea-data"))
                    export(project(":pangea-visual"))
                    export(project(":pangea-overlay"))
                    export(project(":pangea-source"))
                    export(project(":pangea-map"))
                    export(project(":pangea-mapbox"))
                }
            }
        }
    }
    When I do this I do not see anything about KotlinDateTime in the build output. Not listed in the list of libraries that were exported. When opening the produced header for the framework that gets generated. Instant is called
    SharedCodeKotlinx_datetimeInstant
    which is the pattern I saw for non exported classes. The converter functions for going from Instant to NSDate and back are also not there.
    • 1
    • 1
  • a

    Anthony Pages

    12/16/2020, 3:57 PM
    Hi there! I trying to dig into Kotlin MPP and coroutines, especially on iOS, but I don’t understand something. I have the following class in my Kotlin Library :
    @ThreadLocal
    var counter = MutableStateFlow(0)
    
    class FlowAndCoroutines {
        fun observeOnMain(callback: () -> Unit){
            MainScope().async(Dispatchers.Main) {
                counter.collect {value ->
                    callback()
                }
            }
        }
    
        fun triggerCollect() {
            MainScope().async(Dispatchers.Main) {
                counter.emit(counter.value + 1)
            }
        }
    }
    Now on iOS,
    let flowTest = FlowAndCoroutines()
    
    flowTest.observeOnMain {
        print("Callback called")
    }
    
    // In MAIN thread
    flowTest.triggerCollect() // output "Callback called"
    
    // In another thread 
    flowTest.triggerCollect() // Throw exception IncorrectDereferenceException
    k
    • 2
    • 11
  • m

    Marc Reichelt

    12/16/2020, 5:39 PM
    Hey there! I am trying to get a really simple Kotlin / Native CLI application running on Linux. It’s using the PeopleInSpace repo from https://github.com/joreilly/PeopleInSpace, and should simply: • print out some text • download some JSON using ktor client • and print the deserialized output But I’m currently getting this error when I try to build on Linux:
    > Task :command-line:linkDebugExecutableNative
    e: Compilation failed: The /root/.konan/dependencies/clang-llvm-8.0.0-linux-x86-64/bin/clang++ command returned non-zero exit code: 137.
    output:
    
    
     * Source files:
     * Compiler version info: Konan: 1.4.21 / Kotlin: 1.4.21
     * Output kind: PROGRAM
    
    e: org.jetbrains.kotlin.konan.KonanExternalToolFailure: The /root/.konan/dependencies/clang-llvm-8.0.0-linux-x86-64/bin/clang++ command returned non-zero exit code: 137.
    output:
    
            at org.jetbrains.kotlin.konan.exec.Command.handleExitCode(ExecuteCommand.kt:112)
            at org.jetbrains.kotlin.konan.exec.Command.execute(ExecuteCommand.kt:73)
            at org.jetbrains.kotlin.backend.konan.BitcodeCompiler.runTool(BitcodeCompiler.kt:31)
            ....
    Does anyone know how to find out what exactly went wrong here? (I’m running this inside Docker btw)
    k
    • 2
    • 4
  • k

    Kuba Petržílka

    12/17/2020, 1:00 AM
    I keep getting random crashes of my app targeting linuxX64:
    /mnt/agent/work/f01984a9f5203417/runtime/src/main/cpp/Memory.cpp:1271: runtime assert: Must be positive
    Any ideas how I can get some clue what am I doing wrong?
    a
    • 2
    • 4
  • j

    jean

    12/17/2020, 10:26 AM
    I manage to create an ios framework file and manually include it in my ios app but that quite time consuming, is there a way of automatically update the xcode project eachtime a new framework is build? Or something similar to a maven repo from the java world? I tried to use cocoapod but it does not work properly, I get a lot of errors
    a
    g
    • 3
    • 7
  • b

    Bruce McLaren

    12/17/2020, 7:36 PM
    This is my current code for implementing Dispatchers in KN (coroutines-core:1.3.6) for iOS. Has anybody been able to define a dispatcher in commonMain code only? Also, has Kotlinx been able to execute tasks on iOS background threads yet?
    actual val Main: CoroutineDispatcher = NsQueueDispatcher(dispatch_get_main_queue())
    
    actual val Background: CoroutineDispatcher = Main
    
    internal class NsQueueDispatcher(
        private val dispatchQueue: dispatch_queue_t
    ) : CoroutineDispatcher() {
        override fun dispatch(context: CoroutineContext, block: Runnable) {
            dispatch_async(dispatchQueue) {
                block.run()
            }
        }
    }
    t
    • 2
    • 1
  • p

    Patrick

    12/18/2020, 1:27 PM
    Is there a way to provide a ByteArray as a parameter to a C-interop function that expects
    const char*
    ? I've read the documentation but couldn't figure out how to do it. Adding
    noStringConversion = xxx
    doesn't seem to do anything for me. I don't want to convert to a String before passing the value, I just want to pass the ByteArray as is.
    k
    a
    • 3
    • 38
  • a

    Animesh Sahu

    12/20/2020, 6:18 AM
    By the way I'm also developing a multiplatform library for global keyboard-mouse interaction as well, since most GUI framework I see didn't offer global processing while not in focus (and sometimes is required such as to hide the app in background and keyboard shortcut to pop it up, etc). This lib provides both low level and high level access, If anyone interested, can always checkout https://github.com/Animeshz/keyboard-mouse-kt
    ❤️ 4
    d
    k
    • 3
    • 5
  • k

    Kuba Petržílka

    12/20/2020, 9:48 AM
    alright, I ll share my bit as well. Since Ktor doesnt (yet) support server on Native, I m creating a library for simple multithreaded http server, based on pure sockets, with dsl for definition of routing. it aleeady supports base64url encoding, rsa key pair and jwt token generation and jwks key sharing.. it is still in draft stage, but it is usable. you can take a look if you are interested. I ll be happy for any feedback/contrib: https://github.com/kubapet/knativesrv/tree/master
    ❤️ 3
    d
    • 2
    • 4
  • a

    Animesh Sahu

    12/20/2020, 1:30 PM
    Is this a bug:
    Compilation failed: Parameter specified as non-null is null: method kotlin.collections.CollectionsKt___CollectionsKt.joinToString, parameter $this$joinToString
    I haven't used joinToString in my project though this error comes in when I define a global variable:
    @SharedImmutable
    private val globalVar: AtomicRef<ObjectType?> = atomic(null)
    :blob-thinking-upside-down: Edit: Even with normal variable on top level scope this happens (also tested on
    @ThreadLocal
    ).
    • 1
    • 1
  • s

    Slackbot

    12/22/2020, 4:18 AM
    This message was deleted.
    n
    • 2
    • 1
  • e

    einsjannis

    12/22/2020, 9:16 AM
    I'm currently working on a kotlin/native mingwX64 project and when I try to compile I get this error: https://hastebin.com/fewuwovulu.log anyone got an idea what the issue could be (I use KGL and nothing else)?
    a
    a
    • 3
    • 8
  • j

    James Fu

    12/23/2020, 8:44 AM
    Hello, all
    a
    • 2
    • 1
  • j

    James Fu

    12/23/2020, 8:44 AM
    https://stackoverflow.com/questions/65338717/memory-leaks-detected-in-kotlin-native-framework-when-using-callback-function-in?noredirect=1#com[…]717
    :thread-please: 2
    a
    • 2
    • 2
  • a

    aleksey.tomin

    12/23/2020, 4:28 PM
    Is it a bug? On this code
    memScoped {
            if (...) {
                value?.let { callVoidFunction1() }
            } else if (..) {
                callVoidFunction1()
            }
        }
    I have error on IDEA:
    'if' must have both main and 'else' branches if used as an expression
    I can fix it by add
    } else {
    at end but it looks like ugly.
    r
    e
    +2
    • 5
    • 4
  • j

    James Fu

    12/24/2020, 2:11 AM
    Memory leaks detected in Kotlin/Native framework in the following example file. It may be cause from the callback function in the Kotlin. I have no ideas to solve this issue.... Launch the app and click on green button to init the detector and click on the red button to kill the detector repeatedly, and you will see the crash log shortly about "Memory leaks detected, x objects leaked!"
    SimpleDectorTest.zip
    a
    • 2
    • 2
  • a

    Animesh Sahu

    12/24/2020, 5:34 AM
    Hi, I wonder how K/N cross compile very well. When writing JNI, I literally have no option other than create a VM download and install c/c++ toolchains, and then compile. I'd like to know how K/N exactly do this so I can take an inspiration and probably try something 🙂, anybody can provide some info?
    m
    • 2
    • 4
  • e

    Ennio Masi

    12/29/2020, 12:13 AM
    Hi all! I’m facing a massive issue on iOS about memory leaks around coroutines (first screenshot) and the second kind (second screenshot) looks like is more related to ktor. Unfortunately it’s not clear which is the source of the issue via the memory leak inspector. As you can see from the third screenshot, the network call is just a normal suspend function called via scope.launch (screenshot #4) Have you ever experienced anything like this? Thanks in advance!
    👀 4
    💧 2
    a
    • 2
    • 5
  • e

    esdudnik

    12/29/2020, 12:05 PM
    Hi all. We are using “kotlinx-coroutines-core:1.4.2-native-mt” version. Can we use in that version DIpstachers.Main insteed of custom CoroutineDispatcher with
    dispatch_get_main_queue
    ? I can’t find anything in changelogs abouts this. Thanks)
    :yes-black: 2
    r
    • 2
    • 2
  • e

    eygraber

    12/30/2020, 4:02 PM
    Is K/N considered stable? If/when the new memory model is released, will I have to rewrite large portions of my code?
    a
    h
    +2
    • 5
    • 11
  • w

    wuseal

    12/31/2020, 6:44 AM
    Hi, When I use this method print throwable, it prints without stack line number. Any other method could print with line number? or any body can give me some reference? TKS
    throwable.printStack()
    from
    io/ktor/utils/io/ExceptionUtilsJs.kt:
    kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlinx.coroutines.ChildHandleNode@38b8508
        at 0   iosApp                              0x0000000101f24adf kfun:kotlin.Throwable#<init>(kotlin.String?){} + 95
        at 1   iosApp                              0x0000000101f1d5cd kfun:kotlin.Exception#<init>(kotlin.String?){} + 93
        at 2   iosApp                              0x0000000101f1d83d kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 93
        at 3   iosApp                              0x0000000101f544dd kfun:kotlin.native.concurrent.InvalidMutabilityException#<init>(kotlin.String){} + 93
        at 4   iosApp                              0x0000000101f548af ThrowInvalidMutabilityException + 431
        at 5   iosApp                              0x0000000102051590 MutationCheck + 128
        at 6   iosApp                              0x00000001021605f8 kfun:kotlinx.coroutines.internal.LinkedListNode#<set-_next>(kotlinx.coroutines.internal.LinkedListNode){} + 104
        at 7   iosApp                              0x000000010216099d kfun:kotlinx.coroutines.internal.LinkedListNode#addLast(kotlinx.coroutines.internal.LinkedListNode){} + 285
        at 8   iosApp                              0x0000000102160ce8 kfun:kotlinx.coroutines.internal.LinkedListNode#addOneIfEmpty(kotlinx.coroutines.internal.LinkedListNode){}kotlin.Boolean + 232
        at 9   iosApp                              0x00000001021131c1 kfun:kotlinx.coroutines.JobSupport.promoteSingleToNodeList#internal + 465
        at 10  iosApp                              0x0000000102111e8a kfun:kotlinx.coroutines.JobSupport#invokeOnCompletion(kotlin.Boolean;kotlin.Boolean;kotlin.Function1<kotlin.Throwable?,kotlin.Unit>){}kotlinx.coroutines.DisposableHandle + 2010
        at 11  iosApp                              0x0000000102111631 kfun:kotlinx.coroutines.JobSupport#invokeOnCompletion(kotlin.Function1<kotlin.Throwable?,kotlin.Unit>){}kotlinx.coroutines.DisposableHandle + 209
        at 12  iosApp                              0x00000001022aab42 kfun:io.ktor.client#HttpClient(io.ktor.client.engine.HttpClientEngineFactory<0:0>;kotlin.Function1<io.ktor.client.HttpClientConfig<0:0>,kotlin.Unit>){0§<io.ktor.client.engine.HttpClientEngineConfig>}io.ktor.client.HttpClient + 1138
        at 13  iosApp                              0x00000001022eed90 kfun:io.ktor.client#HttpClient(kotlin.Function1<io.ktor.client.HttpClientConfig<*>,kotlin.Unit>){}io.ktor.client.HttpClient + 640
        at 14  iosApp                              0x00000001022eefb0 kfun:io.ktor.client#HttpClient$default(kotlin.Function1<io.ktor.client.HttpClientConfig<*>,kotlin.Unit>?;kotlin.Int){}io.ktor.client.HttpClient + 304
        at 15  iosApp                              0x0000000101e7e9e8 kfun:wu.seal.app.idle.common.newslist.model.NewsListRepositoryImp.$loadDataCOROUTINE$8#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any? + 3800
        at 16  iosApp                              0x0000000101e80f75 kfun:wu.seal.app.idle.common.newslist.model.NewsListRepositoryImp#loadData(<http://kotlin.Int;kotlin.Int|kotlin.Int;kotlin.Int>){}wu.seal.app.idle.common.base.ResponseData<kotlin.collections.List<wu.seal.app.idle.common.newslist.model.News>> + 309
        at 17  iosApp                              0x0000000101e81b2f kfun:wu.seal.app.idle.common.newslist.usercase.LoadMoreNewsListUserCase.$executeCOROUTINE$9#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any? + 1455
        at 18  iosApp                              0x0000000101e82896 kfun:wu.seal.app.idle.common.newslist.usercase.LoadMoreNewsListUserCase#execute(){} + 246
        at 19  iosApp                              0x0000000101e79a9d kfun:wu.seal.app.idle.common.newslist.NewsListPresenter.$executeLoadMoreNewsListUserCase$lambda-2COROUTINE$7.invokeSuspend#internal + 749
    k
    • 2
    • 4
Powered by Linen
Title
w

wuseal

12/31/2020, 6:44 AM
Hi, When I use this method print throwable, it prints without stack line number. Any other method could print with line number? or any body can give me some reference? TKS
throwable.printStack()
from
io/ktor/utils/io/ExceptionUtilsJs.kt:
kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlinx.coroutines.ChildHandleNode@38b8508
    at 0   iosApp                              0x0000000101f24adf kfun:kotlin.Throwable#<init>(kotlin.String?){} + 95
    at 1   iosApp                              0x0000000101f1d5cd kfun:kotlin.Exception#<init>(kotlin.String?){} + 93
    at 2   iosApp                              0x0000000101f1d83d kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 93
    at 3   iosApp                              0x0000000101f544dd kfun:kotlin.native.concurrent.InvalidMutabilityException#<init>(kotlin.String){} + 93
    at 4   iosApp                              0x0000000101f548af ThrowInvalidMutabilityException + 431
    at 5   iosApp                              0x0000000102051590 MutationCheck + 128
    at 6   iosApp                              0x00000001021605f8 kfun:kotlinx.coroutines.internal.LinkedListNode#<set-_next>(kotlinx.coroutines.internal.LinkedListNode){} + 104
    at 7   iosApp                              0x000000010216099d kfun:kotlinx.coroutines.internal.LinkedListNode#addLast(kotlinx.coroutines.internal.LinkedListNode){} + 285
    at 8   iosApp                              0x0000000102160ce8 kfun:kotlinx.coroutines.internal.LinkedListNode#addOneIfEmpty(kotlinx.coroutines.internal.LinkedListNode){}kotlin.Boolean + 232
    at 9   iosApp                              0x00000001021131c1 kfun:kotlinx.coroutines.JobSupport.promoteSingleToNodeList#internal + 465
    at 10  iosApp                              0x0000000102111e8a kfun:kotlinx.coroutines.JobSupport#invokeOnCompletion(kotlin.Boolean;kotlin.Boolean;kotlin.Function1<kotlin.Throwable?,kotlin.Unit>){}kotlinx.coroutines.DisposableHandle + 2010
    at 11  iosApp                              0x0000000102111631 kfun:kotlinx.coroutines.JobSupport#invokeOnCompletion(kotlin.Function1<kotlin.Throwable?,kotlin.Unit>){}kotlinx.coroutines.DisposableHandle + 209
    at 12  iosApp                              0x00000001022aab42 kfun:io.ktor.client#HttpClient(io.ktor.client.engine.HttpClientEngineFactory<0:0>;kotlin.Function1<io.ktor.client.HttpClientConfig<0:0>,kotlin.Unit>){0§<io.ktor.client.engine.HttpClientEngineConfig>}io.ktor.client.HttpClient + 1138
    at 13  iosApp                              0x00000001022eed90 kfun:io.ktor.client#HttpClient(kotlin.Function1<io.ktor.client.HttpClientConfig<*>,kotlin.Unit>){}io.ktor.client.HttpClient + 640
    at 14  iosApp                              0x00000001022eefb0 kfun:io.ktor.client#HttpClient$default(kotlin.Function1<io.ktor.client.HttpClientConfig<*>,kotlin.Unit>?;kotlin.Int){}io.ktor.client.HttpClient + 304
    at 15  iosApp                              0x0000000101e7e9e8 kfun:wu.seal.app.idle.common.newslist.model.NewsListRepositoryImp.$loadDataCOROUTINE$8#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any? + 3800
    at 16  iosApp                              0x0000000101e80f75 kfun:wu.seal.app.idle.common.newslist.model.NewsListRepositoryImp#loadData(<http://kotlin.Int;kotlin.Int|kotlin.Int;kotlin.Int>){}wu.seal.app.idle.common.base.ResponseData<kotlin.collections.List<wu.seal.app.idle.common.newslist.model.News>> + 309
    at 17  iosApp                              0x0000000101e81b2f kfun:wu.seal.app.idle.common.newslist.usercase.LoadMoreNewsListUserCase.$executeCOROUTINE$9#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any? + 1455
    at 18  iosApp                              0x0000000101e82896 kfun:wu.seal.app.idle.common.newslist.usercase.LoadMoreNewsListUserCase#execute(){} + 246
    at 19  iosApp                              0x0000000101e79a9d kfun:wu.seal.app.idle.common.newslist.NewsListPresenter.$executeLoadMoreNewsListUserCase$lambda-2COROUTINE$7.invokeSuspend#internal + 749
k

kpgalligan

12/31/2020, 3:11 PM
Is that from
ExceptionUtilsJs
? It looks like a native stack trace. Not that it matters, but the
Js
implies it's coming from something else. Anyway...
I'd have to poke around. You can get actual line numbers when you push to Crashlytics, etc. I assume there's a way to do that locally, but I haven't looked into it too much (you can usually figure out what's wrong from function list and debugging, but line number would be nice).
😊 1
Today is a lot of native code, so I'll keep this in mind while poking around.
w

wuseal

01/05/2021, 3:53 AM
@kpgalligan Thanks for clarifying, Actually I hope we could see the crash or stacktrace line number in debug mode just like Java, aHa,Yep, we could figure out the problem from function list and debugging in most time. Thank you for your hot help.
View count: 5