Surfing the Croatia

If you are an Internet addict and can’t live without it even on vacation in Croatia then here is a cheap solution. Forget about roaming because it is insanely expensive (the stupid discussions in EU were all about SMS prices, not a word on data connection prices, though it wouldn’t matter in Croatia anyway). Luckily there is VIP mobile provider which offers prepaid data plans which are not expensive at all – compared to roaming that is. Here is what you need:

1. Check VIP coverage of the are you are going – coverage map. I was on the “edge” of HSDPA – thus I had to use Edge.

2. Next, find a VIP points of sale for VIP broadband SIM card. It should list Vipme under offers I think. Note: not all points of sales have those, specially smaller ones.

3. When in Croatia, find selected point of sale and buy a Vipme broadband box (SIM card only – 20 HRK*) or Vipme Broadband USB stick (149 HRK) if you have a laptop. Since I have a WiFi tethering enabled Android Samsung Galaxy S phone I went with former. 20 HRK were automatically added to my account as well.

4. The default data price is 1 MB/1 HRK which is still expensive. That’s why you should go with options:

  • 50 MB/25 HRK
  • 300 MB/91 HRK
  • 1 GB/191 HRK

5. Once you’ve picked an option that suits you (I went with 300MB/91 HRK which I’ve planned to consume in 10 days) you have to buy enough coupons. In my case I had to buy a coupon for 100 HRK. Perhaps I could buy 20 less but I wanted to be on the safe side. Note that an option is valid for 30 days or something like that, not sure about coupons.

6. Put the SIM into the phone and create an APN**: data.vip.hr. Here I had some problems with my phone, finally I’ve found a working combination – add APN, save it, restart the phone. Not sure what went wrong though, I just played with restarts and APNs until it started working.

7. Open internet browser and go to http://vipmevmc.vipnet.hr (remember that you are using 1 MB/1 HRK at this point). Enter you coupon code, so 100 HRKs are added to the account. Activate the 300MB option (or whicever you want) through the website as well. After I’ve confirmed my option I was notified that the option is going to be enabled within a working day, but in reallity it was activated in an hour or less.

8. That’s it. I was fully internet connected at this point. Then I enabled Mobile AP feature of my Samsung Galaxy S which does tethering over WiFi - Saša’s iPhone and laptops were connected without any problem through WiFi.

Happy surfing in Croatia

* HRK to EUR converter (other currencies supported)

** Full APN specs:

Name: Internet
APN: data.vip.hr
Proxy: 212.91.99.91
Port: 8080
Username: not set
Password: not set
Server: not set
MMSC: not set
MMSC proxy: not set
MMS port: not set
MMC: 219
MNC: 10
APN type: Internet
Authentification Type: None

Vtisi o HTC Desire Android napravi (Slovene)

Že nekaj časa spremljam Android telefone na spletu vendar zares nisem imel opravka še z nobenim. Največ kar je, sem si ogledal na hitro kakšen prijateljev telefon. No, zadnje čase malo resneje premišljujem da bi si nabavil enega zase – se mi zdi, da je Android že kar uporaben. Pa sem dokaj nepričakovano dobil priložnost testirat enega izmed njih. Jure iz Mobitela mi je prijazno poslal telefon HTC Desire za testiranje za obdobje dva tedna. HTC Desire je dvojček Googlovega Nexus One – referenčnega telefona Android, ki ga prav tako izdeluje HTC. Za razliko od Nexusa One, Desire nima odpravljanja šuma mikrofona med telefoniranjem, ima pa ščepec več pomnilnika RAM (567MB vs 512MB) – kar pri Androidu, ki vse programe tlači kar v pomnilnik, ni tako zanemarljivo (Froyo naj bi odpravil to omejitev) pa še sledilno kroglico so zamenjali z, zame neuporabnim sledilnikom prsta in gumbe na zaslonu s pravimi fizičnimi gumbi. Pa še kakšna razlika bi se našla.

