Попробуйте поставить точку останова и посмотрите, что раздаточный материал равен
If Not _class1.Contains("---") Then
''# Put a breakpoint on the next line
Dim breakVariable = handout1
''# when the breakpoint fires, inspect the value of `handout1`
_body = _body.Replace("[[Class1]]", _class1 + " : " + _day1Class.course_title)
Dim _coursesREF As cours = db.courses.Where(Function(f) f.course_ref = class1).First
If Not String.IsNullOrWhiteSpace(_coursesREF.handoutFile1) OrElse Not IsDBNull(_coursesREF.handoutFile1) Then
_class1Handout = New Net.Mail.Attachment((Path.Combine(AppDomain.CurrentDomain.BaseDirectory) + "\CourseHandouts\") + _coursesREF.handoutFile1)
End If
Else
_body = _body.Replace("[[NL]][[Class1]]", String.Empty)
End If
также, при дальнейшей проверке, вы можете изменить
If Not String.IsNullOrWhiteSpace(_coursesREF.handoutFile1) OrElse
Not IsDBNull(_coursesREF.handoutFile1) Then
и измените его на
If Not String.IsNullOrWhiteSpace(_coursesREF.handoutFile1) AndAlso
Not(_coursesREF.handoutFile1 Is Nothing) Then