dmitry-merzlyakov/nledger

Amount class gets NullException

Closed this issue · 2 comments

image

I tried this piece of testing code in .net core 3 and .net framework 4.7, both show the same exception. Thank you!

Hi, please check this documentation: https://github.com/dmitry-merzlyakov/nledger/blob/next-dev/build.md

In few words: if you are going to use a Standalone session (so, use NLedger DOM directly in your code), you should organize a scope for it (CreateStandaloneSession):

using(var session = NetSession.CreateStandaloneSession())
{
var eur = CommodityPool.Current.FindOrCreate("EUR");
var totalEur = new Amount("0.00 EUR");

Thanks,
Dmitry

I see, I missed this documentation. Thank you @dmitry-merzlyakov !