Za začetek naj povem, da nisem pretiran oboževalec HTCja. Prej nasprotno. Moja najslabša iskušnja z njimi sega nazaj v čas Windows Mobile 6.x in HTC TyTN II telefona. Sicer spodobna stvar (strojna oprema) na papirju, celo grafični pospeševalec je dosegal kakšne 3/4 ravni iPhona. In potem razočaranje. HTC je “pozabil” priložiti grafični gonilnik, brez katerega je bil grafični pospeševalnik manj uporaben kot superračunalnik brez elektrike. Uraden odgovor HTCja na jezo tisočih uporabnikov: “Ah, dejte no, sej nismo nikoli eksplicitno obljubili grafičnega pospeševanja, če ga hočete, si kupite naš nov XY aparat, kjer je to obljubljeno”. Kar me privede do druge zamere HTCju. Non stop proizvajajo nove modele, na stare pa hitro pozabijo. Hja, vse za čim večji dobiček, saj vzdrževanje starih modelov ne prinaša direktnega dobička. To je še posebej veljalo v času Windows Mobile, zdaj je morda malo, ampak res malo, bolje. Ta pristop me še najbolj spominja na tisti vic o neskončnem številu opic, ki jih postaviš pred tipkovnico in ena prej ali slej napiše Hamleta – tako HTC proizvaja morje novih in novih modelov v upanju, da bo kakšen le uporaben. Za kontrast si poglejte Apple, ki skrbi za svoje 3(!) različne iPhone še zdaj, edino prvega ne bo več podpiral s prihajajočim iPhone 4 OS.

Moja merila za Android telefon:

  • ne sme imeti lasten uporabniški vmesnik. Zakaj? Preprosto, ker potem se bo podjetje izgovarjalo, da ne more posodobiti operacijskega sistema, ker je posodobitev lastnega uporabniškega vmesnika zahtevno opravilo.
  • nalagalnik (bootloader) mora biti odklenjen. Zakaj? Zato, da lahko naložimo drugo verzijo OS in nam ni potrebno čakati na proizvajalca (glej zgoraj). Na svetu je kar nekaj ljudi, ki sestavlja verzije po meri in te so večinoma ljudem dostopne in boljše kot proizvajalčeve. Ko se proizvajalec naveliča posodabljati telefon, je to edina možnost za nadgradnjo.
  • spodobna baterija, ki omogoča vsaj dan nezahtevnega dela.
  • vsaj 480x800 zaslon, čim večji, tem bolje.
  • že se le da brez fizične tipkovnice, ker ta naredi telefon večji in težji.
  • WiFi, Bluetooth in 3G.
  • fotoaparat, ki zna narediti spodobno sliko (za nujne primere, ko ni pravega pri roki).

Kar sledi ne bo nek strokoven opis, ampak zgolj moje dvotedenske uporabniške izkušnje, s poudarkom na stvareh, ki mi niso všeč. Konec koncev nam nadležne in neuporabne stvari veliko povedo o uporabnosti telefona, mar ne? Telefon je lahko še tako dober, toda če ima napako, ki ga naredi neuporabnega, vse njegove dobre strani niso vredne nič.

In kaj sem ugotovil po dveh tednih uporabe?

No, za začetek bi si želel malo več časa, dva tedna nista ravno dovolj za kakšen poglobljen vtis. Prvi vtisi so pozitivni, ohišje je spodobno in lepo ga lahko spravim v stranski hlačni žep, zaslon lepo sije v živi barvi in stvar je spodobno hitra. Konec koncev ima 1Ghz procesor Snapdragon. Za namestitev SIM kartice je potrebno odpreti zadnji del ohišja in odstraniti baterijo. Mimogrede, zraven je še (tovarniško priložena) Micro SD kartica velikosti 4GB. Klik klik - in če je baterija polna, je telefon pripravljen na uporabo.

