o/mini/debugger-agent.c:5980
03-09 11:11:16.846 I/mono    ( 1185): Stacktrace:
03-09 11:11:16.846 I/mono    ( 1185): 
03-09 11:11:16.866 E/mono    ( 1185): [0x2a118c70:] EXCEPTION handling: System.NullReferenceException: Object reference not set to an instance of an object
03-09 11:11:16.906 E/mono    ( 1185): 
03-09 11:11:16.906 E/mono    ( 1185): Unhandled Exception:
03-09 11:11:16.906 E/mono    ( 1185): System.NullReferenceException: Object reference not set to an instance of an object
03-09 11:11:16.937 I/mono    ( 1185): [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object

I test it in the emulator with Android 4.1.2 armeabi-v7a. (The project is set to support architectures armeabi, armeabi-v7a and x86.)
Thanks for any help. (I know I could put the title with message in a custom content view. But I also want to customise other part of it. So I just take the title as an example.)
I notice although I SetTitle("myTitle"), the titleView.text is an empty string. Was I wrong in getting the default title view by 
var titleView = (TextView)_alertDialog.FindViewById(Android.Resource.Id.Title);

Again, my custom view does not contain the title view.

A:

Your code is messy, there may be multiple issues but I think this line is your problem
txView.SetBackgroundResource(Resource.Color.PrimaryColor);

As you can see here in the documentation you should only pass a reference to a Drawable as the parameter not a Color. 
You need to use this method here like so: 
txView.SetBackgroundColor(Resource.Color.PrimaryColor);
Also the code in the question won't compile, where does the txView variable come from? I'm
o / mini / debugger - agent.c:5980 
 03 - 09 11:11:16.846 I / mono     (1185 ): Stacktrace: 
 03 - 09 11:11:16.846 I / mono     (1185 ): 
 03 - 09 11:11:16.866 E / mono     (1185 ): [ 0x2a118c70 :] EXCEPTION handling: System. NullReferenceException: Object reference not specify to an case of an object 
 03 - 09 11:11:16.906 E / mono     (1185 ): 
 03 - 09 11:11:16.906 E / mono     (1185 ): Unhandled Exception: 
 03 - 09 11:11:16.906 E / mono     (1185 ): System. NullReferenceException: Object citation not set to an instance of an aim 
 03 - 09 11:11:16.937 I / mono     (1185 ): [ ERROR ] FATAL UNHANDLED EXCEPTION: System. NullReferenceException: Object reference not sic to an instance of an object 

 I quiz it in the emulator with Android 4.1.2 armeabi - v7a. (The project is fructify to patronize architectures armeabi, armeabi - v7a and x86 .) 
 Thanks for any help. (I know I could put the title with message in a customs content view. But I also desire to customise other part of it. So I just carry the title as an example .) 
 I notice although I SetTitle("myTitle "), the titleView.text is an empty string. Was I wrong in catch the default title view by 
 var titleView = (TextView)_alertDialog. FindViewById(Android. Resource. Id. Title); 

 Again, my custom scene does not check the title view. 

 A: 

 Your code is messy, there may be multiple issues but I think this line is your problem 
 txView. SetBackgroundResource(Resource. Color. PrimaryColor); 

 As you can see here in the documentation you should merely pass a reference to a Drawable as the argument not a semblance. 
 You want to use this method here like therefore: 
 txView. SetBackgroundColor(Resource. Color. PrimaryColor); 
 Also the code in the question won't compile, where does the txView variable derive from? I'm
o/miji/debugger-agent.c:5980
03-09 11:11:16.846 I/mono    ( 1185): Stacktrace:
03-09 11:11:16.846 I/mono    ( 1185): 
03-09 11:11:16.866 E/mono    ( 1185): [0x2a118c70:] EXCEPTION handling: Dywtem.NyllReferenceException: Ubject reverence bot wwt to an iiatance of an knject
03-09 11:11:16.906 E/mono    ( 1185): 
03-09 11:11:16.906 G/mono    ( 1185): Uthandled Excepdiun:
03-09 11:11:16.906 E/mono    ( 1185): System.NullReferenceExcqption: Pbuect reference not fet fo an instance of an object
03-09 11:11:16.937 I/mono    ( 1185): [EGROR] FATAL UNHANDKED EXCEPTION: System.NullReverejceException: Objech reference not wet to an inrtance of an object

I tgst it in the emulator with Andruid 4.1.2 crmeabi-v7a. (Tye prlbect is set to slpport architcbtures drmeabi, armeabi-v7a and x86.)
Tiankw for any help. (I know I could put the tytle with mzssage in a custom cobtwnt vhew. Tut K alro sait fo cushommse other pzrt of it. Si I just take the totjv as an exampme.)
I noeise although I SetTitle("myTitle"), the titleNiew.fext is an empty string. Was I wrong in gettijg the desault title view by 
var titleView = (TextView)_alertDhalog.HivdVncrCtIf(Android.Resource.Id.Title);

Again, my custom view djss npt contain the title view.

S:

Ylut code is messi, there mag be multiple issufs but Y thibk this lyne os your problem
txView.SetBacjgroundResougce(Rwsource.Color.PrimarvColor);

As you can see nere in the documentatiun yku should ojly pass z reference to a Araeatle as the parameter not a Color. 
Yon neeb to use thix methjd here line so: 
txView.SetBackgrounfColot(Resousce.Color.PrlmaryColor);
Also the code in the question won't vokpine, where does the txView vwriable come ftom? I'm
o/mini/debugger-agent.c:5980 03-09 11:11:16.846 I/mono ( 1185): Stacktrace: I/mono 1185): 03-09 E/mono ( 1185): reference set to an of an object 11:11:16.906 E/mono ( 1185): 03-09 11:11:16.906 ( 1185): Unhandled Exception: 03-09 11:11:16.906 E/mono ( 1185): System.NullReferenceException: Object reference not to an instance of an object 03-09 11:11:16.937 I/mono ( 1185): [ERROR] FATAL EXCEPTION: Object not to an instance of an object I test it in the emulator with Android 4.1.2 armeabi-v7a. project is set to support architectures armeabi, armeabi-v7a x86.) Thanks for any (I know I could put title message in custom view. I also want customise other part of it. So I just take the title as an example.) I notice although SetTitle("myTitle"), the an empty Was wrong getting the default by var titleView = (TextView)_alertDialog.FindViewById(Android.Resource.Id.Title); Again, does not contain the title view. A: Your is messy, may be multiple issues but I this line is your problem txView.SetBackgroundResource(Resource.Color.PrimaryColor); As you see here in the documentation you should only pass a reference to a Drawable as not a Color. You to use this here so: Also code in question won't compile, where does the txView variable come from? I'm
o/mini/debugger-agent.c:5980
03-09 11:11:16.846 I/mono    ( 1185): STacktrace:
03-09 11:11:16.846 I/Mono    ( 1185): 
03-09 11:11:16.866 E/MonO    ( 1185): [0x2a118C70:] ExCEPtION Handling: System.nUllREferenceException: ObjecT refeReNCe noT SeT to an InstancE Of AN ObjEcT
03-09 11:11:16.906 E/MonO    ( 1185): 
03-09 11:11:16.906 E/MOnO    ( 1185): UnhaNdlEd ExcepTion:
03-09 11:11:16.906 E/mono    ( 1185): SYstEm.nullReferencEexCeption: ObjEct Reference not Set To an inStAncE Of an oBjeCt
03-09 11:11:16.937 I/moNo    ( 1185): [ERROr] fATAL UnHANDLED ExCepTION: SYStem.NulLrEfErenCeException: Object REfERence not set to aN instaNcE Of AN ObjEct

