diff --git a/Code/BugFreak.MVC3.Tests/BugFreak.MVC3.Tests.csproj b/Code/BugFreak.MVC3.Tests/BugFreak.MVC3.Tests.csproj
index d9224e2..0a90098 100644
--- a/Code/BugFreak.MVC3.Tests/BugFreak.MVC3.Tests.csproj
+++ b/Code/BugFreak.MVC3.Tests/BugFreak.MVC3.Tests.csproj
@@ -65,6 +65,10 @@
{5e6fc290-8b43-4e53-bb07-cc2abd839b75}
BugFreak.MVC3
+
+ {6423cea7-9e46-48c4-b3c5-c0cfa5e5ff7a}
+ BugFreak
+
diff --git a/Code/BugFreak.MVC3.Tests/Components/RequestErrorDataProviderTests.cs b/Code/BugFreak.MVC3.Tests/Components/RequestErrorDataProviderTests.cs
index de7b637..c022e5b 100644
--- a/Code/BugFreak.MVC3.Tests/Components/RequestErrorDataProviderTests.cs
+++ b/Code/BugFreak.MVC3.Tests/Components/RequestErrorDataProviderTests.cs
@@ -1,6 +1,6 @@
using System.Globalization;
using System.Linq;
-using BugFreak.Core.Components;
+using BugFreak.Components;
using FluentAssertions;
using NUnit.Framework;
@@ -50,5 +50,15 @@ public void GetData_Always_SetsQueryString()
var addedQuery = result.First(pair => pair.Key == "Query").Value;
addedQuery.Should().Be(query);
}
+
+ [Test]
+ public void GetData_WhenContextIsNull_ReturnsEmptyList()
+ {
+ _subject.HttpContext = null;
+
+ var result = _subject.GetData();
+
+ result.Should().BeEmpty();
+ }
}
}
diff --git a/Code/BugFreak.MVC3.Tests/Components/SessionErrorDataProviderTests.cs b/Code/BugFreak.MVC3.Tests/Components/SessionErrorDataProviderTests.cs
index f8a26f3..5d60ead 100644
--- a/Code/BugFreak.MVC3.Tests/Components/SessionErrorDataProviderTests.cs
+++ b/Code/BugFreak.MVC3.Tests/Components/SessionErrorDataProviderTests.cs
@@ -1,6 +1,6 @@
using System.Globalization;
using System.Linq;
-using BugFreak.Core.Components;
+using BugFreak.Components;
using FluentAssertions;
using NUnit.Framework;
@@ -49,5 +49,15 @@ public void GetData_Always_SetsSessionTimeout()
var timeout = result.First(pair => pair.Key == "SessionTimeout").Value;
timeout.Should().Be(_subject.HttpContext.Session.Timeout.ToString(CultureInfo.InvariantCulture));
}
+
+ [Test]
+ public void GetData_WhenHttpContextIsNull_ReturnsEmptyList()
+ {
+ _subject.HttpContext = null;
+
+ var result = _subject.GetData();
+
+ result.Should().BeEmpty();
+ }
}
}
\ No newline at end of file
diff --git a/Code/BugFreak.MVC3.Tests/Components/UserErrorDataProviderTests.cs b/Code/BugFreak.MVC3.Tests/Components/UserErrorDataProviderTests.cs
index d1d23e8..66ecb54 100644
--- a/Code/BugFreak.MVC3.Tests/Components/UserErrorDataProviderTests.cs
+++ b/Code/BugFreak.MVC3.Tests/Components/UserErrorDataProviderTests.cs
@@ -1,7 +1,7 @@
using System.Linq;
using System.Security.Principal;
using System.Web;
-using BugFreak.Core.Components;
+using BugFreak.Components;
using FluentAssertions;
using Moq;
using NUnit.Framework;
@@ -83,5 +83,15 @@ public void GetData_WhenIsAuthenticated_AddsAuthenticationType()
var addedAuthenticationType = result.First(pair => pair.Key == "AuthenticationType");
addedAuthenticationType.Should().Be(addedAuthenticationType);
}
+
+ [Test]
+ public void GetData_WhenHttpContextIsNull_ReturnsEmptyList()
+ {
+ _subject.HttpContext = null;
+
+ var result = _subject.GetData();
+
+ result.Should().BeEmpty();
+ }
}
}
diff --git a/Code/BugFreak.MVC3/BugFreak.MVC3.csproj b/Code/BugFreak.MVC3/BugFreak.MVC3.csproj
index 90fb6e6..aa98820 100644
--- a/Code/BugFreak.MVC3/BugFreak.MVC3.csproj
+++ b/Code/BugFreak.MVC3/BugFreak.MVC3.csproj
@@ -32,6 +32,10 @@
4
+
+ False
+ ..\packages\BugFreak.1.0.1.0\lib\net35-Client\BugFreak.dll
+
True
..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll
@@ -71,105 +75,12 @@
-
- Core\Collections\ObservableList.cs
-
-
- Core\Components\ErrorHandler.cs
-
-
- Core\Components\ErrorQueue.cs
-
-
- Core\Components\ErrorReportSaveCompletedEventArgs.cs
-
-
- Core\Components\FormErrorReportSerializer.cs
-
-
- Core\Components\IErrorDataProvider.cs
-
-
- Core\Components\IErrorHandler.cs
-
-
- Core\Components\IErrorQueue.cs
-
-
- Core\Components\IErrorReportSerializer.cs
-
-
- Core\Components\IErrorReportStorage.cs
-
-
- Core\Components\Initializer.cs
-
-
- Core\Components\IReportRequestBuilder.cs
-
-
- Core\Components\LocalErrorReportStorage.cs
-
-
- Core\Components\PendingReport.cs
-
-
- Core\Components\RemoteErrorReportStorage.cs
-
-
- Core\Components\ReportRequestBuildCompletedEventArgs.cs
-
-
- Core\Components\ReportRequestBuilder.cs
-
-
- Core\Components\SimpleServiceContainer.cs
-
-
- Core\Components\WebRequestFactory.cs
-
-
- ErrorReport.cs
-
-
- Core\Framework\ExecutionContext.cs
-
-
- Core\Framework\IResult.cs
-
-
- Core\Framework\IServiceLocator.cs
-
-
- Core\Framework\ResultCompletionEventArgs.cs
-
-
- Core\Framework\SequentialResult.cs
-
-
- GlobalConfig.cs
-
-
- IReportingService.cs
-
-
- ReportingService.cs
-
-
- Core\Results\ErrorReportSaveResult.cs
-
-
- Core\Results\RequestBuildResult.cs
-
-
- Core\Results\RequestExecutionResult.cs
-
-
-
-
+
+
+
-
+
diff --git a/Code/BugFreak.MVC3/BugFreak.MVC3.nuspec b/Code/BugFreak.MVC3/BugFreak.MVC3.nuspec
index 66e16b5..d1a62d7 100644
--- a/Code/BugFreak.MVC3/BugFreak.MVC3.nuspec
+++ b/Code/BugFreak.MVC3/BugFreak.MVC3.nuspec
@@ -14,7 +14,7 @@
Copyright 2013
error reporting exception handle mvc
-
-
-
+
+
+
\ No newline at end of file
diff --git a/Code/BugFreak.MVC3/BugFreak.cs b/Code/BugFreak.MVC3/BugFreak.cs
index 2d7776b..94848ac 100644
--- a/Code/BugFreak.MVC3/BugFreak.cs
+++ b/Code/BugFreak.MVC3/BugFreak.cs
@@ -1,10 +1,9 @@
-using BugFreak.Core.Components;
-using BugFreak.MVC3;
+using BugFreak.Components;
+using BugFreak.Infrastructure;
+using System.Web.Mvc;
namespace BugFreak
{
- using System.Web.Mvc;
-
public class BugFreak
{
public static void Hook(string apiKey, string token)
diff --git a/Code/BugFreak.MVC3/Components/RequestErrorDataProvider.cs b/Code/BugFreak.MVC3/Components/RequestErrorDataProvider.cs
new file mode 100644
index 0000000..c182fb0
--- /dev/null
+++ b/Code/BugFreak.MVC3/Components/RequestErrorDataProvider.cs
@@ -0,0 +1,37 @@
+
+namespace BugFreak.Components
+{
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Web;
+
+ public class RequestErrorDataProvider : IErrorDataProvider
+ {
+ private HttpContext _httpContext;
+
+ public HttpContext HttpContext
+ {
+ get { return _httpContext ?? HttpContext.Current; }
+ set { _httpContext = value; }
+ }
+
+ public List> GetData()
+ {
+ var result = new List>();
+
+ if (HttpContext != null)
+ {
+ result.Add(new KeyValuePair("Timestamp", HttpContext.Timestamp.ToString(CultureInfo.InvariantCulture)));
+ result.Add(new KeyValuePair("URL", HttpContext.Request.Url.AbsoluteUri));
+ result.Add(new KeyValuePair("Query", HttpContext.Request.QueryString.ToString()));
+ result.Add(new KeyValuePair("HttpMethod", HttpContext.Request.HttpMethod));
+ result.Add(new KeyValuePair("User Agent", HttpContext.Request.UserAgent));
+ result.Add(new KeyValuePair("Accept", string.Join(", ", HttpContext.Request.AcceptTypes ?? new string[0])));
+ result.Add(new KeyValuePair("Content-Length", HttpContext.Request.ContentLength.ToString(CultureInfo.InvariantCulture)));
+ result.Add(new KeyValuePair("Content-Type", HttpContext.Request.ContentType));
+ }
+
+ return result;
+ }
+ }
+}
diff --git a/Code/BugFreak.MVC3/Components/SessionErrorDataProvider.cs b/Code/BugFreak.MVC3/Components/SessionErrorDataProvider.cs
new file mode 100644
index 0000000..d927e9f
--- /dev/null
+++ b/Code/BugFreak.MVC3/Components/SessionErrorDataProvider.cs
@@ -0,0 +1,31 @@
+namespace BugFreak.Components
+{
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Web;
+
+ public class SessionErrorDataProvider : IErrorDataProvider
+ {
+ private HttpContext _httpContext;
+
+ public HttpContext HttpContext
+ {
+ get { return _httpContext ?? HttpContext.Current; }
+ set { _httpContext = value; }
+ }
+
+ public List> GetData()
+ {
+ var result = new List>();
+
+ if (HttpContext != null && HttpContext.Session != null)
+ {
+ result.Add(new KeyValuePair("SessionID", HttpContext.Session.SessionID));
+ result.Add(new KeyValuePair("SessionTimeout", HttpContext.Session.Timeout.ToString(CultureInfo.InvariantCulture)));
+ result.Add(new KeyValuePair("SessionIsNew", HttpContext.Session.IsNewSession.ToString()));
+ }
+
+ return result;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Code/BugFreak.MVC3/Core/Components/UserErrorDataProvider.cs b/Code/BugFreak.MVC3/Components/UserErrorDataProvider.cs
similarity index 60%
rename from Code/BugFreak.MVC3/Core/Components/UserErrorDataProvider.cs
rename to Code/BugFreak.MVC3/Components/UserErrorDataProvider.cs
index e9ef579..70300df 100644
--- a/Code/BugFreak.MVC3/Core/Components/UserErrorDataProvider.cs
+++ b/Code/BugFreak.MVC3/Components/UserErrorDataProvider.cs
@@ -1,16 +1,20 @@
-using System.Collections.Generic;
-using System.Web;
-using BugFreak.Components;
-
-namespace BugFreak.Core.Components
+namespace BugFreak.Components
{
+ using System.Collections.Generic;
+ using System.Web;
+
public class UserErrorDataProvider : IErrorDataProvider
{
private HttpContextBase _httpContext;
public HttpContextBase HttpContext
{
- get { return _httpContext ?? new HttpContextWrapper(System.Web.HttpContext.Current); }
+ get
+ {
+ return _httpContext ?? (System.Web.HttpContext.Current != null
+ ? new HttpContextWrapper(System.Web.HttpContext.Current)
+ : null);
+ }
set { _httpContext = value; }
}
@@ -18,7 +22,7 @@ public List> GetData()
{
var result = new List>();
- if (HttpContext.Request.IsAuthenticated)
+ if (HttpContext != null && HttpContext.Request.IsAuthenticated)
{
result.Add(new KeyValuePair("Username", HttpContext.User.Identity.Name));
result.Add(new KeyValuePair("AuthenticationType", HttpContext.User.Identity.AuthenticationType));
diff --git a/Code/BugFreak.MVC3/Core/Components/RequestErrorDataProvider.cs b/Code/BugFreak.MVC3/Core/Components/RequestErrorDataProvider.cs
deleted file mode 100644
index 094664b..0000000
--- a/Code/BugFreak.MVC3/Core/Components/RequestErrorDataProvider.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Collections.Generic;
-using System.Globalization;
-using System.Web;
-using BugFreak.Components;
-
-namespace BugFreak.Core.Components
-{
- public class RequestErrorDataProvider : IErrorDataProvider
- {
- private HttpContext _httpContext;
-
- public HttpContext HttpContext
- {
- get { return _httpContext ?? HttpContext.Current; }
- set { _httpContext = value; }
- }
-
- public List> GetData()
- {
- var result = new List>
- {
- new KeyValuePair("Timestamp", HttpContext.Timestamp.ToString(CultureInfo.InvariantCulture)),
- new KeyValuePair("URL", HttpContext.Request.Url.AbsoluteUri),
- new KeyValuePair("Query", HttpContext.Request.QueryString.ToString()),
- new KeyValuePair("HttpMethod", HttpContext.Request.HttpMethod),
- new KeyValuePair("User Agent", HttpContext.Request.UserAgent),
- new KeyValuePair("Accept", string.Join(", ", HttpContext.Request.AcceptTypes ?? new string[0])),
- new KeyValuePair("Content-Length", HttpContext.Request.ContentLength.ToString(CultureInfo.InvariantCulture)),
- new KeyValuePair("Content-Type", HttpContext.Request.ContentType)
- };
-
- return result;
- }
- }
-}
diff --git a/Code/BugFreak.MVC3/Core/Components/SessionErrorDataProvider.cs b/Code/BugFreak.MVC3/Core/Components/SessionErrorDataProvider.cs
deleted file mode 100644
index 3dd3e9c..0000000
--- a/Code/BugFreak.MVC3/Core/Components/SessionErrorDataProvider.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System.Collections.Generic;
-using System.Globalization;
-using System.Web;
-using BugFreak.Components;
-
-namespace BugFreak.Core.Components
-{
- public class SessionErrorDataProvider : IErrorDataProvider
- {
- private HttpContext _httpContext;
-
- public HttpContext HttpContext
- {
- get { return _httpContext ?? HttpContext.Current; }
- set { _httpContext = value; }
- }
-
- public List> GetData()
- {
- var result = new List>
- {
- new KeyValuePair("SessionID", HttpContext.Session.SessionID),
- new KeyValuePair("SessionTimeout", HttpContext.Session.Timeout.ToString(CultureInfo.InvariantCulture)),
- new KeyValuePair("SessionIsNew", HttpContext.Session.IsNewSession.ToString())
- };
-
- return result;
- }
- }
-}
\ No newline at end of file
diff --git a/Code/BugFreak.MVC3/ReportErrorAttribute.cs b/Code/BugFreak.MVC3/Infrastructure/ReportErrorAttribute.cs
similarity index 79%
rename from Code/BugFreak.MVC3/ReportErrorAttribute.cs
rename to Code/BugFreak.MVC3/Infrastructure/ReportErrorAttribute.cs
index 93e536f..acd14ff 100644
--- a/Code/BugFreak.MVC3/ReportErrorAttribute.cs
+++ b/Code/BugFreak.MVC3/Infrastructure/ReportErrorAttribute.cs
@@ -1,8 +1,7 @@
-using System.Web.Mvc;
-using BugFreak;
-
-namespace BugFreak.MVC3
+namespace BugFreak.Infrastructure
{
+ using System.Web.Mvc;
+
public class ReportErrorAttribute : HandleErrorAttribute
{
public override void OnException(ExceptionContext filterContext)
diff --git a/Code/BugFreak.MVC3/Properties/AssemblyInfo.cs b/Code/BugFreak.MVC3/Properties/AssemblyInfo.cs
index 779a8e1..b52427d 100644
--- a/Code/BugFreak.MVC3/Properties/AssemblyInfo.cs
+++ b/Code/BugFreak.MVC3/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.1.0")]
-[assembly: AssemblyFileVersion("1.0.1.0")]
+[assembly: AssemblyVersion("1.0.1.3")]
+[assembly: AssemblyFileVersion("1.0.1.3")]
diff --git a/Code/BugFreak.MVC3/packages.config b/Code/BugFreak.MVC3/packages.config
index 0b7e84c..f9f556a 100644
--- a/Code/BugFreak.MVC3/packages.config
+++ b/Code/BugFreak.MVC3/packages.config
@@ -1,6 +1,7 @@
+
diff --git a/Code/BugFreak.WPF.Tests/BugFreak.WPF.Tests.csproj b/Code/BugFreak.WPF.Tests/BugFreak.WPF.Tests.csproj
index 5bf21f2..263da6c 100644
--- a/Code/BugFreak.WPF.Tests/BugFreak.WPF.Tests.csproj
+++ b/Code/BugFreak.WPF.Tests/BugFreak.WPF.Tests.csproj
@@ -58,6 +58,10 @@
{a27585f1-fcee-407a-aff0-f4d2300ca226}
BugFreak.WPF
+
+ {6423cea7-9e46-48c4-b3c5-c0cfa5e5ff7a}
+ BugFreak
+
diff --git a/Code/BugFreak.WPF/BugFreak.WPF.csproj b/Code/BugFreak.WPF/BugFreak.WPF.csproj
index c823a55..467b472 100644
--- a/Code/BugFreak.WPF/BugFreak.WPF.csproj
+++ b/Code/BugFreak.WPF/BugFreak.WPF.csproj
@@ -12,6 +12,8 @@
v3.5
512
Client
+ ..\
+ true
true
@@ -31,6 +33,10 @@
4
+
+ False
+ ..\packages\BugFreak.1.0.1.0\lib\net35-Client\BugFreak.dll
+
@@ -42,107 +48,15 @@
-
- Collections\ObservableList.cs
-
-
- Components\EnvironmentErrorDataProvider.cs
-
-
- Components\ErrorHandler.cs
-
-
- Components\ErrorQueue.cs
-
-
- Components\ErrorReportSaveCompletedEventArgs.cs
-
-
- Components\FormErrorReportSerializer.cs
-
-
- Components\IErrorDataProvider.cs
-
-
- Components\IErrorHandler.cs
-
-
- Components\IErrorQueue.cs
-
-
- Components\IErrorReportSerializer.cs
-
-
- Components\IErrorReportStorage.cs
-
-
- Components\Initializer.cs
-
-
- Components\IReportRequestBuilder.cs
-
-
- Components\LocalErrorReportStorage.cs
-
-
- Components\PendingReport.cs
-
-
- Components\RemoteErrorReportStorage.cs
-
-
- Components\ReportRequestBuildCompletedEventArgs.cs
-
-
- Components\ReportRequestBuilder.cs
-
-
- Components\SimpleServiceContainer.cs
-
-
- Components\WebRequestFactory.cs
-
-
- ErrorReport.cs
-
-
- Framework\ExecutionContext.cs
-
-
- Framework\IResult.cs
-
-
- Framework\IServiceLocator.cs
-
-
- Framework\ResultCompletionEventArgs.cs
-
-
- Framework\SequentialResult.cs
-
-
- GlobalConfig.cs
-
-
- IReportingService.cs
-
-
- ReportingService.cs
-
-
- Results\ErrorReportSaveResult.cs
-
-
- Results\RequestBuildResult.cs
-
-
- Results\RequestExecutionResult.cs
-
+
+
+
+