Operacijski sistem je aktualni Android 2.1 Eclair in je “onesnažen” s HTC Sense uporabniškim vmesnikom, kar bo zelo verjetno dober izgovor, da bomo na Froyo-ta (Android 2.2, ki na trg prihaja te dni) čakali dosti časa. HTC je sicer izjavil, da lahko pričakujem Froyo-ta za letošnje njihove modele nekje proti koncu leta. Za starejše modele pa se ne ve, kar zelo verjetno pomeni sredinec roke uporabnikom. Ste pomislili, da bo Desire naslednje leto lanski model? In – da ne bo pomote - Froyo ni bistveno (če sploh je) zahtevnejši kot Eclair. Da so to zgolj pohlepni marketinški nameni nam pove dejstvo, da so ljudje celo uspeli G1 (letnik 2008) posodobiti na Eclair. No, na srečo se menda da dobiti dostop do superuser pravic (root) in tako zaobiti neumne omejitve – na lastno odgovornost in izgubo garancije seveda. Kakorkoli, HTC Sense mi deluje precej nepotrebno, mogoče ima nekaj koristnih delov – npr. Flash, deljenje internet povezave preko USB kabla (USB tethering), pa še to ne bo več potrebno s prihodom Froyo-ta. Vremenski del je ravno tako neuporaben, ker v Sloveniji podpira le Ljubljano. Zastonj Weatherbug je precej spodobnejši. Skratka, HTC Sense uporabniški vmesnik je bolj nonsense.

Zaslon je 480x800 3,7 palčni AMOLED, kar pomeni, da naj bi imel boljše barve kot klasičen LCD. In res je lepo gledat vse te žive barve, le na soncu je skoraj neuporaben zaradi odseva. Ima pa tudi eno grdo skrivnost, ki jo neradi oglašujejo, oziroma je sploh ne. Za razliko od navadnih zaslonov, pri katerih ima vsaka pika na zaslonu vse tri barvne komponent (RGB – rdeča, modra, zelena) jih ima Desirejev samo dve, kar je odkril Luke Hutchison na ars technica  (vezano je na Nexus One, ampak Desire je dvojček z istim zaslonom). Ja, vsaka pika ima zeleno komponento, medtem ko se rdeča in modra izmenjujeta.

imageDesire, bela podlaga in črn tekst: lepo se vidi izmenično rdečo in modro, zelena pa je konstantna

image

TyTN II, bela podlaga in črn tekst: vsaka pika ima RGB komponente

Za natančnejši opis te packarije si poglej hiperpovezavo. Razultat? Bolj spackan in slabše čitljiv tekst ter slab občutek v želodcu, ker nas HTC vsaj zavaja, če že ne laže. In pazite - to pri napravi, ki je v prosti prodaji vredna okoli 600€. Obstaja tudi tretja razlaga, da HTC svoje zaslone pač meri v HTC pikah, ne pa kot vsi drugi, v RGB pikah. Očitno HTC kar ne more iz svoje kože in na račun kvalitete malce prireja specifikacije. Vse za dobiček, mar ne.

Drugi problem povezan z zaslonom je večdotičnost (multitouch). Večdotičnost na Desireju je spet en poceni klump, ki deluje samo do neke mere, to je, dokler nista prsta blizu ali na isti osi. Večinoma te hibe med vsakdanjim delom človek niti ne opazi (večinoma uporabljamo samo en prst). Ampak če igramo igrice ali vrtimo kakšne slike, itd., pa zna biti prav moteče. Več si oglejte na tej povezavi, program s katerim omenjeno pomanjkljivost lahko sami testirate pa zastonj dobite na Android tržnici pod imenom Multitouch Visible Test. Spet poceni HTC bližnjica.

