{"Can't find config file":null} {Name = "ConfigFile" FullName = "System.Data.Fabric.Common.ConfigFile"}

Answered {"Can't find config file":null} {Name = "ConfigFile" FullName = "System.Data.Fabric.Common.ConfigFile"}

  • 31 августа 2009 г. 3:37
     
     
    I have an unit test with following code. There's an Exception of "Can't find config file", whenever I create an instance of DataCacheFactory. All my configurations are put in code directly, and there's no config file for test project.

    When I view detail for the exception, I can find DeclaringType with value of {Name = "ConfigFile" FullName = "System.Data.Fabric.Common.ConfigFile"}.

    Call Stack:-
    --
    FabricCommon.dll!System.Data.Fabric.Common.ConfigFile.Load() + 0x131 bytes 
    FabricCommon.dll!System.Data.Fabric.Common.ConfigFile.Config.get() + 0xc0 bytes 
    FabricCommon.dll!System.Data.Fabric.Common.EventLogWriter.LoadSinkFromConfig() + 0x24 bytes 
    FabricCommon.dll!System.Data.Fabric.Common.EventLogWriter.EventLogWriter() + 0x18 bytes 
    [Native to Managed Transition] 
    [Managed to Native Transition] 
    ClientLibrary.dll!Microsoft.Data.Caching.DataCacheFactory.DataCacheFactory(Microsoft.Data.Caching.DataCacheServerEndpoint[] servers = {Microsoft.Data.Caching.DataCacheServerEndpoint[3]}, bool routingClient = true, bool localCache = false, Microsoft.Data.Caching.DataCacheLocalCacheSyncPolicy syncPolicy = NotificationBased, int localCacheTimeout = 300, int pollInterval = 300) + 0x151 bytes 

    My Code:-
    --

    [

    TestMethod()]

     

    public void PutObjectInNutShell()

    {

     

    Guid id = Guid.NewGuid();

     

    Random r = new Random();

     

    int obj = r.Next();

     

    DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[3];

    servers[0] =

    new DataCacheServerEndpoint("10.222.100.151", 22233, "DistributedCacheService");

    servers[1] =

    new DataCacheServerEndpoint("10.222.100.152", 22233, "DistributedCacheService");

    servers[2] =

    new DataCacheServerEndpoint("10.222.100.153", 22233, "DistributedCacheService");

     

    DataCacheFactory cacheFactory = new DataCacheFactory(servers, true, false, DataCacheLocalCacheSyncPolicy.NotificationBased, 300, 300);

     

    // get cache client for cache "FirstCache"

     

    DataCache _DC = cacheFactory.GetCache("VelocityCache");

    _DC.Put(id.ToString(), obj);

    }

    Thanks a lot!

Все ответы

  • 31 августа 2009 г. 5:38
     
     Отвечено
    Hi, does this come as an unhandled exception? This exception is actually internal to Velocity and is caught internally.
    Amit. (Velocity Dev, MSFT)
  • 1 сентября 2009 г. 6:05
     
     
    It's indeed handled by Velocity internally, but still give me quite a shock. Isn't it not a good practice in C# to throw an exception, and then swallow it later?
  • 1 сентября 2009 г. 8:27
     
     Отвечено

    An exception normally means something bad has happened. It can be thrown and caught in code for various reasons:

    1.       It is only done in error scenarios so won’t be a perf hit for normal cases.

    2.       To maintain layering/stack of components.

    3.       Easier understandability.

    Hence it is not bad to follow this approach. Does it make sense to you?


    Amit. (Velocity Dev, MSFT)
  • 12 июня 2012 г. 15:33
     
     

    Hi All,

    Getting the same error when using AppFabric 1.1. 

    However this is handled by MS internal exception.

    The question is: is something wrong with the cache client or server configurations ?

    Following is the DebugDiag 1.2 stack trace fragment

    Microsoft.Fabric.Common.ConfigFile.Load()
    Microsoft.Fabric.Common.ConfigFile.get_Config()
    Microsoft.Fabric.Common.EventLogWriter.LoadSinkFromConfig()
    Microsoft.Fabric.Common.EventLogWriter..cctor()
    Microsoft.Fabric.Common.EventLogWriter.AddSink(Microsoft.Fabric.Common.IEventSink, Int32)
    Microsoft.ApplicationServer.Caching.DataCacheClientLogManager.Initialize(Microsoft.ApplicationServer.Caching.DataCacheLogSink)
    Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration.Initialize(System.String)
    MyTest.Init() [C:\Test\MyTestCache.cs @ 95]

     

    Thanks in advance,

    Evgeny 


    EvgenyV