Changed to use a static c# method - still thrown exception