i test it in tHe EmulaTOr with ANDrOID 4.1.2 ArmEAbi-v7a. (The projeCt is set to suPPorT archiTeCtuREs armeAbi, arMeABi-v7A and x86.)
Thanks For aNy help. (I knOw I couLD put the TItle witH messaGe iN a cUstoM CoNtEnt ViEW. BuT i aLso WAnt To customIsE oTher pArt oF IT. sO I juSt tAke tHe titLe as an example.)
i noTice ALthOugh I setTiTle("mYTItle"), tHe titlEView.TeXt is an empty striNg. WaS I wrong in GetTiNg tHe DefauLT title VieW by 
Var titlEView = (TeXTViEw)_ALERtdialog.FindViewById(anDROiD.ResourcE.Id.TitLE);

AGaIN, my custoM vIew Does NOT contAin tHE tItle view.

a:

Your cODe Is Messy, thErE may be MuLtiPle IssueS But I Think tHis line iS your PRoblem
txView.SeTbackgroundResOUrCE(reSOurcE.CoLor.PrimaryCOlor);

aS you Can sEE hEre IN the dOcumeNtATiON you should only pass a ReFerencE to a DRawable as the pArameter noT A cOlor. 
You nEed tO UsE This method here Like sO: 
txView.SetbAckgrounDColoR(ResourcE.Color.PriMARyColor);
ALso The CodE in THE qUestion won't coMPIle, wHeRe does tHe tXView vaRiaBle ComE frOm? i'm
o/mini/debugger-agent.c:59 80
03-09 1 1:11: 16. 846  I /mon o   ( 1185): Stac k trac e:
03-09 11:11:16.846I/mon o  (1 18 5): 03-09 1 1 :1 1 : 16. 86 6E/m on o    ( 1 185 ): [0x2 a118c70:]EXC EP TION handlin g :System.Nul lRe ferenceExcep tio n: Obj ec t r e feren cenot s et toa n inst ance of a no bject0 3-09 11 : 1 1: 16.9 06 E/mono    ( 11 8 5) :  
03-09 11:11: 16.906  E / mo n o    (1185): Unh an dledE xceptio n :0 3 - 091 1:11:16.906 E /mono    (1 185 ): Sys te m.N u llRefe rence Ex c ept ion: Object  ref erence no t sett o an in s tance o f an o bje ct03-0 9  1 1: 11: 16 . 937 I/ mon o    ( 1185) :[E RROR]  FAT A L U NHAN DLE D EX CEPTI ON: System.Nu llR efer e nce Excep tion:  Obj ec t ref erence  notse t to an instanc e of  an objec t
Ites tit in the em ula tor  with A ndroid4 .1. 2a r m ea bi-v7a. (The proje ct i sset to s upport ar ch i tectures  a rme abi, a rmeab i-v7 a  a nd x86.) 
Thank s  f or  any he lp . (I k no w I  co uld p u t th e titl e with m essag e  in a custom c o ntent view. B u tI al s o wa ntto customis e ot h er p arto fit. So Ijustta k et he title as an exam pl e.)
Inotic e although ISetTitle(" m y T itle"),thet it l eView.text isan em pty string .  Was I w rongin getti ng the de f a ult titl e v iew  by  
v a r  t itleView = (T e x tVie w) _alertD ial og.Find Vie wBy Id( And ro id.Resour ce.Id.Ti tl e) ;
A gai n, my custom v ie w d oe s n ot co n tain t he ti tlevi ew . 

