I am trying to learn Arcobject with C# through a book named "begining arcgis desktop using dotnet" , in this book an example is given to use geoprocesisng tool to be used through arcobject.

below in the code

IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument;
IMap map = mxdoc.FocusMap;
if (map.Layer[0] == null)
{ return; }
ILayer layer = map.Layer[0];
IDataset dataset = layer as IDataset;
IGeoProcessor2 gp = new GeoProcessorClass();
gp.AddOutputsToMap = true;
gp.OverwriteOutput = true;
//syntax of the tool from tool's reference page
//MultipleRingBuffer_analysis (Input_Features, Output_Feature_class,     Distances,
//{Buffer_Unit}, {Field_Name}, {Dissolve_Option}, {Outside_Polygons_Only})
IVariantArray parameters = new VarArrayClass();
parameters.Add(dataset.BrowseName + "MRB");
//you have to use ; to separate the distances (multivalue)
gp.Execute("MultipleRingBuffer_analysis", parameters, null);
object severity = null;
MessageBox.Show(gp.GetMessages(ref severity));

it throws an error of "An unhandled exception of type 'System.AccessViolationException' occurred in GeoprocessingProject.dll"

i am new to dot net. can some body help to resolve this error ?

1 Answer 1


I think the problem is your output. If you look at the help for this tool the syntax section clearly states the output is a FEATURECLASS.

You are providing a string which is the browse name + "MRB", so if your dataset you are buffering was called city then the output name is cityMRB. As you can see from my example your string does not say where to create this dataset. You would need to set the output workspace or provide a full path. Based upon the name I assume it is a geodatabase featureclass so what you should be supplying is a full path such as "C:\temp\mygeo.mdb\cityMRB"

I suspect the error is occurring because of that and it's defaulting to some location which is not creating a valid output FEATURECLASS name?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.