나는 C# VS11 베타에 응용 프로그램이 있습니다.스레드 던지는 개체를 찾을 수 있지만 개체가 분명히 있습니다
아래 코드는 디버그 정보 테이블 null
아니라고 도시 NullReferenceException
(주석 라인)
private void ParralelProcessor(Int32 threadNum)
{
HashSet<Feature> Features = new HashSet<Feature>();
HashSet<FeatureType> FeatureTypes = new HashSet<FeatureType>();
DataTable TopographicFeatures = new DataTable();
DataTable TopographicFeatureObjects = new DataTable();
DataTable CartographicText = new DataTable();
DataTable CartographicSymbol = new DataTable();
List<DataRow> FeaturesAsRows = new List<DataRow>();
List<DataRow> FeatureObjectsAsRows = new List<DataRow>();
List<DataRow> CartographicTextAsRows = new List<DataRow>();
List<DataRow> CartographicSymbolAsRows = new List<DataRow>();
Thread.Sleep(100);
TopographicFeatures.Columns.Add("fid", typeof(System.Int64));
TopographicFeatures.Columns.Add("FeatureId", typeof(System.Int16));
TopographicFeatureObjects.Columns.Add("fid", typeof(System.Int64));
//BELOW
TopographicFeatureObjects.Columns.Add("GeoCoordinates", typeof(SqlGeometry)); //THIS LINE
//ABOVE
TopographicFeatureObjects.Columns.Add("TypeId", typeof(System.Int16));
CartographicText.Columns.Add("fid", typeof(System.Int64));
CartographicText.Columns.Add("textString", typeof(System.String));
CartographicText.Columns.Add("anchorPosition", typeof(System.Int16));
CartographicText.Columns.Add("font", typeof(System.Int16));
CartographicText.Columns.Add("height", typeof(System.Decimal));
CartographicText.Columns.Add("orientation", typeof(System.Decimal));
CartographicSymbol.Columns.Add("fid", typeof(System.Int64));
CartographicSymbol.Columns.Add("orientation", typeof(System.Decimal));
던져 둘 열 컬렉션 없다.
그것은 모든 객체가 선언되어있어서, 따라서 각 스레드가 자신의 인스턴스를 가지고 배치되어
Parallel.For(1, ThreadsPerFile + 1, X => { ParralelProcessor(X); });
아래와 같이 Parralel.For
루프에서 호출되는 내부 메소드를 실행한다.
저는 왜 이것이 예외를 던지고 있는지에 대해 다소 혼란 스럽습니다.
전체 오류 텍스트와 호출 스택을 포함 할 수 있습니까? –
일반적인 for-loop에서 작동합니까? – Oliver