1400mAh baterija je prešibka za takole strojno opremo in ne zdrži niti cel dan. Da se popravim, ne zdrži niti cel dan ob relativno nezahtevnem delu, kot je občasno prebiranje e-pošte, Twitterja in Facebooka, kar smatram kot minimum opravil. Ves čas sem imel vklopljen tako bluetooth kot WiFi. Če človek zraven zaigra še kako igro tu in tam in kaj potelefonira, vam telefon crkne prej kot v pol dneva. Mogoče se da baterijo varčevati s kakimi dodatnimi programi, ki izklapljajo bluetooth, ko ni telefonskega klica ali kaj podobnega, ne vem.

1GHz Qualcomm Snapdragon procesor je dovolj hiter, stranski produkt te hitrosti je občasno znatno segrevanje aparata. Froyo pa naj bi delovanje še dodatno bistveno pospešil s programskimi optimizacijami.

Bluetooth sem uporabljal v kombinaciji s Jabra BT530 slušalko in delalo je v redu. Z WiFi-jem prav tako nisem imel problemov, mogoče edinole nima ravno nekega dobrega dometa. Telefonski del deluje brez problema, kompas še kar, merilec pospeška tudi.

Sem pa imel probleme s priloženim odjemalcem za e-pošto (del HTC Sense). Za e-pošto uporabljam exchange strežnik. Največji problem na katerega sem naletel je bil ta, da mi občasno pošte ni in ni hotel poslati in to brez opisa vzroka napake – enostavno jamra, da je težava pri pošiljanju. Večinoma je v roku enega dneva pošto vseeno odpremil. Neugodno, če ti gori hiša in po e-pošti kliceš gasilce na pomoč. Poleg tega me odjemalec ne obvesti, če pride pošta v mapo, ki ni Inbox. Klasičen nedodelan HTCjev program. Bi vsaj pustili Googlov e-mail, ki zgleda bolj uporaben, vsaj meni – je pa res, da ga nisem testiral.

Najhuje kar se mi je tekom testiranja zgodilo, je bila avtodestrukcija SD kartice. Si predstavljate film Mission Impossible: “Tole sporočilo se bo uničilo v roku 5 sekund”? Začelo se je tako, da sem nekega dne spet imel problem s pošiljanjem e-pošte in sem se odločil, da ga poskušam reštartat (reštart je večinoma magična rešitev za večino problemov, če ne deluje, ga pač večkrat ponoviš). Power Off in že po 53ih sekundah je pravilno mrknil. Klik in kakšnih 55 sekund kasneje mi je ponosno javil: “Blank SD card, SD card blank or has unsupported filesystem”. Hua. Kar tako. Še dobro, da nisem imel kaj vrednega gor. Sem poskušal formatirat, pa se ni nič zgodilo. Čudno. Sem dal kartico ven iz telefona in v moj čitalec SD kartic in tudi nič, kot da kartica ni prisotna. Huh? In očitno nisem edini, ki je naletel na to samodestrukcijo. Android Forums in XDA forums imajo podobne in enake probleme (pa še na drugih forumih imajo podobna sporočila). Glede na to, da ljudje javljajo probleme na različnih SD karticah, bi se dalo sklepat, da je nekaj narobe s telefonom. Auč. Si predstavljate tajvansko ruleto: “Daš v Desire SD kartico in če preživi vklop telefona, greš v naslednji krog”?

Povzetek

Kaj pa vem. Meni se tale Desire še vedno zdi, kot pravi HTC izdelek, kjer namečejo noter en kup tehnologije, uberejo bljižnjice in stvar čimprej izstrelijo na tržišče, prodajo čim več in potem pozabijo na reševanje težav. Zraven pa jih še srbijo prsti in si ne morejo kaj, da ne bi napisali svojega vmesnika, uporabnik pa nima možnosti izbire. Je pač tako, da se ljudje delimo na tiste, katerim je HTC Sense všeč in tiste, ki se nam zdi bolj brezveze, pa še nove verzije OS pridejo z ogromnim zamikom zaradi teh dodatnih uporabniških vmesnikov, če sploh pridejo. Desire ima vsaj to prednost, da je dvojček Nexusa One, Googlovega otroka. To pomeni, da bo Google nove verzije najprej priredil za Nexus One in HTC ne bo imel veliko dela. Samo HTC Sense bo potrebno prenesti in že bo kako leto naokoli. Tako npr. uporabniki HTC Hero-ta čakajo na nadgraditve predpotopnega Androida 1.5 že več kot sedem mesecev. Bomo videli, če bodo pri Froyo-vemu Desiru kaj hitrejši (konec leta obeta spet čakanje in čakanje).

