Skip to content

Commit 2e54816

Browse files
authored
Merge pull request #14 from milkshakeuk/ActivateObjectFixNetStandard
Fixes ActivateObject method in ConfigurableContext - netstandard2.0 only.
2 parents 3f52322 + 96c036b commit 2e54816

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Base/Validation/ConfigurableContext.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,15 @@ private T ActivateObject<T>(string assembly, string classType) where T:class
7070
{
7171
#if NETSTANDARD2_0
7272
var loadedAssembly = Assembly.Load(assembly);
73-
var type = loadedAssembly.GetTypes().SingleOrDefault(t => !t.IsAbstract && !t.IsInterface && t.IsClass && t.Name == classType);
73+
var type =
74+
loadedAssembly.GetTypes()
75+
.SingleOrDefault(
76+
t => !t.IsAbstract && !t.IsInterface && t.IsClass && t.FullName == classType.Trim());
77+
78+
if (type == null)
79+
{
80+
throw new ArgumentException($"Could not find classType: {classType} in Assembly: {assembly}");
81+
}
7482

7583
var instance = Activator.CreateInstance(type);
7684
return instance as T;

NuGet/NHapiTools.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>NHapiTools</id>
5-
<version>1.11.0.0</version>
5+
<version>1.11.0.1</version>
66
<authors>Division by Zero</authors>
77
<owners>Division by Zero</owners>
88
<license type="file">LICENSE</license>

TestApp/Program.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ private static void Main(string[] args)
4242
_parsedMessages = new List<IMessage>();
4343

4444
TestSourceGenerator();
45-
// HL7InputStreamMessageStringEnumerator is possibly broken throws DirectoryNotFoundException "Could not find part of the path." or the test is broken?
46-
//TestHl7FileStream();
47-
// HL7InputStreamMessageStringEnumerator is possibly broken throws DirectoryNotFoundException "Could not find part of the path." or the test is broken?
48-
//TestHl7FileMessageStream();
45+
TestHl7FileStream();
46+
TestHl7FileMessageStream();
4947
TestParserAutomatedContext();
5048
TestParserConfigurableContext();
5149
TestGenericMessageWrapper();
@@ -499,6 +497,7 @@ private static void SpinnerWhileWaiting(Action processingMethod)
499497
private static void mfs_FileCompleted(object sender, FileCompletedEventArgs e)
500498
{
501499
var path = _basePath + "\\TestApp\\TestMessages\\Done";
500+
Directory.CreateDirectory(path);
502501

503502
var fi = new FileInfo(e.FileName);
504503
fi.MoveTo(path + "\\" + fi.Name);

0 commit comments

Comments
 (0)