NOVELTY - Solid-state p-n heterojunction comprises an organic p-type material in contact with an n-type material, where the device comprises a cathode separated from the n-type material by a porous barrier layer of at least one insulating material.    USE - The solid-state p-n heterojunction is useful for forming optoelectronic device such as photovoltaic cell, light sensing device, solar cell or photo-detector, preferably solid state dye sensitized solar cell. The porous barrier layer is useful for reducing light-induced drop in shunt resistance in solid-state p-n heterojunction under anaerobic conditions; and for maintaining efficiency of heterojunction at no less than 75% of its initial efficiency for a period of no less than 20 minutes under full sun illumination in the substantial absence of oxygen (all claimed).    ADVANTAGE - The invention provides optoelectronic devices having high stability in use.    DETAILED DESCRIPTION - INDEPENDENT CLAIMS are:    (1) an optoelectronic device comprising at least one solid state p-n heterojunction;    (2) a method for manufacturing solid-state p-n heterojunction comprising a cathode separated from the n-type material by a porous barrier layer of at least one insulating material, comprising: (a) coating an anode, preferably a transparent anode (e.g. a Fluorine doped Tin Oxide (FTO) cathode) with a compact layer of an n-type semiconductor material; (b) forming a porous (preferably mesoporous) layer of an n-type semiconductor material on the compact layer; (c) surface sensitizing the compact layer and/or the porous layer of n-type material with at least one sensitizing agent; (d) forming a porous barrier layer of an insulating material on the porous layer of n-type material; (e) forming a layer of a solid state p-type semiconductor material (preferably an organic hole transporting material) in contact with the porous layer of an n-type semiconductor material and penetrating the porous barrier layer; and (f) forming a cathode, preferably a metal cathode (e.g. a silver or gold cathode) on the porous barrier layer, in contact with the p-type semiconductor material; and    (3) an optoelectronic device such as a photovoltaic cell or light sensing device comprising at least one solid-state p-n heterojunction formed or formable by the method.