try to determine generic type parameters from constructor arguments (closes #2044)