In 'The Husbands of River Song', River learns that this night on Darillium is the Doctor and her's last night together. In that case, why was she surprised when the Doctor didn't recognize her in 'Silence in the Library'? She should, upon meeting the Doctor in 'Silence in the Library', understand that this is their last adventure together, that the Doctor hasn't met her yet, and that she will die.
She's not sure that Darillium is their last night together.
From The Husbands of River Song:
RIVER: There are stories about us, you know.
DOCTOR: Oh, I dread to think.
RIVER: I look them up sometimes.
DOCTOR: You really shouldn't do that.
RIVER: Some of them suggest that the very last night we spend together is at the Singing Towers of Darillium. That wouldn't be true, would it?
The Doctor dodges the question. Which might lead her to suspect that Darillium really is their last night together, but - especially given Rule #1, the Doctor lies - she can't be sure. Wishful thinking might lead her to assume it isn't and forget about the worse possibility. There must be a lot of wishful thinking when you're married to a 1000-year-old Time Lord who you keep meeting in the wrong order.
Their last night together isn't necessarily their last adventure together.
Even if Darillium is their last night together, they could still meet after that and fight monsters together. Even despite being post-Darillium in her timeline, the Library doesn't have to be the last time they see each other. She might expect to fight alongside the Doctor even without spending the night with him.
In fact, she probably already knows that she'll never see him romantically interested in her again. From Day of the Moon:
(River kisses the Doctor.)
DOCTOR: Right. Okay. Interesting.
RIVER: What's wrong? You're acting like we've never done that before.
DOCTOR: We haven't.
RIVER: We haven't?
DOCTOR: Oh, look at the time. Must be off. But it was very nice. It was, it was good. It was er, unexpected. You know what they say. There's a first time for everything.
(The Doctor goes into the Tardis.)
RIVER: And a last time.
Of course, the relevance of this depends on how we interpret "night together" - whether it has sexual connotations or simply means literally spending a night together. But either way, meeting him doesn't necessarily imply spending a night with him.
Him not recognising her doesn't necessarily equate with her never seeing him again.
They often meet precisely in reverse order - each time they meet being before (in her timeline) the last time (in his timeline) that they met, and vice versa - but not always. If he doesn't recognise her, then it's the first time in his timeline that they meet, but not necessarily the last in hers. So even if she does suspect it's the last time she'll ever see him, that doesn't stop her from being surprised that it's the first time he ever saw her.
Ugh, the tenses and timelines in this answer! Enough to make anyone's head spin.
The implications of meeting a younger Doctor didn't immediately set in.
When she sent the message to the Doctor's psychic paper, she was expecting it to go to a different incarnation of the Doctor. She was likely expecting 11 or 12, as those were the only incarnations she had known at that point, and was surprised that she got 10 instead. It didn't immediately occur to her what that might mean.
As Rand Al'Thor pointed out, all she knew was that Darillium was their "Last Night Together", which doesn't necessarily imply that there will be no further meetings. While meeting 10 was a novelty, she still expected it to be just another such meeting:
The Doctor: For what?
River: The usual. For coming when I call.
The Doctor: That was you?
River: You're doing a very good job acting like you don't know me. I'm assuming there's a reason.
The Doctor: Oh, a fairly good one actually.
River: Okay, should we do diaries then? [pulls out a journal] Where are we this time? Ah, going by your face I'd say it's early days for you, yeah? So, um... Crash of the Byzantium. Have we done that yet? [the Doctor's face is blank] ...Obviously ringing no bells. Alright, um. Picnic at Asgard, Have we done Asgard yet? [again, no reaction from the Doctor] ...Obviously not. Blimey, very early days then. Oo! Life with a time traveller, never knew it could be such hard work. Um... [stops, and really looks at him] Look at you. You're young.
Only now does she start to realize. Her expression changes as the exchange continues:
The Doctor: I'm really not, you know.
River: Oh but you are. Your eyes! You're younger than I've ever seen you.
Finally, comprehension dawns, and her heart shatters as she realizes that the love of her life doesn't know her:
The Doctor: You've seen me before then?
River: [pause] Doctor, please tell me you know who I am.
The Doctor: ...Who are you?
[River looks heartbroken]
She knew the day would come, and said as much in The Impossible Astronaut:
River: The day’s coming when I’ll look into that man’s eyes—my Doctor—and he won’t have the faintest idea who I am. And I think it’s going to kill me.
tl;dr: Despite the night on Darillium, she expected this to be just another adventure. She thought she would have more time before the day she dreaded came, and probably held out a sliver of hope that her clever Doctor would find a way around it. Her initial pleasant surprise at meeting a younger Doctor quickly faded as she realized that wouldn't be happening. (Damn you, Moffat!)