Če lahko živite z omenjenimi problemi ter ste se sprijaznili, da vas HTC zavaja, potem vam je telefon lahko celo všeč. Zase vem, da ga ne bom kupil. So mi naštete pomanjkljivosti prehude, da bi žrtvoval kup denarja. Si bom raje še ogledal Motorolinega Milestona ali pa počakal na kaj bolj meni prijaznega.

Getting HRESULT: 0x80131515 when running Righthand DataSet Visualizer?

Are you getting a HRESULT: 0x80131515 when invoking Righthand DataSet Visualizer from Visual Studio like this:

image_thumb11[4]

The problem is that OS marked the visualizer assembly as unsecure since it originated from the Internet. The solution to the problem is an easy one.

Locate the Righthand.DebuggerVisualizer.Dataset.2010.dll within File Explorer, right click to get Properties and click on Unblock button:

HRESULT: 0x80131515 error dialog

Happy DataSet/DataTable visualization!

What’s new in C# 4.0 presentation at NTK 2010 in Portorož

Tomorrow I am talking about new features in C# 4.0 at NT Konferenca in Portorož, Slovenia and I’ll be there through all day. So if you want to hear what features were added to C# in its latest incarnation you are welcome to attend the presentation taking place in Emerald 1, 14:45 - 16:00.

Later I’ll participate in MVP Panel in MSTech (Pečina), 16:30 - 17:30 and as a SLODUG lead I’ll be present at SloUG meeting in Sunset, 17:30 as well.

If you just want to talk about something .net-ish or just want to say hi, feel free to find me as I’ll be lurking around during my free time.

BTW, the official NT Konferenca twitter tag is #ntk10.

Righthand DataSet Visualizer now supports Visual Studio 2010

New in 0.9.16: added support for Visual Studio 2010 and updated user interface a bit. As before, everything is merged into a single dll file which is also digitally signed now.

Thanks RedGate {smartassembly} obfuscator tool for merging everything into a single DLL (ILMerge and another 3rd tool failed in this task). So far, I can only praise {smartassembly}.

Read more about Righthand DataSet Visualizer here.

Download the newest and older versions from download section.

Enjoy, and let me know whether you miss features or if you have any other feedback, good or bad.

Visual Studio 2010 and .net 4.0 are being released today

Today is the day. See Soma’s announcement and prepare your browsers pointed to MSDN Subscriber Downloads. The goods should be available for download starting at 10AM PST which translates to 19:00 for Slovenia (you might check out other local times).

Also watch the Visual Studio 2010 launch event live here.

Some useful links:

An annoying non-persistent memory leak in .net framework MDI

I had to investigate a memory leak in an application I am building for my client. It is a MDI application using DevExpress XtraTabbedMdiManager that provides some MDI eyecandy. Anyway, I’ve used ANTS Memory Profiler (an excellent profiler, highly recommended) for my mission. I have soon found the cause of the true memory leak, which wasn’t an actual memory leak but rather a feature of the application – it was logging events in the memory.

One thing puzzled me though. I’ve tried this scenario. Take a memory snapshot, open a MDI child form, close it and take another snapshot. There shouldn’t be any memory leak, should it? But it was. ANTS Memory Profiler reported that the form wasn’t disposed and still held in memory. So I went looking at the Object Retention Graph for the form in question only to see this image (sensitive namespace is removed in Paint.net):

