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

DebugLogger does not work in nuget-package #1089

Closed
fredrikhaglund opened this issue Jun 18, 2017 · 2 comments
Closed

DebugLogger does not work in nuget-package #1089

fredrikhaglund opened this issue Jun 18, 2017 · 2 comments

Comments

@fredrikhaglund
Copy link
Contributor

fredrikhaglund commented Jun 18, 2017

The DebugLogger class uses Debug.WriteLine and since nuget-packages for Prism is compiled in release mode this class will not work even if it is used in an application that is compiled in debug mode.

In addition the string handling is still there without doing anything which means unnecessary CPU cycles is spent on mobile devices. It does not appear that the linker manages to optimize the code and remove the string handling.

Package info

  • Platform: Xamarin
  • Prism version: 6.3.0

Repro steps

  • Create a new Xamarin Prism Application.
  • Configure the Prism Application to use the DebugLogger by overriding CreateLogger.

Expected: Additional debug information should be visible in the Visual Studio debug output during debugging.
Actually: Nothing is logged.

Suggested solution

Since the DebugLogger class never can work when compiled in Release-mode, add conditional compilation to prevent it from being used when Prism is consumed as a nuget-package.

Also change the default logger to EmptyLogger when Prism is not compiled in debug mode.

My suggestion how to improve Prism

@brianlagunas
Copy link
Member

brianlagunas commented Jun 27, 2017

I think your solution makes sense. I mainly leave the Debug logger there for when I am developing features. It makes sense that when it is in release mode, that an empty logger should be provided, and the developer must provide their own logger if they wish. Submit your PR.

@lock
Copy link

lock bot commented Jan 30, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants