New techniques of local sensitivity analysis in nonsmooth optimization are applied to the problem of determining the asymptotic distribution (generally non-normal) for solutions in stochastic optimization, and generalized M-estimation -- a reformulation of the traditional maximum likelihood problem that allows the introduction of hard constraints.