leak

Is is pretty much obvious that there are two references holding my should-be-disposed form. One is from InternalAccessibleObject and the other one is from Form.PropertyStore. Neither is caused by application’s code. So, what’s going on? It turns out that this is a feature of .net framework MDI and not a real memory leak – it stores the last reference of the active MDI child form or something like that and thus the last form isn’t released. If you repeat the open form/close step the memory leak shouldn’t increase. In fact even the memory leak from the first step is cured.

Even though it is not a true memory leak it is a distractive feature when it comes to memory profiling – for any .net memory profiler, not just ANTS. I guess only experience helps you with these kind of distractions when hunting for a real memory leak.

See also this thread in ANTS Memory Profiler support forum.

My first WPF 4.0/Windows 7 multitouch application

So I finally bought an Acer T230H multitouch enabled monitor that is supported by Windows 7. Actually, it is a dual touch but that’s enough. (for more on multitouch input devices for Windows 7 see my previous article).

On the good side it is a decent 1900x1080 monitor, not too expensive and multitouch works even under VMWare Workstation 7. On the bad side I knew it has some problems following fingers. Actually sometimes it gets just confused. That’s not a problem for a project I am working on but nevertheless I was curious.

Hence I created my first multitouch application that visualizes touch positions from monitor. Here is a screenshot featuring two fingers:

image

The application itself supports two different colors because I was interested only in two (no problem adding more if somebody wants me to). So, try the application and see how good or bad does your multitouch input device. Note, .net framework 4.0 RC is required.

As per my Acer T230H: indeed it has problems that usually manifest when fingers are nearby. And sometimes it just gets confused. Heck, it is one of the first multitouch monitors and a cheap one.

Have fun multitouching!

Multitouch development on Windows 7

I’ll be developing a multitouch application in WPF 4.0 running on Windows 7 and using Windows 7 native multitouch (supported in WPF 4.0) running in portrait mode. Dual finger touch should be enough. I have all the tools handy except for one: a multitouch input device aka multitouch monitor. So I am looking around for it and have found these options so far:

Bamboo Fun tablet

Last year I’ve bought a Bamboo Fun pen & touch tablet from Wacom. It supports both stylus and two finger touch input. I’ve assumed it will work natively with Windows 7. But it doesn’t. The core problem is that Bamboo has a relative touch positioning while Windows 7 requires absolute positioning – in other words Bamboo doesn’t know where your fingers are until you touch its surface. Furthermore Wacom decided to provide support through a generic driver to other OS beside Windows 7 and thus no Windows 7 native support is provided at this point in time. Disappointing.

Multitouch monitor

The most logical choice would be a multitouch enabled monitor. Heck, Windows 7 has been around for a while now (including beta and RC period) and there should be plenty of such monitors. At least that’s why I thought. Wrong again. There are some choices though. All of these supports Windows 7 native multitouch.

Acer T230H

A 23” 1920x1080 widescreen monitor from Acer. It supports dual touch through a some sort of simple mechanism using cameras. Has problems when you cross fingers or something like that. Not a huge problem in my case. But it has no pivot feature. I guess I’ll just put in horizontal portrait position on my desk or somewhere near. Despite these shortcomings this is my first choice at this point. The price tag is around 300€.

Dell SX2210T

A 21.5” 1920x1080 widescreen monitor from Dell. Smaller, slightly more expensive, dual-touch and no pivot as well.

Compaq L2105tm

The most hidden of the three. Similar to Dell’s one: 21.5” 1920x1080, no pivot. Couldn’t find it in EU so I am not sure about the price but in US is probably cheaper compared to Dell’s.

3M Multitouch developer kit

This one is interesting. A 19” 1440x900 monitor with support for up to 10 finger multi touch input. Looks like a perfect choice if it wasn’t for its price which is listed as $1.499 in US. I assume this is translated to >1.499€ for the EU. Ouch. Yet, this is the only multi-touch display that supports more than two fingers input.

