Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutual recursion between classes Dicom.Implementation and Dicom.Data.DicomUID throws NullReferenceException #9

Closed
GoogleCodeExporter opened this issue May 7, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

There seems to be a bug due to mutual recursion between
Dicom.Implementation.ClassUID and Dicom.Data.DicomUID.InstanceRootUID.

In detail, here's what happens:

1. Dicom.Implementation.ClassUID is of type DicomUID, and it's a static
field (assigned when the class is first used, right?).

2. Use the class Dicom.Implementation in any way you like. Anything will do,
System.Console.WriteLine(Dicom.Implementation.Version) is enough.

3. This triggers the initialization of the ClassUID field, and to assign
it, a DicomUID instance will be created.

4. As this is the first time we're using DicomUID the static fields should
be set. One of the field is InstanceRootUID which when initialized will
eventually use ClassUID of Dicom.Implementation.

5. Dicom.Implementation.ClassUID is still null, as it's not yet assigned.

6. You will get a NullReferenceException.


This is the callstack, copy'n'pasted from VS:

Dicom.dll!Dicom.Data.DicomUID.Generate(Dicom.Data.DicomUID baseUid = null,
long nextSeq = 114354090805) Line 116
Dicom.dll!Dicom.Data.DicomUID.CreateInstanceRootUID() Line 82
Dicom.dll!Dicom.Data.DicomUID.DicomUID() Line 73
[Native to Managed Transition]  
[Managed to Native Transition]  
Dicom.dll!Dicom.Implementation.Implementation() Line 30


As far as I'm aware, this should be something that all users of the library
should see, and I'm a bit surprised nobody reported this until now?
Or maybe I've confused something... :)

My project using mDCM compiled and could listen to sockets, but when
receiving connections it failed during parsing PDUs.

I'm using the latest SVN Revision 66. I did not have this issue with SVN #64.

Original issue reported on code.google.com by lennart....@vgregion.se on 23 Oct 2009 at 3:05

@GoogleCodeExporter
Copy link
Author

Corrected in SVN 67.

Thanks!

Original comment by colby.di...@gmail.com on 3 Nov 2009 at 4:16

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant