2

We have an old web form project and we want to add OWIN to it. A Startup class is added to the project. We have both assebmly attribute and config owin:appStartup app key in place. We have referenced Microsoft.Owin.Host.SystemWeb version 4.0.0.0 in our project. Whenever OWIN wants to discover its StartUp class we are getting a Yellow Screen Of Death with a FormatException shown (DateTime string is not in a correct format) Here's the stack trace of the exception:

[FormatException: The string was not recognized as a valid DateTime. There is an unknown word starting at index 20.]
   System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +14272006
   System.Windows.Forms.TypeLibraryTimeStampAttribute..ctor(String timestamp) +53
   System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0
   System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +48
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +787
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +144
   Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict) +190
   Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList`1 errors) +68
   Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails) +89
   Owin.Loader.DefaultLoader.Load(String startupName, IList`1 errorDetails) +30
   Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +165
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +37
   System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +135
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +160
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +580
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +165
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +267
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341

[HttpException (0x80004005): The string was not recognized as a valid DateTime. There is an unknown word starting at index 20.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688

We have other web form projects that are working fine and I can not understand what is wrong with our project.

Beatles1692
  • 5,214
  • 34
  • 65

1 Answers1

3

Based on your stacktrace, there must be a TypeLibraryTimeStampAttribute somewhere in your project with an invalid input that could not be parsed with DateTime.

your problem would probably be solved by removing TypeLibraryTimeStampAttribute or changing its input to a valid one.

Kahbazi
  • 14,331
  • 3
  • 45
  • 76
  • We have searched all the project files and couldn't find TypeLibraryTimeStampAttribute attribute. – Beatles1692 May 04 '19 at 12:21
  • well there has to be one, are you sure there isn't any usage of this attribute in code? Did you search for `TypeLibraryTimeStamp` in your code? – Kahbazi May 04 '19 at 13:18
  • 1
    It is possible that one of the assemblies referenced by your project has this attribute set (with an value not valid for your current locale setting). Also, see this related solution: https://stackoverflow.com/a/14708156/1689226 – Subbu May 05 '19 at 07:41