Tablet PC

As an alternative to a proper monitor I might consider a tabled PC such as Dell Latitude XT2 or Acer AS5738PG-6306. First one is expensive and not exactly a development-grade fast machine, yet is a good quality product. The later is much cheaper and perhaps faster but has one fatal flaw in my case: the screen doesn’t rotate to “tablet” position and as such it won’t work in portrait mode. Furthermore touching the screen looks kind of problematic since you can easily flip it (imagine touching a standard laptop). Both laptops feature an integrated graphic card which isn’t good either.

A tablet PC is not the best option for my project anyway so I didn’t investigate much in this direction. The same goes for All-in-one multitouch PCs.

DIY alternative

Heh, I might even built a table like MS Surface by myself. Impossible? Not at all nor it is expensive. Actually it is very cheap. On the negative side it is quite time consuming, even more if you aren’t used to build such things.

Software simulation with multiple mice(MultitouchVista project)

There is way to simulate multitouch with multiple mice on normal monitor as well. Unfortunately it is not a feature of the OS but rather through a project hosted at CodePlex. Note that project has a Vista name in it, yet it runs under Windows 7 only – both x64 and x86. The idea is to trick OS to believe that mouse pointers are in reality fingers. This is done through a custom driver and a couple of services. I’ve tried to make it work with a single mouse to simulate panning and it worked on IE but not in my WPF 4.0 application for some reason. It was really a quick test and I should investigate why it isn’t working for my application further. But if I make it work this will be my way of doing multi touch until I get a proper multi touch monitor, possibly Acer T230H.

Conclusion

Obviously multitouch development requires either a very expensive full featured or a cheaper, but simplified and feature lacking hardware. If you don’t want to spend any money at all then you have to check the MultitouchVista project. If you are looking for a cheap dual touch monitor then Acer T230H sounds like a good choice.

Note that the hardware characteristics in this post aren’t based on real experience but rather on the data collected from internet.

If you have a different, or a better solution, or some real experience, please let me know.

Running NLog in WPF Browser Application and other partially trusted environments

NLog is a pretty slick logging library, no doubts about that. However if you try to use it from a partially trusted environment you are facing some problems. The solution is to fix two things in the sources and recompile them. Here is the recipe:

1. Open solution NLog.vs2005.sln in Visual Studio. If you have no special needs you’ll need to recompile just the project NLog.vs2005 – you can safely remove others from the solution.

2. Add [assembly: System.Security.AllowPartiallyTrustedCallers] line to AssemblyInfo.cs file. With this change you are allowing partially trusted callers. This might not be enough. See the next paragraph.

3. If you don’t provide explicit configuration then NLog will try to read from environmental variable and thus causing a SecurityException due to EnvironmentPermission request which is not granted by default. To avoid this you’ll have to comment a piece of code in the LogFactory.Configuration property:

if (_config == null)
{
    if (EnvironmentHelper.GetSafeEnvironmentVariable("NLOG_GLOBAL_CONFIG_FILE") != null)
    {
        string configFile = Environment.GetEnvironmentVariable("NLOG_GLOBAL_CONFIG_FILE");
        if (File.Exists(configFile))
        {
            InternalLogger.Debug("Attempting to load config from {0}", configFile);
            _config = new XmlLoggingConfiguration(configFile);
        }
        else
        {
            InternalLogger.Warn("NLog global config file pointed by NLOG_GLOBAL_CONFIG '{0}' doesn't exist.", configFile);
        }
    }
}

Since the code is commented no EnvironmentPermission will be thrown even if there is no explicit configuration provided. As a side effect you can’t rely on default configuration settings anymore but this shouldn’t be a big issue since you can’t read them in a default partially trusted environment anyway.

4. Compile in release configuration and there you go.

Don’t forget, most of the default logging targets won’t work due to the security permissions. But the ones your application has access to will.

Happy logging.