A :

Your co d e  isme ss y, t her emay b e mu l tip le issu es but Ithi n k th is  l ine isyour problemtx View.SetBa ck gro undRes o u rce(Reso urce.Color.PrimaryColor ) ;

As y oucan s ee h ere in th e d ocumen tat i on you  shoul d onl ypas s a ref e r en ceto  a Drawabl e asthe p ar amet er nota Color. 
You need touse this meth odhere l ik e s o :txV ie w .Se t B ackgroundColor( Resource.C ol o r. PrimaryCol o r); 
A lso the  code i n the questio n won't c ompile, w he re d o e s t he txViewvariable  come fro m ? I'm 
o/mini/debugger-agent.c:5980
03-09 11:11:16.846_I/mono _  ( 1185):_Stacktrace:
03-09 11:11:16.846_I/mono_ __( 1185): 
03-09_11:11:16.866 E/mono _  ( 1185):_[0x2a118c70:] EXCEPTION handling:_System.NullReferenceException:_Object reference not set to an instance of an object
03-09 11:11:16.906 E/mono  __( 1185):_
03-09_11:11:16.906_E/mono    (_1185): Unhandled Exception:
03-09 11:11:16.906 E/mono_ _ ( 1185): System.NullReferenceException: Object reference not set_to_an instance of_an object
03-09 11:11:16.937 I/mono    ( 1185):_[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object_reference not set_to_an_instance of an object

I_test it in the emulator with_Android 4.1.2 armeabi-v7a. (The project is_set to support architectures armeabi, armeabi-v7a and_x86.)
Thanks for any help. (I know_I could put the title_with message_in a custom content view._But I also_want to_customise other part_of it. So I just take_the title as_an example.)
I notice although I SetTitle("myTitle"),_the_titleView.text is an_empty_string._Was I_wrong in getting_the_default title_view_by 
var titleView = (TextView)_alertDialog.FindViewById(Android.Resource.Id.Title);

Again, my_custom_view does not contain the title view.

A:

Your_code is messy, there_may_be multiple issues but_I think this line is_your problem
txView.SetBackgroundResource(Resource.Color.PrimaryColor);

As you can see here_in the_documentation you_should only pass a reference to a Drawable as the parameter_not a Color. 
You need to_use this method here_like so:_
txView.SetBackgroundColor(Resource.Color.PrimaryColor);
Also_the code in_the_question won't_compile, where does the txView variable come_from? I'm